From 3fb4ca2429b78210f667d99fa3886429e42137f6 Mon Sep 17 00:00:00 2001 From: Chad Little Date: Fri, 26 May 2017 18:54:21 -0700 Subject: [PATCH 01/31] Add needActiveDiffs to differential.createcomment method Summary: Ref T12766. Adds missing attachment for stacking actions in differential Test Plan: Asked end user to verify patch. Reviewers: epriestley, amckinley Reviewed By: epriestley, amckinley Subscribers: reed, Korvin Maniphest Tasks: T12766 Differential Revision: https://secure.phabricator.com/D18038 --- .../conduit/DifferentialCreateCommentConduitAPIMethod.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/applications/differential/conduit/DifferentialCreateCommentConduitAPIMethod.php b/src/applications/differential/conduit/DifferentialCreateCommentConduitAPIMethod.php index 52736d6f3b..943c3e7702 100644 --- a/src/applications/differential/conduit/DifferentialCreateCommentConduitAPIMethod.php +++ b/src/applications/differential/conduit/DifferentialCreateCommentConduitAPIMethod.php @@ -49,6 +49,7 @@ final class DifferentialCreateCommentConduitAPIMethod ->withIDs(array($request->getValue('revision_id'))) ->needReviewers(true) ->needReviewerAuthority(true) + ->needActiveDiffs(true) ->executeOne(); if (!$revision) { throw new ConduitException('ERR_BAD_REVISION'); From e5b3d0331974e26523e2c4077886abf62dfc3557 Mon Sep 17 00:00:00 2001 From: Chad Little Date: Fri, 26 May 2017 17:23:25 -0700 Subject: [PATCH 02/31] Fix lightbox circle icons Summary: These are unfortunatly manually built so I missed them in testing circle view changes. Test Plan: Test lightbox, conpherence, uiexamples Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Differential Revision: https://secure.phabricator.com/D18036 --- resources/celerity/map.php | 24 +++++++++---------- src/view/page/PhabricatorStandardPageView.php | 3 ++- .../js/core/behavior-lightbox-attachments.js | 4 ++-- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/resources/celerity/map.php b/resources/celerity/map.php index a2119c98a4..241f9acf08 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -10,7 +10,7 @@ return array( 'conpherence.pkg.css' => 'ff161f2d', 'conpherence.pkg.js' => 'b5b51108', 'core.pkg.css' => '19f6f61f', - 'core.pkg.js' => '21d34805', + 'core.pkg.js' => '1475bd91', 'darkconsole.pkg.js' => '1f9a31bc', 'differential.pkg.css' => '7d4cfa59', 'differential.pkg.js' => '1d120743', @@ -501,7 +501,7 @@ return array( 'rsrc/js/core/behavior-hovercard.js' => 'bcaccd64', 'rsrc/js/core/behavior-keyboard-pager.js' => 'a8da01f0', 'rsrc/js/core/behavior-keyboard-shortcuts.js' => '01fca1f0', - 'rsrc/js/core/behavior-lightbox-attachments.js' => 'a5c57c24', + 'rsrc/js/core/behavior-lightbox-attachments.js' => '560f41da', 'rsrc/js/core/behavior-line-linker.js' => '1499a8cb', 'rsrc/js/core/behavior-more.js' => 'a80d0378', 'rsrc/js/core/behavior-object-selector.js' => 'e0ec7f2f', @@ -644,7 +644,7 @@ return array( 'javelin-behavior-history-install' => '7ee2b591', 'javelin-behavior-icon-composer' => '8499b6ab', 'javelin-behavior-launch-icon-composer' => '48086888', - 'javelin-behavior-lightbox-attachments' => 'a5c57c24', + 'javelin-behavior-lightbox-attachments' => '560f41da', 'javelin-behavior-line-chart' => 'e4232876', 'javelin-behavior-load-blame' => '42126667', 'javelin-behavior-maniphest-batch-editor' => '782ab6e7', @@ -1332,6 +1332,15 @@ return array( 'javelin-vector', 'javelin-dom', ), + '560f41da' => array( + 'javelin-behavior', + 'javelin-stratcom', + 'javelin-dom', + 'javelin-mask', + 'javelin-util', + 'phuix-icon-view', + 'phabricator-busy', + ), '58dea2fa' => array( 'javelin-install', 'javelin-util', @@ -1708,15 +1717,6 @@ return array( 'javelin-uri', 'phabricator-notification', ), - 'a5c57c24' => array( - 'javelin-behavior', - 'javelin-stratcom', - 'javelin-dom', - 'javelin-mask', - 'javelin-util', - 'phuix-icon-view', - 'phabricator-busy', - ), 'a6b98425' => array( 'javelin-behavior', 'javelin-dom', diff --git a/src/view/page/PhabricatorStandardPageView.php b/src/view/page/PhabricatorStandardPageView.php index ffa82ab1b9..a138d077b5 100644 --- a/src/view/page/PhabricatorStandardPageView.php +++ b/src/view/page/PhabricatorStandardPageView.php @@ -268,7 +268,8 @@ final class PhabricatorStandardPageView extends PhabricatorBarePageView } $icon = id(new PHUIIconView()) - ->setIcon('fa-download'); + ->setIcon('fa-download') + ->addClass('phui-icon-circle-icon'); $lightbox_id = celerity_generate_unique_node_id(); $download_form = phabricator_form( $user, diff --git a/webroot/rsrc/js/core/behavior-lightbox-attachments.js b/webroot/rsrc/js/core/behavior-lightbox-attachments.js index 929222f2f9..b9ea0dd8db 100644 --- a/webroot/rsrc/js/core/behavior-lightbox-attachments.js +++ b/webroot/rsrc/js/core/behavior-lightbox-attachments.js @@ -169,7 +169,7 @@ JX.behavior('lightbox-attachments', function (config) { ); var commentIcon = new JX.PHUIXIconView() - .setIcon('fa-comments') + .setIcon('fa-comments phui-icon-circle-icon') .getNode(); var commentButton = JX.$N('a', @@ -181,7 +181,7 @@ JX.behavior('lightbox-attachments', function (config) { commentIcon ); var closeIcon = new JX.PHUIXIconView() - .setIcon('fa-times') + .setIcon('fa-times phui-icon-circle-icon') .getNode(); var closeButton = JX.$N('a', From c4e45c6c8c2e5e1423d0f288214cfb70537df9c3 Mon Sep 17 00:00:00 2001 From: epriestley Date: Tue, 30 May 2017 09:27:48 -0700 Subject: [PATCH 03/31] Detect and prevent invalid configuation of "ui.footer-items" Summary: Fixes T12775. Currently, we do not validate this option and it's possible to configure it in an invalid way. Test Plan: Tried to misconfigure things, was helpfully pointed toward errors. Reviewers: chad Reviewed By: chad Maniphest Tasks: T12775 Differential Revision: https://secure.phabricator.com/D18041 --- src/__phutil_library_map__.php | 2 + .../PhabricatorCustomUIFooterConfigType.php | 41 +++++++++++++++++++ .../option/PhabricatorUIConfigOptions.php | 3 +- 3 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 src/applications/config/custom/PhabricatorCustomUIFooterConfigType.php diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index ce3cc27784..74ebbfe742 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -2522,6 +2522,7 @@ phutil_register_library_map(array( 'PhabricatorCustomFieldStorageQuery' => 'infrastructure/customfield/query/PhabricatorCustomFieldStorageQuery.php', 'PhabricatorCustomFieldStringIndexStorage' => 'infrastructure/customfield/storage/PhabricatorCustomFieldStringIndexStorage.php', 'PhabricatorCustomLogoConfigType' => 'applications/config/custom/PhabricatorCustomLogoConfigType.php', + 'PhabricatorCustomUIFooterConfigType' => 'applications/config/custom/PhabricatorCustomUIFooterConfigType.php', 'PhabricatorDaemon' => 'infrastructure/daemon/PhabricatorDaemon.php', 'PhabricatorDaemonBulkJobController' => 'applications/daemon/controller/PhabricatorDaemonBulkJobController.php', 'PhabricatorDaemonBulkJobListController' => 'applications/daemon/controller/PhabricatorDaemonBulkJobListController.php', @@ -7779,6 +7780,7 @@ phutil_register_library_map(array( 'PhabricatorCustomFieldStorageQuery' => 'Phobject', 'PhabricatorCustomFieldStringIndexStorage' => 'PhabricatorCustomFieldIndexStorage', 'PhabricatorCustomLogoConfigType' => 'PhabricatorConfigOptionType', + 'PhabricatorCustomUIFooterConfigType' => 'PhabricatorConfigJSONOptionType', 'PhabricatorDaemon' => 'PhutilDaemon', 'PhabricatorDaemonBulkJobController' => 'PhabricatorDaemonController', 'PhabricatorDaemonBulkJobListController' => 'PhabricatorDaemonBulkJobController', diff --git a/src/applications/config/custom/PhabricatorCustomUIFooterConfigType.php b/src/applications/config/custom/PhabricatorCustomUIFooterConfigType.php new file mode 100644 index 0000000000..d9961e7454 --- /dev/null +++ b/src/applications/config/custom/PhabricatorCustomUIFooterConfigType.php @@ -0,0 +1,41 @@ + $item) { + if (!is_array($item)) { + throw new Exception( + pht( + 'Footer item with index "%s" is invalid: each item must be a '. + 'dictionary describing a footer item.', + $idx)); + } + + try { + PhutilTypeSpec::checkMap( + $item, + array( + 'name' => 'string', + 'href' => 'optional string', + )); + } catch (Exception $ex) { + throw new Exception( + pht( + 'Footer item with index "%s" is invalid: %s', + $idx, + $ex->getMessage())); + } + } + } + + +} diff --git a/src/applications/config/option/PhabricatorUIConfigOptions.php b/src/applications/config/option/PhabricatorUIConfigOptions.php index 4f93946ce2..cef3fbd342 100644 --- a/src/applications/config/option/PhabricatorUIConfigOptions.php +++ b/src/applications/config/option/PhabricatorUIConfigOptions.php @@ -46,6 +46,7 @@ final class PhabricatorUIConfigOptions EOJSON; $logo_type = 'custom:PhabricatorCustomLogoConfigType'; + $footer_type = 'custom:PhabricatorCustomUIFooterConfigType'; return array( $this->newOption('ui.header-color', 'enum', 'blindigo') @@ -63,7 +64,7 @@ EOJSON; "Phabricator logo in the site header.\n\n". " - **Wordmark**: Choose new text to display next to the logo. ". "By default, the header displays //Phabricator//.\n\n")), - $this->newOption('ui.footer-items', 'list', array()) + $this->newOption('ui.footer-items', $footer_type, array()) ->setSummary( pht( 'Allows you to add footer links on most pages.')) From 7b290b94a726f7c9eb3efd9e065499fde1b0ad00 Mon Sep 17 00:00:00 2001 From: epriestley Date: Tue, 30 May 2017 11:49:51 -0700 Subject: [PATCH 04/31] Correct file PHID extraction on image update in Pholio Summary: Ref T12776. This extraction of file PHIDs extracted "PholioImage" object PHIDs (`PHID-PIMG-...`), not "File" PHIDs (`PHID-FILE-...`). Instead, dig into the Pholio images and actually extract the file PHIDs. This method is now similar to the `PholioImageFileTransaction` method, which works already. Test Plan: - Create a mock. - Update one of the images. - In Files, view the "Attached" tab of the updated image. - Before patch: not attached to mock. - After patch: properly attached to mock. Reviewers: chad, amckinley Reviewed By: chad Maniphest Tasks: T12776 Differential Revision: https://secure.phabricator.com/D18042 --- .../xaction/PholioImageReplaceTransaction.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/applications/pholio/xaction/PholioImageReplaceTransaction.php b/src/applications/pholio/xaction/PholioImageReplaceTransaction.php index e6d45dfc7a..4978fa9768 100644 --- a/src/applications/pholio/xaction/PholioImageReplaceTransaction.php +++ b/src/applications/pholio/xaction/PholioImageReplaceTransaction.php @@ -62,7 +62,19 @@ final class PholioImageReplaceTransaction } public function extractFilePHIDs($object, $value) { - return array($value); + $file_phids = array(); + + $editor = $this->getEditor(); + $images = $editor->getNewImages(); + foreach ($images as $image) { + if ($image->getPHID() !== $value) { + continue; + } + + $file_phids[] = $image->getFilePHID(); + } + + return $file_phids; } } From 88c5c02e723315a4bf4047c2a58294f1c265d94b Mon Sep 17 00:00:00 2001 From: Chad Little Date: Tue, 30 May 2017 14:11:56 -0700 Subject: [PATCH 05/31] Group Maniphest Tasks by Priority on Profiles Summary: Ref T12423. Set the grouping by priority. Note this doesn't render headers but I don't want to spend a lot of time on this. Test Plan: Review tasks in my sandbox, see them ordered by priority. Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Maniphest Tasks: T12423 Differential Revision: https://secure.phabricator.com/D18046 --- .../controller/PhabricatorPeopleProfileTasksController.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/applications/people/controller/PhabricatorPeopleProfileTasksController.php b/src/applications/people/controller/PhabricatorPeopleProfileTasksController.php index 47cc605bb8..b843af8fc7 100644 --- a/src/applications/people/controller/PhabricatorPeopleProfileTasksController.php +++ b/src/applications/people/controller/PhabricatorPeopleProfileTasksController.php @@ -61,6 +61,7 @@ final class PhabricatorPeopleProfileTasksController ->withStatuses($open) ->needProjectPHIDs(true) ->setLimit(100) + ->setGroupBy(ManiphestTaskQuery::GROUP_PRIORITY) ->execute(); $handles = ManiphestTaskListView::loadTaskHandles($viewer, $tasks); From 87c59c08674192c81cdc14166b276ff923ba9570 Mon Sep 17 00:00:00 2001 From: Chad Little Date: Tue, 30 May 2017 14:27:04 -0700 Subject: [PATCH 06/31] Fix design atrocity Summary: So bad. Test Plan: Reload notification search page. Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Differential Revision: https://secure.phabricator.com/D18047 --- .../query/PhabricatorNotificationSearchEngine.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/applications/notification/query/PhabricatorNotificationSearchEngine.php b/src/applications/notification/query/PhabricatorNotificationSearchEngine.php index 11b935eb50..0ee7327bfc 100644 --- a/src/applications/notification/query/PhabricatorNotificationSearchEngine.php +++ b/src/applications/notification/query/PhabricatorNotificationSearchEngine.php @@ -85,12 +85,12 @@ final class PhabricatorNotificationSearchEngine $viewer = $this->requireViewer(); $image = id(new PHUIIconView()) - ->setIcon('fa-eye-slash'); + ->setIcon('fa-bell-o'); $button = id(new PHUIButtonView()) ->setTag('a') ->addSigil('workflow') - ->setColor(PHUIButtonView::SIMPLE) + ->setColor(PHUIButtonView::GREY) ->setIcon($image) ->setText(pht('Mark All Read')); From c5bb69fd7d7902a9b24a7f0c4a8260ba42b436e5 Mon Sep 17 00:00:00 2001 From: Chad Little Date: Sat, 27 May 2017 17:55:44 -0700 Subject: [PATCH 07/31] Use a list view for DiffusionHistory Summary: This moves Diffusion History to use an easier to parse list view for commits and their (diff, audit, build) status. I left TableView around, which is used on a repositories home, and we can maybe add a "graph view" history back as another controller. Not sure what the real use is for that kind of feature though. I don't have Harbormaster set up locally so I could use another install to give this a run. I also expect to maybe not live with this UI as final, I like the UX, but the icons for indicating status don't really feel great to me, just OK. Test Plan: pull various repositories, check various history displays. {F4980356} Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Differential Revision: https://secure.phabricator.com/D18039 --- resources/celerity/map.php | 14 +- src/__phutil_library_map__.php | 6 +- .../controller/DiffusionHistoryController.php | 98 ++------ .../view/DiffusionCommitListView.php | 25 +- .../view/DiffusionHistoryListView.php | 225 ++++++++++++++++++ .../view/DiffusionHistoryTableView.php | 93 +------- .../diffusion/view/DiffusionHistoryView.php | 101 ++++++++ .../diffusion/view/DiffusionView.php | 30 +-- .../diffusion/diffusion-history.css | 15 +- .../phui/object-item/phui-oi-list-view.css | 4 + webroot/rsrc/css/phui/phui-icon.css | 2 +- 11 files changed, 425 insertions(+), 188 deletions(-) create mode 100644 src/applications/diffusion/view/DiffusionHistoryListView.php create mode 100644 src/applications/diffusion/view/DiffusionHistoryView.php diff --git a/resources/celerity/map.php b/resources/celerity/map.php index 241f9acf08..677e781ccd 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -9,7 +9,7 @@ return array( 'names' => array( 'conpherence.pkg.css' => 'ff161f2d', 'conpherence.pkg.js' => 'b5b51108', - 'core.pkg.css' => '19f6f61f', + 'core.pkg.css' => '525ecd1c', 'core.pkg.js' => '1475bd91', 'darkconsole.pkg.js' => '1f9a31bc', 'differential.pkg.css' => '7d4cfa59', @@ -71,7 +71,7 @@ return array( 'rsrc/css/application/differential/revision-history.css' => '0e8eb855', 'rsrc/css/application/differential/revision-list.css' => 'f3c47d33', 'rsrc/css/application/differential/table-of-contents.css' => 'ae4b7a55', - 'rsrc/css/application/diffusion/diffusion-history.css' => '0c596546', + 'rsrc/css/application/diffusion/diffusion-history.css' => '4faf40cd', 'rsrc/css/application/diffusion/diffusion-icons.css' => 'a6a1e2ba', 'rsrc/css/application/diffusion/diffusion-readme.css' => '18bd3910', 'rsrc/css/application/diffusion/diffusion-source.css' => '750add59', @@ -132,7 +132,7 @@ return array( 'rsrc/css/phui/object-item/phui-oi-color.css' => 'cd2b9b77', 'rsrc/css/phui/object-item/phui-oi-drag-ui.css' => '08f4ccc3', 'rsrc/css/phui/object-item/phui-oi-flush-ui.css' => '9d9685d6', - 'rsrc/css/phui/object-item/phui-oi-list-view.css' => 'ed19241b', + 'rsrc/css/phui/object-item/phui-oi-list-view.css' => '43752968', 'rsrc/css/phui/object-item/phui-oi-simple-ui.css' => 'a8beebea', 'rsrc/css/phui/phui-action-list.css' => 'c01858f4', 'rsrc/css/phui/phui-action-panel.css' => '91c7b835', @@ -158,7 +158,7 @@ return array( 'rsrc/css/phui/phui-header-view.css' => 'a3d1aecd', 'rsrc/css/phui/phui-hovercard.css' => 'f0592bcf', 'rsrc/css/phui/phui-icon-set-selector.css' => '87db8fee', - 'rsrc/css/phui/phui-icon.css' => '4c6d624c', + 'rsrc/css/phui/phui-icon.css' => '4c46b6ba', 'rsrc/css/phui/phui-image-mask.css' => 'a8498f9c', 'rsrc/css/phui/phui-info-panel.css' => '27ea50a1', 'rsrc/css/phui/phui-info-view.css' => '6e217679', @@ -575,7 +575,7 @@ return array( 'differential-revision-history-css' => '0e8eb855', 'differential-revision-list-css' => 'f3c47d33', 'differential-table-of-contents-css' => 'ae4b7a55', - 'diffusion-history-css' => '0c596546', + 'diffusion-history-css' => '4faf40cd', 'diffusion-icons-css' => 'a6a1e2ba', 'diffusion-readme-css' => '18bd3910', 'diffusion-source-css' => '750add59', @@ -862,7 +862,7 @@ return array( 'phui-hovercard' => '1bd28176', 'phui-hovercard-view-css' => 'f0592bcf', 'phui-icon-set-selector-css' => '87db8fee', - 'phui-icon-view-css' => '4c6d624c', + 'phui-icon-view-css' => '4c46b6ba', 'phui-image-mask-css' => 'a8498f9c', 'phui-info-panel-css' => '27ea50a1', 'phui-info-view-css' => '6e217679', @@ -875,7 +875,7 @@ return array( 'phui-oi-color-css' => 'cd2b9b77', 'phui-oi-drag-ui-css' => '08f4ccc3', 'phui-oi-flush-ui-css' => '9d9685d6', - 'phui-oi-list-view-css' => 'ed19241b', + 'phui-oi-list-view-css' => '43752968', 'phui-oi-simple-ui-css' => 'a8beebea', 'phui-pager-css' => '77d8a794', 'phui-pinboard-view-css' => '2495140e', diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 74ebbfe742..aa11ace40c 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -728,8 +728,10 @@ phutil_register_library_map(array( 'DiffusionGitSSHWorkflow' => 'applications/diffusion/ssh/DiffusionGitSSHWorkflow.php', 'DiffusionGitUploadPackSSHWorkflow' => 'applications/diffusion/ssh/DiffusionGitUploadPackSSHWorkflow.php', 'DiffusionHistoryController' => 'applications/diffusion/controller/DiffusionHistoryController.php', + 'DiffusionHistoryListView' => 'applications/diffusion/view/DiffusionHistoryListView.php', 'DiffusionHistoryQueryConduitAPIMethod' => 'applications/diffusion/conduit/DiffusionHistoryQueryConduitAPIMethod.php', 'DiffusionHistoryTableView' => 'applications/diffusion/view/DiffusionHistoryTableView.php', + 'DiffusionHistoryView' => 'applications/diffusion/view/DiffusionHistoryView.php', 'DiffusionHovercardEngineExtension' => 'applications/diffusion/engineextension/DiffusionHovercardEngineExtension.php', 'DiffusionInlineCommentController' => 'applications/diffusion/controller/DiffusionInlineCommentController.php', 'DiffusionInlineCommentPreviewController' => 'applications/diffusion/controller/DiffusionInlineCommentPreviewController.php', @@ -5705,8 +5707,10 @@ phutil_register_library_map(array( ), 'DiffusionGitUploadPackSSHWorkflow' => 'DiffusionGitSSHWorkflow', 'DiffusionHistoryController' => 'DiffusionController', + 'DiffusionHistoryListView' => 'DiffusionHistoryView', 'DiffusionHistoryQueryConduitAPIMethod' => 'DiffusionQueryConduitAPIMethod', - 'DiffusionHistoryTableView' => 'DiffusionView', + 'DiffusionHistoryTableView' => 'DiffusionHistoryView', + 'DiffusionHistoryView' => 'DiffusionView', 'DiffusionHovercardEngineExtension' => 'PhabricatorHovercardEngineExtension', 'DiffusionInlineCommentController' => 'PhabricatorInlineCommentController', 'DiffusionInlineCommentPreviewController' => 'PhabricatorInlineCommentPreviewController', diff --git a/src/applications/diffusion/controller/DiffusionHistoryController.php b/src/applications/diffusion/controller/DiffusionHistoryController.php index 1a29a4263a..8ee6c848a7 100644 --- a/src/applications/diffusion/controller/DiffusionHistoryController.php +++ b/src/applications/diffusion/controller/DiffusionHistoryController.php @@ -26,11 +26,6 @@ final class DiffusionHistoryController extends DiffusionController { 'limit' => $pager->getPageSize() + 1, ); - if (!$request->getBool('copies')) { - $params['needDirectChanges'] = true; - $params['needChildChanges'] = true; - } - $history_results = $this->callConduitWithDiffusionRequest( 'diffusion.historyquery', $params); @@ -39,27 +34,12 @@ final class DiffusionHistoryController extends DiffusionController { $history = $pager->sliceResults($history); - $show_graph = !strlen($drequest->getPath()); - $history_table = id(new DiffusionHistoryTableView()) - ->setUser($request->getUser()) + $history_list = id(new DiffusionHistoryListView()) + ->setViewer($viewer) ->setDiffusionRequest($drequest) ->setHistory($history); - $history_table->loadRevisions(); - - if ($show_graph) { - $history_table->setParents($history_results['parents']); - $history_table->setIsHead(!$pager->getOffset()); - $history_table->setIsTail(!$pager->getHasMorePages()); - } - - $history_header = $this->buildHistoryHeader($drequest); - $history_panel = id(new PHUIObjectBoxView()) - ->setHeader($history_header) - ->setBackground(PHUIObjectBoxView::BLUE_PROPERTY) - ->setTable($history_table) - ->setPager($pager); - + $history_list->loadRevisions(); $header = $this->buildHeader($drequest); $crumbs = $this->buildCrumbs( @@ -70,44 +50,32 @@ final class DiffusionHistoryController extends DiffusionController { )); $crumbs->setBorder(true); + $title = array( + pht('History'), + $repository->getDisplayName(), + ); + + $pager = id(new PHUIBoxView()) + ->addClass('mlb') + ->appendChild($pager); + $view = id(new PHUITwoColumnView()) ->setHeader($header) ->setFooter(array( - $history_panel, + $history_list, + $pager, )); return $this->newPage() - ->setTitle( - array( - pht('History'), - $repository->getDisplayName(), - )) + ->setTitle($title) ->setCrumbs($crumbs) - ->appendChild( - array( - $view, - )); + ->appendChild($view); } private function buildHeader(DiffusionRequest $drequest) { $viewer = $this->getViewer(); $tag = $this->renderCommitHashTag($drequest); - - $header = id(new PHUIHeaderView()) - ->setUser($viewer) - ->setPolicyObject($drequest->getRepository()) - ->addTag($tag) - ->setHeader($this->renderPathLinks($drequest, $mode = 'history')) - ->setHeaderIcon('fa-clock-o'); - - return $header; - - } - - private function buildHistoryHeader(DiffusionRequest $drequest) { - $viewer = $this->getViewer(); - $browse_uri = $drequest->generateURI( array( 'action' => 'browse', @@ -117,36 +85,18 @@ final class DiffusionHistoryController extends DiffusionController { ->setTag('a') ->setText(pht('Browse')) ->setHref($browse_uri) - ->setIcon('fa-files-o'); - - // TODO: Sometimes we do have a change view, we need to look at the most - // recent history entry to figure it out. - - $request = $this->getRequest(); - if ($request->getBool('copies')) { - $branch_name = pht('Hide Copies/Branches'); - $branch_uri = $request->getRequestURI() - ->alter('offset', null) - ->alter('copies', null); - } else { - $branch_name = pht('Show Copies/Branches'); - $branch_uri = $request->getRequestURI() - ->alter('offset', null) - ->alter('copies', true); - } - - $branch_button = id(new PHUIButtonView()) - ->setTag('a') - ->setText($branch_name) - ->setIcon('fa-code-fork') - ->setHref($branch_uri); + ->setIcon('fa-code'); $header = id(new PHUIHeaderView()) - ->setHeader(pht('History')) - ->addActionLink($browse_button) - ->addActionLink($branch_button); + ->setUser($viewer) + ->setPolicyObject($drequest->getRepository()) + ->addTag($tag) + ->setHeader($this->renderPathLinks($drequest, $mode = 'history')) + ->setHeaderIcon('fa-clock-o') + ->addActionLink($browse_button); return $header; + } } diff --git a/src/applications/diffusion/view/DiffusionCommitListView.php b/src/applications/diffusion/view/DiffusionCommitListView.php index b3f2a9fb0c..f1d1ebc8e4 100644 --- a/src/applications/diffusion/view/DiffusionCommitListView.php +++ b/src/applications/diffusion/view/DiffusionCommitListView.php @@ -25,6 +25,28 @@ final class DiffusionCommitListView extends AphrontView { return $this->commits; } + public function setHandles(array $handles) { + assert_instances_of($handles, 'PhabricatorObjectHandle'); + $this->handles = $handles; + return $this; + } + + private function getRequiredHandlePHIDs() { + $phids = array(); + foreach ($this->history as $item) { + $data = $item->getCommitData(); + if ($data) { + if ($data->getCommitDetail('authorPHID')) { + $phids[$data->getCommitDetail('authorPHID')] = true; + } + if ($data->getCommitDetail('committerPHID')) { + $phids[$data->getCommitDetail('committerPHID')] = true; + } + } + } + return array_keys($phids); + } + private function getCommitDescription($phid) { if ($this->commits === null) { return pht('(Unknown Commit)'); @@ -114,12 +136,10 @@ final class DiffusionCommitListView extends AphrontView { if ($author_phid) { $author_name = $handles[$author_phid]->renderLink(); $author_image_uri = $handles[$author_phid]->getImageURI(); - $author_image_href = $handles[$author_phid]->getURI(); } else { $author_name = $commit->getCommitData()->getAuthorName(); $author_image_uri = celerity_get_resource_uri('/rsrc/image/people/user0.png'); - $author_image_href = null; } $commit_tag = id(new PHUITagView()) @@ -134,7 +154,6 @@ final class DiffusionCommitListView extends AphrontView { ->setDisabled($commit->isUnreachable()) ->setDescription($message) ->setImageURI($author_image_uri) - ->setImageHref($author_image_href) ->addByline(pht('Author: %s', $author_name)) ->addIcon('none', $committed) ->addAttribute($commit_tag); diff --git a/src/applications/diffusion/view/DiffusionHistoryListView.php b/src/applications/diffusion/view/DiffusionHistoryListView.php new file mode 100644 index 0000000000..f72bffcbe6 --- /dev/null +++ b/src/applications/diffusion/view/DiffusionHistoryListView.php @@ -0,0 +1,225 @@ +getDiffusionRequest(); + $viewer = $this->getUser(); + $repository = $drequest->getRepository(); + + require_celerity_resource('diffusion-history-css'); + Javelin::initBehavior('phabricator-tooltips'); + + $buildables = $this->loadBuildables( + mpull($this->getHistory(), 'getCommit')); + + $show_revisions = PhabricatorApplication::isClassInstalledForViewer( + 'PhabricatorDifferentialApplication', + $viewer); + + $handles = $viewer->loadHandles($this->getRequiredHandlePHIDs()); + + $show_builds = PhabricatorApplication::isClassInstalledForViewer( + 'PhabricatorHarbormasterApplication', + $this->getUser()); + + $rows = array(); + $ii = 0; + $cur_date = 0; + $list = null; + $header = null; + $view = array(); + foreach ($this->getHistory() as $history) { + $epoch = $history->getEpoch(); + $new_date = date('Ymd', $history->getEpoch()); + if ($cur_date != $new_date) { + if ($list) { + $view[] = id(new PHUIObjectBoxView()) + ->setHeader($header) + ->setBackground(PHUIObjectBoxView::BLUE_PROPERTY) + ->setObjectList($list); + } + $date = ucfirst( + phabricator_relative_date($history->getEpoch(), $viewer)); + $header = id(new PHUIHeaderView()) + ->setHeader($date); + $list = id(new PHUIObjectItemListView()) + ->setFlush(true) + ->addClass('diffusion-history-list'); + } + + if ($epoch) { + $committed = $viewer->formatShortDateTime($epoch); + } else { + $committed = null; + } + + $data = $history->getCommitData(); + $author_phid = $committer = $committer_phid = null; + if ($data) { + $author_phid = $data->getCommitDetail('authorPHID'); + $committer_phid = $data->getCommitDetail('committerPHID'); + $committer = $data->getCommitDetail('committer'); + } + + if ($author_phid && isset($handles[$author_phid])) { + $author_name = $handles[$author_phid]->renderLink(); + $author_image = $handles[$author_phid]->getImageURI(); + } else { + $author_name = self::renderName($history->getAuthorName()); + $author_image = + celerity_get_resource_uri('/rsrc/image/people/user0.png'); + } + + $different_committer = false; + if ($committer_phid) { + $different_committer = ($committer_phid != $author_phid); + } else if ($committer != '') { + $different_committer = ($committer != $history->getAuthorName()); + } + if ($different_committer) { + if ($committer_phid && isset($handles[$committer_phid])) { + $committer = $handles[$committer_phid]->renderLink(); + } else { + $committer = self::renderName($committer); + } + $author_name = hsprintf('%s / %s', $author_name, $committer); + } + + // We can show details once the message and change have been imported. + $partial_import = PhabricatorRepositoryCommit::IMPORTED_MESSAGE | + PhabricatorRepositoryCommit::IMPORTED_CHANGE; + + $commit = $history->getCommit(); + if ($commit && $commit->isPartiallyImported($partial_import) && $data) { + $commit_desc = $history->getSummary(); + } else { + $commit_desc = phutil_tag('em', array(), pht("Importing\xE2\x80\xA6")); + } + + $build_view = null; + if ($show_builds) { + $buildable = idx($buildables, $commit->getPHID()); + if ($buildable !== null) { + $build_view = $this->renderBuildable($buildable); + } + } + + $browse = $this->linkBrowse( + $history->getPath(), + array( + 'commit' => $history->getCommitIdentifier(), + 'branch' => $drequest->getBranch(), + 'type' => $history->getFileType(), + )); + + $differential_view = null; + if ($show_revisions && $commit) { + $d_id = idx($this->getRevisions(), $commit->getPHID()); + if ($d_id) { + $differential_view = id(new PHUIIconCircleView()) + ->setIcon('fa-gear') + ->setColor('green') + ->setState(PHUIIconCircleView::STATE_SUCCESS) + ->addSigil('has-tooltip') + ->setSize(PHUIIconCircleView::SMALL) + ->setHref('/D'.$d_id) + ->addClass('mmr') + ->setMetadata( + array( + 'tip' => 'Revision D'.$d_id, + )); + } + } + + $status = $commit->getAuditStatus(); + $icon = PhabricatorAuditCommitStatusConstants::getStatusIcon($status); + $color = PhabricatorAuditCommitStatusConstants::getStatusColor($status); + $name = PhabricatorAuditCommitStatusConstants::getStatusName($status); + $audit_view = id(new PHUIIconCircleView()) + ->setIcon('fa-code') + ->setColor($color) + ->setState($icon) + ->addSigil('has-tooltip') + ->setSize(PHUIIconCircleView::SMALL) + ->addClass('mmr') + ->setMetadata( + array( + 'tip' => $name, + )); + + if ($show_builds) { + $buildable = idx($buildables, $commit->getPHID()); + if ($buildable !== null) { + $status = $buildable->getBuildableStatus(); + $icon = HarbormasterBuildable::getBuildableStatusIcon($status); + $color = HarbormasterBuildable::getBuildableStatusColor($status); + $name = HarbormasterBuildable::getBuildableStatusName($status); + $build_view = id(new PHUIIconCircleView()) + ->setIcon('fa-recycle') + ->setColor($color) + ->setState($icon) + ->addSigil('has-tooltip') + ->setSize(PHUIIconCircleView::SMALL) + ->setHref('/'.$buildable->getMonogram()) + ->addClass('mmr') + ->setMetadata( + array( + 'tip' => $name, + )); + } + } + + $message = null; + $commit_link = $repository->getCommitURI( + $history->getCommitIdentifier()); + + $commit_name = $repository->formatCommitName( + $history->getCommitIdentifier(), $local = true); + + $committed = phabricator_datetime($commit->getEpoch(), $viewer); + $author_name = phutil_tag( + 'strong', + array( + 'class' => 'diffusion-history-author-name', + ), + $author_name); + $authored = pht('%s on %s.', $author_name, $committed); + + $commit_tag = id(new PHUITagView()) + ->setName($commit_name) + ->setType(PHUITagView::TYPE_SHADE) + ->setColor(PHUITagView::COLOR_INDIGO) + ->setSlimShady(true); + + $browse_button = id(new PHUIButtonView()) + ->setText(pht('Browse')) + ->setIcon('fa-code') + ->setTag('a') + ->setColor(PHUIButtonView::SIMPLE) + ->appendChild($audit_view); + + $item = id(new PHUIObjectItemView()) + ->setHeader($commit_desc) + ->setHref($commit_link) + ->setDisabled($commit->isUnreachable()) + ->setDescription($message) + ->setImageURI($author_image) + ->addAttribute($commit_tag) + ->addAttribute($authored) + ->setSideColumn(array( + $differential_view, + $audit_view, + $build_view, + $browse_button, + )); + + $list->addItem($item); + $cur_date = $new_date; + } + + + return $view; + } + +} diff --git a/src/applications/diffusion/view/DiffusionHistoryTableView.php b/src/applications/diffusion/view/DiffusionHistoryTableView.php index bb3aee37da..3885bbf47c 100644 --- a/src/applications/diffusion/view/DiffusionHistoryTableView.php +++ b/src/applications/diffusion/view/DiffusionHistoryTableView.php @@ -1,87 +1,14 @@ history = $history; - return $this; - } - - public function loadRevisions() { - $commit_phids = array(); - foreach ($this->history as $item) { - if ($item->getCommit()) { - $commit_phids[] = $item->getCommit()->getPHID(); - } - } - - // TODO: Get rid of this. - $this->revisions = id(new DifferentialRevision()) - ->loadIDsByCommitPHIDs($commit_phids); - return $this; - } - - public function setHandles(array $handles) { - assert_instances_of($handles, 'PhabricatorObjectHandle'); - $this->handles = $handles; - return $this; - } - - private function getRequiredHandlePHIDs() { - $phids = array(); - foreach ($this->history as $item) { - $data = $item->getCommitData(); - if ($data) { - if ($data->getCommitDetail('authorPHID')) { - $phids[$data->getCommitDetail('authorPHID')] = true; - } - if ($data->getCommitDetail('committerPHID')) { - $phids[$data->getCommitDetail('committerPHID')] = true; - } - } - } - return array_keys($phids); - } - - public function setParents(array $parents) { - $this->parents = $parents; - return $this; - } - - public function setIsHead($is_head) { - $this->isHead = $is_head; - return $this; - } - - public function setIsTail($is_tail) { - $this->isTail = $is_tail; - return $this; - } - - public function setFilterParents($filter_parents) { - $this->filterParents = $filter_parents; - return $this; - } - - public function getFilterParents() { - return $this->filterParents; - } +final class DiffusionHistoryTableView extends DiffusionHistoryView { public function render() { $drequest = $this->getDiffusionRequest(); $viewer = $this->getUser(); - $buildables = $this->loadBuildables(mpull($this->history, 'getCommit')); + $buildables = $this->loadBuildables( + mpull($this->getHistory(), 'getCommit')); $has_any_build = false; $show_revisions = PhabricatorApplication::isClassInstalledForViewer( @@ -91,14 +18,14 @@ final class DiffusionHistoryTableView extends DiffusionView { $handles = $viewer->loadHandles($this->getRequiredHandlePHIDs()); $graph = null; - if ($this->parents) { - $parents = $this->parents; + if ($this->getParents()) { + $parents = $this->getParents(); // If we're filtering parents, remove relationships which point to // commits that are not part of the visible graph. Otherwise, we get // a big tree of nonsense when viewing release branches like "stable" // versus "master". - if ($this->filterParents) { + if ($this->getFilterParents()) { foreach ($parents as $key => $nodes) { foreach ($nodes as $nkey => $node) { if (empty($parents[$node])) { @@ -109,8 +36,8 @@ final class DiffusionHistoryTableView extends DiffusionView { } $graph = id(new PHUIDiffGraphView()) - ->setIsHead($this->isHead) - ->setIsTail($this->isTail) + ->setIsHead($this->getIsHead()) + ->setIsTail($this->getIsTail()) ->renderGraph($parents); } @@ -120,7 +47,7 @@ final class DiffusionHistoryTableView extends DiffusionView { $rows = array(); $ii = 0; - foreach ($this->history as $history) { + foreach ($this->getHistory() as $history) { $epoch = $history->getEpoch(); if ($epoch) { @@ -209,7 +136,7 @@ final class DiffusionHistoryTableView extends DiffusionView { $build, $audit_view, ($commit ? - self::linkRevision(idx($this->revisions, $commit->getPHID())) : + self::linkRevision(idx($this->getRevisions(), $commit->getPHID())) : null), $author, $summary, diff --git a/src/applications/diffusion/view/DiffusionHistoryView.php b/src/applications/diffusion/view/DiffusionHistoryView.php new file mode 100644 index 0000000000..56a0f3b75f --- /dev/null +++ b/src/applications/diffusion/view/DiffusionHistoryView.php @@ -0,0 +1,101 @@ +history = $history; + return $this; + } + + public function getHistory() { + return $this->history; + } + + public function loadRevisions() { + $commit_phids = array(); + foreach ($this->history as $item) { + if ($item->getCommit()) { + $commit_phids[] = $item->getCommit()->getPHID(); + } + } + + // TODO: Get rid of this. + $this->revisions = id(new DifferentialRevision()) + ->loadIDsByCommitPHIDs($commit_phids); + return $this; + } + + public function getRevisions() { + return $this->revisions; + } + + public function setHandles(array $handles) { + assert_instances_of($handles, 'PhabricatorObjectHandle'); + $this->handles = $handles; + return $this; + } + + public function getRequiredHandlePHIDs() { + $phids = array(); + foreach ($this->history as $item) { + $data = $item->getCommitData(); + if ($data) { + if ($data->getCommitDetail('authorPHID')) { + $phids[$data->getCommitDetail('authorPHID')] = true; + } + if ($data->getCommitDetail('committerPHID')) { + $phids[$data->getCommitDetail('committerPHID')] = true; + } + } + } + return array_keys($phids); + } + + public function setParents(array $parents) { + $this->parents = $parents; + return $this; + } + + public function getParents() { + return $this->parents; + } + + public function setIsHead($is_head) { + $this->isHead = $is_head; + return $this; + } + + public function getIsHead() { + return $this->isHead; + } + + public function setIsTail($is_tail) { + $this->isTail = $is_tail; + return $this; + } + + public function getIsTail() { + return $this->isTail; + } + + public function setFilterParents($filter_parents) { + $this->filterParents = $filter_parents; + return $this; + } + + public function getFilterParents() { + return $this->filterParents; + } + + public function render() {} + +} diff --git a/src/applications/diffusion/view/DiffusionView.php b/src/applications/diffusion/view/DiffusionView.php index 5aa1fad33c..b615ce855c 100644 --- a/src/applications/diffusion/view/DiffusionView.php +++ b/src/applications/diffusion/view/DiffusionView.php @@ -168,7 +168,7 @@ abstract class DiffusionView extends AphrontView { 'sigil' => 'has-tooltip', 'meta' => array( 'tip' => $email->getAddress(), - 'align' => 'E', + 'align' => 'S', 'size' => 'auto', ), ), @@ -177,30 +177,24 @@ abstract class DiffusionView extends AphrontView { return hsprintf('%s', $name); } - final protected function renderBuildable(HarbormasterBuildable $buildable) { + final protected function renderBuildable( + HarbormasterBuildable $buildable) { $status = $buildable->getBuildableStatus(); + Javelin::initBehavior('phabricator-tooltips'); $icon = HarbormasterBuildable::getBuildableStatusIcon($status); $color = HarbormasterBuildable::getBuildableStatusColor($status); $name = HarbormasterBuildable::getBuildableStatusName($status); - $icon_view = id(new PHUIIconView()) - ->setIcon($icon.' '.$color); + return id(new PHUIIconView()) + ->setIcon($icon.' '.$color) + ->addSigil('has-tooltip') + ->setHref('/'.$buildable->getMonogram()) + ->setMetadata( + array( + 'tip' => $name, + )); - $tooltip_view = javelin_tag( - 'span', - array( - 'sigil' => 'has-tooltip', - 'meta' => array('tip' => $name), - ), - $icon_view); - - Javelin::initBehavior('phabricator-tooltips'); - - return phutil_tag( - 'a', - array('href' => '/'.$buildable->getMonogram()), - $tooltip_view); } final protected function loadBuildables(array $commits) { diff --git a/webroot/rsrc/css/application/diffusion/diffusion-history.css b/webroot/rsrc/css/application/diffusion/diffusion-history.css index b340cd913d..43e05c8958 100644 --- a/webroot/rsrc/css/application/diffusion/diffusion-history.css +++ b/webroot/rsrc/css/application/diffusion/diffusion-history.css @@ -3,7 +3,7 @@ */ .diffusion-history-list .phui-oi-link { - color: {$darkbluetext}; + color: #000; font-size: {$biggerfontsize}; } @@ -11,6 +11,10 @@ border-color: transparent; } +.diffusion-history-list .phui-oi-attribute .phui-tag-indigo a { + color: {$indigo}; +} + .diffusion-history-message { background-color: {$bluebackground}; padding: 16px; @@ -18,3 +22,12 @@ border-radius: 5px; color: {$darkbluetext}; } + +.diffusion-history-list .phui-oi-attribute { + font-size: {$smallerfontsize}; + letter-spacing: 0.01em; +} + +.diffusion-history-author-name a { + color: {$darkbluetext}; +} diff --git a/webroot/rsrc/css/phui/object-item/phui-oi-list-view.css b/webroot/rsrc/css/phui/object-item/phui-oi-list-view.css index 788b0e73ec..f6d1589a9a 100644 --- a/webroot/rsrc/css/phui/object-item/phui-oi-list-view.css +++ b/webroot/rsrc/css/phui/object-item/phui-oi-list-view.css @@ -182,6 +182,10 @@ ul.phui-oi-list-view { vertical-align: top; } +.phui-oi-col2.phui-oi-side-column { + width: 200px; +} + .device-phone .phui-oi-col1, .device-phone .phui-oi-col2 { display: block; diff --git a/webroot/rsrc/css/phui/phui-icon.css b/webroot/rsrc/css/phui/phui-icon.css index 627b7632fe..5fd7fd97bc 100644 --- a/webroot/rsrc/css/phui/phui-icon.css +++ b/webroot/rsrc/css/phui/phui-icon.css @@ -144,7 +144,7 @@ a.phui-icon-circle.hover-red:hover .phui-icon-view { color: {$red}; } -a.phui-icon-circle .phui-icon-view.phui-icon-circle-state-icon { +.phui-icon-circle .phui-icon-view.phui-icon-circle-state-icon { position: absolute; width: 14px; height: 14px; From d161a07781e01f194e25216137568c32304df0da Mon Sep 17 00:00:00 2001 From: epriestley Date: Tue, 30 May 2017 17:41:30 -0700 Subject: [PATCH 08/31] Improve Differential behavior when scrolling with anchors Summary: Fixes T12779. Currently, we scroll down if the midline of the changeset is above the midline of the viewport. This rule can cause us to scroll improperly when loading changesets //after// jumping to their anchors, since the changeset we want to look at will likely have a midpoint above the document midline. That is, we follow an anchor to `X.c`, then it loads, then we scroll past it. Instead, scroll only if the changeset is (almost) entirely above the viewport. Test Plan: Followed an anchor to `PHUIFeedStoryExample`: {F4984154} Reviewers: chad Reviewed By: chad Maniphest Tasks: T12779 Differential Revision: https://secure.phabricator.com/D18052 --- .../rsrc/js/application/diff/DiffChangeset.js | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/webroot/rsrc/js/application/diff/DiffChangeset.js b/webroot/rsrc/js/application/diff/DiffChangeset.js index cd7f888a40..2b275b0e65 100644 --- a/webroot/rsrc/js/application/diff/DiffChangeset.js +++ b/webroot/rsrc/js/application/diff/DiffChangeset.js @@ -501,12 +501,17 @@ JX.install('DiffChangeset', { // diff with a large number of changes don't constantly have the text // area scrolled off the bottom of the screen until the entire diff loads. // - // There are two three major cases here: + // There are several major cases here: // // - If we're near the top of the document, never scroll. - // - If we're near the bottom of the document, always scroll. - // - Otherwise, scroll if the changes were above the midline of the - // viewport. + // - If we're near the bottom of the document, always scroll, unless + // we have an anchor. + // - Otherwise, scroll if the changes were above (or, at least, + // almost entirely above) the viewport. + // + // We don't scroll if the changes were just near the top of the viewport + // because this makes us scroll incorrectly when an anchored change is + // visible. See T12779. var target = this._node; @@ -529,17 +534,18 @@ JX.install('DiffChangeset', { var target_pos = JX.Vector.getPos(target); var target_dim = JX.Vector.getDim(target); - var target_mid = (target_pos.y + (target_dim.y / 2)); + var target_bot = (target_pos.y + target_dim.y); - var view_mid = (old_pos.y + (old_view.y / 2)); - var above_mid = (target_mid < view_mid); + // Detect if the changeset is entirely (or, at least, almost entirely) + // above us. + var above_screen = (target_bot < old_pos.y + 128); var frame = this._getContentFrame(); JX.DOM.setContent(frame, JX.$H(response.changeset)); if (this._stabilize) { if (!near_top) { - if (near_bot || above_mid) { + if (near_bot || above_screen) { // Figure out how much taller the document got. var delta = (JX.Vector.getDocument().y - old_dim.y); JX.DOM.scrollToPosition(old_pos.x, old_pos.y + delta); From d20221dc7d823819ca10f1a72deadfca543ed228 Mon Sep 17 00:00:00 2001 From: epriestley Date: Tue, 30 May 2017 13:23:54 -0700 Subject: [PATCH 09/31] Remove Differential "objectives" UI Summary: Ref T12733. Completely removes the objectives UI. Test Plan: - Grepped for `objective`, etc. - Browsed revisions, no JS errors / broken stuff. - (If I missed anything, it's likely to turn up in followup changes.) Reviewers: chad Reviewed By: chad Maniphest Tasks: T12733 Differential Revision: https://secure.phabricator.com/D18043 --- resources/celerity/map.php | 109 +++++-------- resources/celerity/packages.php | 3 - .../view/DifferentialChangesetDetailView.php | 1 - .../view/DifferentialChangesetListView.php | 4 - .../differential/changeset-view.css | 34 ---- webroot/rsrc/css/core/z-index.css | 4 - .../rsrc/js/application/diff/DiffChangeset.js | 27 ---- .../js/application/diff/DiffChangesetList.js | 34 ---- .../rsrc/js/application/diff/DiffInline.js | 90 ----------- .../js/application/diff/ScrollObjective.js | 141 ---------------- .../application/diff/ScrollObjectiveList.js | 150 ------------------ .../differential/behavior-populate.js | 3 +- 12 files changed, 44 insertions(+), 556 deletions(-) delete mode 100644 webroot/rsrc/js/application/diff/ScrollObjective.js delete mode 100644 webroot/rsrc/js/application/diff/ScrollObjectiveList.js diff --git a/resources/celerity/map.php b/resources/celerity/map.php index 677e781ccd..87bc02214d 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -9,11 +9,11 @@ return array( 'names' => array( 'conpherence.pkg.css' => 'ff161f2d', 'conpherence.pkg.js' => 'b5b51108', - 'core.pkg.css' => '525ecd1c', + 'core.pkg.css' => 'bb7f0446', 'core.pkg.js' => '1475bd91', 'darkconsole.pkg.js' => '1f9a31bc', - 'differential.pkg.css' => '7d4cfa59', - 'differential.pkg.js' => '1d120743', + 'differential.pkg.css' => '9ebe4f44', + 'differential.pkg.js' => '78b8497f', 'diffusion.pkg.css' => 'b93d9b8c', 'diffusion.pkg.js' => '84c8f8fd', 'favicon.ico' => '30672e08', @@ -64,7 +64,7 @@ return array( 'rsrc/css/application/dashboard/dashboard.css' => 'fe5b1869', 'rsrc/css/application/diff/inline-comment-summary.css' => '51efda3a', 'rsrc/css/application/differential/add-comment.css' => 'c47f8c40', - 'rsrc/css/application/differential/changeset-view.css' => 'acfd58f6', + 'rsrc/css/application/differential/changeset-view.css' => '2971e2a2', 'rsrc/css/application/differential/core.css' => '5b7b8ff4', 'rsrc/css/application/differential/phui-inline-comment.css' => 'ffd1a542', 'rsrc/css/application/differential/revision-comment.css' => '14b8565a', @@ -117,7 +117,7 @@ return array( 'rsrc/css/core/core.css' => '9f4cb463', 'rsrc/css/core/remarkup.css' => 'd1a5e11e', 'rsrc/css/core/syntax.css' => 'cae95e89', - 'rsrc/css/core/z-index.css' => '998f3ce1', + 'rsrc/css/core/z-index.css' => '9d8f7c4b', 'rsrc/css/diviner/diviner-shared.css' => '896f1d43', 'rsrc/css/font/font-awesome.css' => 'e838e088', 'rsrc/css/font/font-lato.css' => 'c7ccd872', @@ -391,15 +391,13 @@ return array( 'rsrc/js/application/dashboard/behavior-dashboard-move-panels.js' => '408bf173', 'rsrc/js/application/dashboard/behavior-dashboard-query-panel-select.js' => '453c5375', 'rsrc/js/application/dashboard/behavior-dashboard-tab-panel.js' => 'd4eecc63', - 'rsrc/js/application/diff/DiffChangeset.js' => 'cf4e2140', - 'rsrc/js/application/diff/DiffChangesetList.js' => '7a184082', - 'rsrc/js/application/diff/DiffInline.js' => '19582231', - 'rsrc/js/application/diff/ScrollObjective.js' => '7e8877e7', - 'rsrc/js/application/diff/ScrollObjectiveList.js' => '6120e99a', + 'rsrc/js/application/diff/DiffChangeset.js' => '3359ad02', + 'rsrc/js/application/diff/DiffChangesetList.js' => '675f1ca3', + 'rsrc/js/application/diff/DiffInline.js' => '45d37835', 'rsrc/js/application/diff/behavior-preview-link.js' => '051c7832', 'rsrc/js/application/differential/behavior-comment-preview.js' => '51c5ad07', 'rsrc/js/application/differential/behavior-diff-radios.js' => 'e1ff79b1', - 'rsrc/js/application/differential/behavior-populate.js' => '1de8bf63', + 'rsrc/js/application/differential/behavior-populate.js' => '5e41c819', 'rsrc/js/application/differential/behavior-user-select.js' => 'a8d8459d', 'rsrc/js/application/diffusion/DiffusionLocateFileSource.js' => 'c93358e3', 'rsrc/js/application/diffusion/behavior-audit-preview.js' => 'd835b03a', @@ -568,7 +566,7 @@ return array( 'conpherence-thread-manager' => '4d863052', 'conpherence-transaction-css' => '85129c68', 'd3' => 'a11a5ff2', - 'differential-changeset-view-css' => 'acfd58f6', + 'differential-changeset-view-css' => '2971e2a2', 'differential-core-view-css' => '5b7b8ff4', 'differential-revision-add-comment-css' => 'c47f8c40', 'differential-revision-comment-css' => '14b8565a', @@ -622,7 +620,7 @@ return array( 'javelin-behavior-diff-preview-link' => '051c7832', 'javelin-behavior-differential-diff-radios' => 'e1ff79b1', 'javelin-behavior-differential-feedback-preview' => '51c5ad07', - 'javelin-behavior-differential-populate' => '1de8bf63', + 'javelin-behavior-differential-populate' => '5e41c819', 'javelin-behavior-differential-user-select' => 'a8d8459d', 'javelin-behavior-diffusion-browse-file' => '054a0f0b', 'javelin-behavior-diffusion-commit-branches' => 'bdaf4d04', @@ -779,9 +777,9 @@ return array( 'phabricator-darklog' => 'c8e1ffe3', 'phabricator-darkmessage' => 'c48cccdd', 'phabricator-dashboard-css' => 'fe5b1869', - 'phabricator-diff-changeset' => 'cf4e2140', - 'phabricator-diff-changeset-list' => '7a184082', - 'phabricator-diff-inline' => '19582231', + 'phabricator-diff-changeset' => '3359ad02', + 'phabricator-diff-changeset-list' => '675f1ca3', + 'phabricator-diff-inline' => '45d37835', 'phabricator-drag-and-drop-file-upload' => '58dea2fa', 'phabricator-draggable-list' => 'bea6e7f4', 'phabricator-fatal-config-template-css' => '8f18fa41', @@ -801,8 +799,6 @@ return array( 'phabricator-phtize' => 'd254d646', 'phabricator-prefab' => 'c5af80a2', 'phabricator-remarkup-css' => 'd1a5e11e', - 'phabricator-scroll-objective' => '7e8877e7', - 'phabricator-scroll-objective-list' => '6120e99a', 'phabricator-search-results-css' => '8f8e08ed', 'phabricator-shaped-request' => '7cbe244b', 'phabricator-slowvote-css' => 'a94b7230', @@ -822,7 +818,7 @@ return array( 'phabricator-uiexample-reactor-select' => 'a155550f', 'phabricator-uiexample-reactor-sendclass' => '1def2711', 'phabricator-uiexample-reactor-sendproperties' => 'b1f0ccee', - 'phabricator-zindex-css' => '998f3ce1', + 'phabricator-zindex-css' => '9d8f7c4b', 'phame-css' => 'b3a0b3a3', 'pholio-css' => 'ca89d380', 'pholio-edit-css' => '07676f51', @@ -1002,9 +998,6 @@ return array( '185bbd53' => array( 'javelin-install', ), - 19582231 => array( - 'javelin-dom', - ), '19f9369b' => array( 'phui-oi-list-view-css', ), @@ -1026,14 +1019,6 @@ return array( 'javelin-request', 'javelin-uri', ), - '1de8bf63' => array( - 'javelin-behavior', - 'javelin-dom', - 'javelin-stratcom', - 'phabricator-tooltip', - 'phabricator-diff-changeset-list', - 'phabricator-diff-changeset', - ), '1def2711' => array( 'javelin-install', 'javelin-dom', @@ -1087,6 +1072,9 @@ return array( 'javelin-install', 'javelin-util', ), + '2971e2a2' => array( + 'phui-inline-comment-view-css', + ), '2ae077e1' => array( 'javelin-behavior', 'javelin-dom', @@ -1122,6 +1110,17 @@ return array( 'javelin-dom', 'javelin-workflow', ), + '3359ad02' => array( + 'javelin-dom', + 'javelin-util', + 'javelin-stratcom', + 'javelin-install', + 'javelin-workflow', + 'javelin-router', + 'javelin-behavior-device', + 'javelin-vector', + 'phabricator-diff-inline', + ), '358b8c04' => array( 'javelin-install', 'javelin-util', @@ -1204,6 +1203,9 @@ return array( 'javelin-behavior', 'javelin-dom', ), + '45d37835' => array( + 'javelin-dom', + ), '469c0d9e' => array( 'javelin-behavior', 'javelin-dom', @@ -1371,6 +1373,14 @@ return array( 'phabricator-phtize', 'javelin-dom', ), + '5e41c819' => array( + 'javelin-behavior', + 'javelin-dom', + 'javelin-stratcom', + 'phabricator-tooltip', + 'phabricator-diff-changeset-list', + 'phabricator-diff-changeset', + ), '5e9f347c' => array( 'javelin-behavior', 'multirow-row-manager', @@ -1388,15 +1398,6 @@ return array( 'javelin-stratcom', 'javelin-dom', ), - '6120e99a' => array( - 'javelin-dom', - 'javelin-util', - 'javelin-stratcom', - 'javelin-install', - 'javelin-workflow', - 'javelin-scrollbar', - 'phabricator-scroll-objective', - ), '61cbc29a' => array( 'javelin-magical-init', 'javelin-util', @@ -1411,6 +1412,9 @@ return array( 'javelin-workflow', 'javelin-dom', ), + '675f1ca3' => array( + 'javelin-install', + ), '680ea2c8' => array( 'javelin-install', 'javelin-dom', @@ -1496,10 +1500,6 @@ return array( 'javelin-behavior', 'javelin-quicksand', ), - '7a184082' => array( - 'javelin-install', - 'phabricator-scroll-objective-list', - ), '7a68dda3' => array( 'owners-path-editor', 'javelin-behavior', @@ -1513,13 +1513,6 @@ return array( '7e41274a' => array( 'javelin-install', ), - '7e8877e7' => array( - 'javelin-dom', - 'javelin-util', - 'javelin-stratcom', - 'javelin-install', - 'javelin-workflow', - ), '7ebaeed3' => array( 'herald-rule-editor', 'javelin-behavior', @@ -1787,9 +1780,6 @@ return array( 'phuix-autocomplete', 'javelin-mask', ), - 'acfd58f6' => array( - 'phui-inline-comment-view-css', - ), 'ae95d984' => array( 'javelin-behavior', 'javelin-stratcom', @@ -2002,17 +1992,6 @@ return array( 'cd2b9b77' => array( 'phui-oi-list-view-css', ), - 'cf4e2140' => array( - 'javelin-dom', - 'javelin-util', - 'javelin-stratcom', - 'javelin-install', - 'javelin-workflow', - 'javelin-router', - 'javelin-behavior-device', - 'javelin-vector', - 'phabricator-diff-inline', - ), 'd0a99ab4' => array( 'javelin-behavior', 'javelin-typeahead-ondemand-source', @@ -2435,8 +2414,6 @@ return array( 'javelin-behavior-load-blame', 'javelin-behavior-differential-user-select', 'javelin-behavior-aphront-more', - 'phabricator-scroll-objective', - 'phabricator-scroll-objective-list', 'phabricator-diff-inline', 'phabricator-diff-changeset', 'phabricator-diff-changeset-list', diff --git a/resources/celerity/packages.php b/resources/celerity/packages.php index afa6c456a6..e756e696cb 100644 --- a/resources/celerity/packages.php +++ b/resources/celerity/packages.php @@ -203,9 +203,6 @@ return array( 'javelin-behavior-differential-user-select', 'javelin-behavior-aphront-more', - 'phabricator-scroll-objective', - 'phabricator-scroll-objective-list', - 'phabricator-diff-inline', 'phabricator-diff-changeset', 'phabricator-diff-changeset-list', diff --git a/src/applications/differential/view/DifferentialChangesetDetailView.php b/src/applications/differential/view/DifferentialChangesetDetailView.php index e80dc20ec7..a1a3de26bb 100644 --- a/src/applications/differential/view/DifferentialChangesetDetailView.php +++ b/src/applications/differential/view/DifferentialChangesetDetailView.php @@ -204,7 +204,6 @@ final class DifferentialChangesetDetailView extends AphrontView { 'loaded' => $this->getLoaded(), 'undoTemplates' => hsprintf('%s', $renderer->renderUndoTemplates()), 'displayPath' => hsprintf('%s', $display_parts), - 'objectiveName' => basename($display_filename), 'icon' => $display_icon, ), 'class' => $class, diff --git a/src/applications/differential/view/DifferentialChangesetListView.php b/src/applications/differential/view/DifferentialChangesetListView.php index 880fcb872d..b8090b88a2 100644 --- a/src/applications/differential/view/DifferentialChangesetListView.php +++ b/src/applications/differential/view/DifferentialChangesetListView.php @@ -203,15 +203,11 @@ final class DifferentialChangesetListView extends AphrontView { $this->requireResource('aphront-tooltip-css'); - $show_objectives = - PhabricatorEnv::getEnvConfig('phabricator.show-prototypes'); - $this->initBehavior( 'differential-populate', array( 'changesetViewIDs' => $ids, 'inlineURI' => $this->inlineURI, - 'showObjectives' => $show_objectives, 'pht' => array( 'Open in Editor' => pht('Open in Editor'), 'Show All Context' => pht('Show All Context'), diff --git a/webroot/rsrc/css/application/differential/changeset-view.css b/webroot/rsrc/css/application/differential/changeset-view.css index 6a29e1269b..39df37003c 100644 --- a/webroot/rsrc/css/application/differential/changeset-view.css +++ b/webroot/rsrc/css/application/differential/changeset-view.css @@ -408,37 +408,3 @@ tr.differential-inline-loading { .diff-banner-path { color: {$greytext}; } - -.scroll-objective-list { - position: fixed; - right: 0; - width: 24px; - top: 48px; - bottom: 48px; - background: rgba(255, 255, 255, 0.50); - border-style: solid; - border-color: rgba(255, 255, 255, 0.95); - border-width: 1px 0 1px 1px; - box-shadow: -1px 0 2px rgba(255, 255, 255, 0.10); - overflow: hidden; -} - -.scroll-objective-list.has-aesthetic-scrollbar { - /* For now, hide this element on systems with aesthetic scrollbars. */ - display: none; -} - -.scroll-objective { - display: block; - position: absolute; - box-sizing: border-box; - cursor: pointer; - text-align: middle; - left: 7px; -} - -.scroll-objective .phui-icon-view { - text-shadow: 1px 1px 4px rgba(0, 0, 0, 0.25); - display: block; - height: 14px; -} diff --git a/webroot/rsrc/css/core/z-index.css b/webroot/rsrc/css/core/z-index.css index 04b013386d..75cd394988 100644 --- a/webroot/rsrc/css/core/z-index.css +++ b/webroot/rsrc/css/core/z-index.css @@ -97,10 +97,6 @@ div.phui-calendar-day-event { z-index: 6; } -.scroll-objective-list { - z-index: 6; -} - .conpherence-durable-column { z-index: 7; } diff --git a/webroot/rsrc/js/application/diff/DiffChangeset.js b/webroot/rsrc/js/application/diff/DiffChangeset.js index 2b275b0e65..8e70c5ac47 100644 --- a/webroot/rsrc/js/application/diff/DiffChangeset.js +++ b/webroot/rsrc/js/application/diff/DiffChangeset.js @@ -32,7 +32,6 @@ JX.install('DiffChangeset', { this._rightID = data.right; this._displayPath = JX.$H(data.displayPath); - this._objectiveName = data.objectiveName; this._icon = data.icon; this._inlines = []; @@ -62,8 +61,6 @@ JX.install('DiffChangeset', { _displayPath: null, _changesetList: null, - _objective: null, - _objectiveName: null, _icon: null, getLeftChangesetID: function() { @@ -76,23 +73,9 @@ JX.install('DiffChangeset', { setChangesetList: function(list) { this._changesetList = list; - - var objectives = list.getObjectives(); - this._objective = objectives.newObjective() - .setAnchor(this._node); - - this._updateObjective(); - return this; }, - _updateObjective: function() { - this._objective - .setIcon(this.getIcon()) - .setColor(this.getColor()) - .setTooltip(this.getObjectiveName()); - }, - getIcon: function() { if (!this._visible) { return 'fa-file-o'; @@ -109,10 +92,6 @@ JX.install('DiffChangeset', { return 'blue'; }, - getObjectiveName: function() { - return this._objectiveName; - }, - getChangesetList: function() { return this._changesetList; }, @@ -576,7 +555,6 @@ JX.install('DiffChangeset', { JX.Stratcom.invoke('differential-inline-comment-refresh'); - this._objective.show(); this._rebuildAllInlines(); JX.Stratcom.invoke('resize'); @@ -729,11 +707,6 @@ JX.install('DiffChangeset', { JX.DOM.appendContent(diff.parentNode, undo); } - this._updateObjective(); - for (var ii = 0; ii < this._inlines.length; ii++) { - this._inlines[ii].updateObjective(); - } - JX.Stratcom.invoke('resize'); }, diff --git a/webroot/rsrc/js/application/diff/DiffChangesetList.js b/webroot/rsrc/js/application/diff/DiffChangesetList.js index c344c96de8..0b9fa612a0 100644 --- a/webroot/rsrc/js/application/diff/DiffChangesetList.js +++ b/webroot/rsrc/js/application/diff/DiffChangesetList.js @@ -1,7 +1,6 @@ /** * @provides phabricator-diff-changeset-list * @requires javelin-install - * phabricator-scroll-objective-list * @javelin */ @@ -9,7 +8,6 @@ JX.install('DiffChangesetList', { construct: function() { this._changesets = []; - this._objectives = new JX.ScrollObjectiveList(); var onload = JX.bind(this, this._ifawake, this._onload); JX.Stratcom.listen('click', 'differential-load', onload); @@ -102,7 +100,6 @@ JX.install('DiffChangesetList', { _initialized: false, _asleep: true, _changesets: null, - _objectives: null, _cursorItem: null, @@ -120,7 +117,6 @@ JX.install('DiffChangesetList', { _rangeTarget: null, _bannerNode: null, - _showObjectives: false, sleep: function() { this._asleep = true; @@ -128,8 +124,6 @@ JX.install('DiffChangesetList', { this._redrawFocus(); this._redrawSelection(); this.resetHover(); - - this._objectives.hide(); }, wake: function() { @@ -138,10 +132,6 @@ JX.install('DiffChangesetList', { this._redrawFocus(); this._redrawSelection(); - if (this._showObjectives) { - this._objectives.show(); - } - if (this._initialized) { return; } @@ -198,19 +188,10 @@ JX.install('DiffChangesetList', { this._installKey('q', label, this._onkeyhide); }, - setShowObjectives: function(show) { - this._showObjectives = show; - return this; - }, - isAsleep: function() { return this._asleep; }, - getObjectives: function() { - return this._objectives; - }, - newChangesetForNode: function(node) { var changeset = JX.DiffChangeset.getForNode(node); @@ -538,24 +519,9 @@ JX.install('DiffChangesetList', { }, _setSelectionState: function(item, manager) { - // If we had an inline selected before, we need to update it after - // changing our selection to clear the selected state. Then, update the - // new one to add the selected state. - var old_inline = this.getSelectedInline(); - this._cursorItem = item; this._redrawSelection(manager, true); - var new_inline = this.getSelectedInline(); - - if (old_inline) { - old_inline.updateObjective(); - } - - if (new_inline) { - new_inline.updateObjective(); - } - return this; }, diff --git a/webroot/rsrc/js/application/diff/DiffInline.js b/webroot/rsrc/js/application/diff/DiffInline.js index bfc2a3e258..b0eb9ca2cb 100644 --- a/webroot/rsrc/js/application/diff/DiffInline.js +++ b/webroot/rsrc/js/application/diff/DiffInline.js @@ -29,7 +29,6 @@ JX.install('DiffInline', { _isLoading: false, _changeset: null, - _objective: null, _isDraft: null, _isFixed: null, @@ -38,7 +37,6 @@ JX.install('DiffInline', { bindToRow: function(row) { this._row = row; - this._objective.setAnchor(this._row); var row_data = JX.Stratcom.getData(row); row_data.inline = this; @@ -80,8 +78,6 @@ JX.install('DiffInline', { this.setInvisible(false); - this.updateObjective(); - return this; }, @@ -171,14 +167,6 @@ JX.install('DiffInline', { setChangeset: function(changeset) { this._changeset = changeset; - - var objectives = changeset.getChangesetList().getObjectives(); - - // Create this inline's objective, but don't show it yet. - this._objective = objectives.newObjective() - .setCallback(JX.bind(this, this._onobjective)) - .hide(); - return this; }, @@ -188,84 +176,9 @@ JX.install('DiffInline', { setEditing: function(editing) { this._isEditing = editing; - this.updateObjective(); return this; }, - _onobjective: function() { - this.getChangeset().getChangesetList().selectInline(this); - }, - - updateObjective: function() { - var objective = this._objective; - - if (this.isHidden() || this._isDeleted) { - objective.hide(); - return; - } - - // If this is a new comment which we aren't editing, don't show anything: - // the use started a comment or reply, then cancelled it. - if (this._isNew && !this._isEditing) { - objective.hide(); - return; - } - - var changeset = this.getChangeset(); - if (!changeset.isVisible()) { - objective.hide(); - return; - } - - var pht = changeset.getChangesetList().getTranslations(); - - var icon = 'fa-comment'; - var color = 'bluegrey'; - var tooltip = this._snippet; - var anchor = this._row; - var should_stack = false; - - if (this._isEditing) { - icon = 'fa-star'; - color = 'pink'; - tooltip = pht('Editing Comment'); - - // If we're editing, anchor to the row with the editor instead of the - // actual comment row (which is invisible and can have a misleading - // position). - anchor = this._row.nextSibling; - } else if (this._isDraft) { - // This inline is an unsubmitted draft. - icon = 'fa-pencil'; - color = 'indigo'; - } else if (this._isFixed) { - // This inline has been marked done. - icon = 'fa-check'; - color = 'grey'; - } else if (this._isGhost) { - icon = 'fa-comment-o'; - color = 'grey'; - } else if (this._replyToCommentPHID) { - icon = 'fa-reply'; - should_stack = true; - } - - if (changeset.getChangesetList().getSelectedInline() === this) { - // TODO: Maybe add some other kind of effect here, since we're only - // using color to show this? - color = 'yellow'; - } - - - objective - .setAnchor(anchor) - .setIcon(icon) - .setColor(color) - .setTooltip(tooltip) - .setShouldStack(should_stack) - .show(); - }, - canReply: function() { if (!this._hasAction('reply')) { return false; @@ -316,7 +229,6 @@ JX.install('DiffInline', { JX.Stratcom.getData(row).inline = this; this._row = row; - this._objective.setAnchor(this._row); this._id = null; this._phid = null; @@ -759,8 +671,6 @@ JX.install('DiffInline', { this.getChangeset().getChangesetList().redrawPreview(); } - this.updateObjective(); - this.getChangeset().getChangesetList().redrawCursor(); this.getChangeset().getChangesetList().resetHover(); diff --git a/webroot/rsrc/js/application/diff/ScrollObjective.js b/webroot/rsrc/js/application/diff/ScrollObjective.js deleted file mode 100644 index 1e596bd816..0000000000 --- a/webroot/rsrc/js/application/diff/ScrollObjective.js +++ /dev/null @@ -1,141 +0,0 @@ -/** - * @provides phabricator-scroll-objective - * @requires javelin-dom - * javelin-util - * javelin-stratcom - * javelin-install - * javelin-workflow - * @javelin - */ - - -JX.install('ScrollObjective', { - - construct : function() { - var node = this.getNode(); - - var onclick = JX.bind(this, this._onclick); - JX.DOM.listen(node, 'click', null, onclick); - }, - - members: { - _list: null, - - _node: null, - _anchor: null, - - _visible: false, - _callback: false, - _stack: false, - - getNode: function() { - if (!this._node) { - var attributes = { - className: 'scroll-objective' - }; - - var content = this._getIconObject().getNode(); - - var node = JX.$N('div', attributes, content); - - this._node = node; - } - - return this._node; - }, - - setCallback: function(callback) { - this._callback = callback; - return this; - }, - - setObjectiveList: function(list) { - this._list = list; - return this; - }, - - _getIconObject: function() { - if (!this._iconObject) { - this._iconObject = new JX.PHUIXIconView(); - } - return this._iconObject; - }, - - _onclick: function(e) { - (this._callback && this._callback(e)); - - if (e.getPrevented()) { - return; - } - - e.kill(); - - // This is magic to account for the banner, and should probably be made - // less hard-coded. - var buffer = 48; - - JX.DOM.scrollToPosition(null, JX.$V(this.getAnchor()).y - buffer); - }, - - setAnchor: function(node) { - this._anchor = node; - return this; - }, - - getAnchor: function() { - return this._anchor; - }, - - setIcon: function(icon) { - this._getIconObject().setIcon(icon); - return this; - }, - - setColor: function(color) { - this._getIconObject().setColor(color); - return this; - }, - - setTooltip: function(tip) { - var node = this._getIconObject().getNode(); - JX.Stratcom.addSigil(node, 'has-tooltip'); - JX.Stratcom.getData(node).tip = tip; - JX.Stratcom.getData(node).align = 'W'; - JX.Stratcom.getData(node).size = 'auto'; - return this; - }, - - - /** - * Should this objective always stack immediately under the previous - * objective? - * - * This allows related objectives (like "comment, reply, reply") to be - * rendered in a tight sequence. - */ - setShouldStack: function(stack) { - this._stack = stack; - return this; - }, - - shouldStack: function() { - return this._stack; - }, - - show: function() { - this._visible = true; - return this; - }, - - hide: function() { - this._visible = false; - return this; - }, - - isVisible: function() { - return this._visible; - } - - } - -}); diff --git a/webroot/rsrc/js/application/diff/ScrollObjectiveList.js b/webroot/rsrc/js/application/diff/ScrollObjectiveList.js deleted file mode 100644 index ce47877d1a..0000000000 --- a/webroot/rsrc/js/application/diff/ScrollObjectiveList.js +++ /dev/null @@ -1,150 +0,0 @@ -/** - * @provides phabricator-scroll-objective-list - * @requires javelin-dom - * javelin-util - * javelin-stratcom - * javelin-install - * javelin-workflow - * javelin-scrollbar - * phabricator-scroll-objective - * @javelin - */ - - -JX.install('ScrollObjectiveList', { - - construct : function() { - this._objectives = []; - - var onresize = JX.bind(this, this._dirty); - JX.Stratcom.listen('resize', null, onresize); - }, - - members: { - _objectives: null, - _visible: false, - _trigger: null, - - newObjective: function() { - var objective = new JX.ScrollObjective() - .setObjectiveList(this); - - this._objectives.push(objective); - this._getNode().appendChild(objective.getNode()); - - this._dirty(); - - return objective; - }, - - show: function() { - this._visible = true; - this._dirty(); - return this; - }, - - hide: function() { - this._visible = false; - this._dirty(); - return this; - }, - - _getNode: function() { - if (!this._node) { - var node = new JX.$N('div', {className: 'scroll-objective-list'}); - this._node = node; - } - return this._node; - }, - - _dirty: function() { - if (this._trigger !== null) { - return; - } - - this._trigger = setTimeout(JX.bind(this, this._redraw), 0); - }, - - _redraw: function() { - this._trigger = null; - - var node = this._getNode(); - - var is_visible = - (this._visible) && - (JX.Device.getDevice() == 'desktop') && - (this._objectives.length); - - if (!is_visible) { - JX.DOM.remove(node); - return; - } - - document.body.appendChild(node); - - // If we're on OSX without a mouse or some other system with zero-width - // trackpad-style scrollbars, adjust the display appropriately. - var aesthetic = (JX.Scrollbar.getScrollbarControlWidth() === 0); - JX.DOM.alterClass(node, 'has-aesthetic-scrollbar', aesthetic); - - var d = JX.Vector.getDocument(); - - var list_dimensions = JX.Vector.getDim(node); - var icon_height = 16; - var list_y = (list_dimensions.y - icon_height); - - var ii; - var offset; - - // First, build a list of all the items we're going to show. - var items = []; - for (ii = 0; ii < this._objectives.length; ii++) { - var objective = this._objectives[ii]; - var objective_node = objective.getNode(); - - var anchor = objective.getAnchor(); - if (!anchor || !objective.isVisible()) { - JX.DOM.remove(objective_node); - continue; - } - - offset = (JX.$V(anchor).y / d.y) * (list_y); - - items.push({ - offset: offset, - node: objective_node, - objective: objective - }); - } - - // Now, sort it from top to bottom. - items.sort(function(u, v) { - return u.offset - v.offset; - }); - - // Lay out the items in the objective list, leaving a minimum amount - // of space between them so they do not overlap. - var min = null; - for (ii = 0; ii < items.length; ii++) { - var item = items[ii]; - - offset = item.offset; - - if (min !== null) { - if (item.objective.shouldStack()) { - offset = min; - } else { - offset = Math.max(offset, min); - } - } - min = offset + 15; - - item.node.style.top = offset + 'px'; - node.appendChild(item.node); - } - - } - - } - -}); diff --git a/webroot/rsrc/js/application/differential/behavior-populate.js b/webroot/rsrc/js/application/differential/behavior-populate.js index b1b5bd415c..e5b0d5039d 100644 --- a/webroot/rsrc/js/application/differential/behavior-populate.js +++ b/webroot/rsrc/js/application/differential/behavior-populate.js @@ -60,8 +60,7 @@ JX.behavior('differential-populate', function(config, statics) { var changeset_list = new JX.DiffChangesetList() .setTranslations(JX.phtize(config.pht)) - .setInlineURI(config.inlineURI) - .setShowObjectives(config.showObjectives); + .setInlineURI(config.inlineURI); // Install and activate the current page. var page_id = JX.Quicksand.getCurrentPageID(); From cc0a6fd3aa45c272a2560a70a4826a4c20070e5f Mon Sep 17 00:00:00 2001 From: epriestley Date: Tue, 30 May 2017 13:35:27 -0700 Subject: [PATCH 10/31] Remove the ability to leave multi-line inline comments on touchscreen devices Summary: Ref T12733. This ultimately conflicts with scrolling and took about two days to get reported as a bug/regression. See T12733 for a bunch of additional discussion. See T1026 for original discussion. Test Plan: - Left single-line and multi-line comments on desktop. - Tapped to leave single-line comments on mobile. - Dragged lines on mobile, got a scroll instead of a range comment. Reviewers: chad Reviewed By: chad Maniphest Tasks: T12733 Differential Revision: https://secure.phabricator.com/D18044 --- resources/celerity/map.php | 12 +++--- .../js/application/diff/DiffChangesetList.js | 39 ++----------------- 2 files changed, 10 insertions(+), 41 deletions(-) diff --git a/resources/celerity/map.php b/resources/celerity/map.php index 87bc02214d..b6cf443b35 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -13,7 +13,7 @@ return array( 'core.pkg.js' => '1475bd91', 'darkconsole.pkg.js' => '1f9a31bc', 'differential.pkg.css' => '9ebe4f44', - 'differential.pkg.js' => '78b8497f', + 'differential.pkg.js' => '40f4acb3', 'diffusion.pkg.css' => 'b93d9b8c', 'diffusion.pkg.js' => '84c8f8fd', 'favicon.ico' => '30672e08', @@ -392,7 +392,7 @@ return array( 'rsrc/js/application/dashboard/behavior-dashboard-query-panel-select.js' => '453c5375', 'rsrc/js/application/dashboard/behavior-dashboard-tab-panel.js' => 'd4eecc63', 'rsrc/js/application/diff/DiffChangeset.js' => '3359ad02', - 'rsrc/js/application/diff/DiffChangesetList.js' => '675f1ca3', + 'rsrc/js/application/diff/DiffChangesetList.js' => 'b42eb5ff', 'rsrc/js/application/diff/DiffInline.js' => '45d37835', 'rsrc/js/application/diff/behavior-preview-link.js' => '051c7832', 'rsrc/js/application/differential/behavior-comment-preview.js' => '51c5ad07', @@ -778,7 +778,7 @@ return array( 'phabricator-darkmessage' => 'c48cccdd', 'phabricator-dashboard-css' => 'fe5b1869', 'phabricator-diff-changeset' => '3359ad02', - 'phabricator-diff-changeset-list' => '675f1ca3', + 'phabricator-diff-changeset-list' => 'b42eb5ff', 'phabricator-diff-inline' => '45d37835', 'phabricator-drag-and-drop-file-upload' => '58dea2fa', 'phabricator-draggable-list' => 'bea6e7f4', @@ -1412,9 +1412,6 @@ return array( 'javelin-workflow', 'javelin-dom', ), - '675f1ca3' => array( - 'javelin-install', - ), '680ea2c8' => array( 'javelin-install', 'javelin-dom', @@ -1822,6 +1819,9 @@ return array( 'b3e7d692' => array( 'javelin-install', ), + 'b42eb5ff' => array( + 'javelin-install', + ), 'b59e1e96' => array( 'javelin-behavior', 'javelin-stratcom', diff --git a/webroot/rsrc/js/application/diff/DiffChangesetList.js b/webroot/rsrc/js/application/diff/DiffChangesetList.js index 0b9fa612a0..60575e2aa2 100644 --- a/webroot/rsrc/js/application/diff/DiffChangesetList.js +++ b/webroot/rsrc/js/application/diff/DiffChangesetList.js @@ -68,7 +68,7 @@ JX.install('DiffChangesetList', { var onrangedown = JX.bind(this, this._ifawake, this._onrangedown); JX.Stratcom.listen( - ['touchstart', 'mousedown'], + 'mousedown', ['differential-changeset', 'tag:th'], onrangedown); @@ -78,15 +78,9 @@ JX.install('DiffChangesetList', { ['differential-changeset', 'tag:th'], onrangemove); - var onrangetouchmove = JX.bind(this, this._ifawake, this._onrangetouchmove); - JX.Stratcom.listen( - 'touchmove', - null, - onrangetouchmove); - var onrangeup = JX.bind(this, this._ifawake, this._onrangeup); JX.Stratcom.listen( - ['touchend', 'mouseup'], + 'mouseup', null, onrangeup); }, @@ -1147,8 +1141,8 @@ JX.install('DiffChangesetList', { }, _onrangedown: function(e) { - // NOTE: We're allowing touch events through, including "touchstart". We - // need to kill the "touchstart" event so the page doesn't scroll. + // NOTE: We're allowing "mousedown" from a touch event through so users + // can leave inlines on a single line. if (e.isRightButton()) { return; } @@ -1238,31 +1232,6 @@ JX.install('DiffChangesetList', { this._setHoverRange(this._rangeOrigin, this._rangeTarget); }, - _onrangetouchmove: function(e) { - if (!this._rangeActive) { - return; - } - - // NOTE: The target of a "touchmove" event is bogus. Use dark magic to - // identify the actual target. Some day, this might move into the core - // libraries. If this doesn't work, just bail. - - var target; - try { - var raw_event = e.getRawEvent(); - var touch = raw_event.touches[0]; - target = document.elementFromPoint(touch.clientX, touch.clientY); - } catch (ex) { - return; - } - - if (!JX.DOM.isType(target, 'th')) { - return; - } - - this._updateRange(target, false); - }, - _onrangeup: function(e) { if (!this._rangeActive) { return; From 83e99fb691aa350d6990d3e467a3af1ba0d47213 Mon Sep 17 00:00:00 2001 From: epriestley Date: Tue, 30 May 2017 14:00:02 -0700 Subject: [PATCH 11/31] Add a class to the Differential banner when unsubmitted/unsaved changes are present Summary: Ref T12733. This adds classes for unsubmitted/unsaved changes, and lays some groundwork for additional buttons. Test Plan: - Added, edited, deleted comments. - Saw bar background color update appropriately. Reviewers: chad Reviewed By: chad Maniphest Tasks: T12733 Differential Revision: https://secure.phabricator.com/D18045 --- resources/celerity/map.php | 60 +++++++++---------- .../differential/changeset-view.css | 5 ++ .../rsrc/js/application/diff/DiffChangeset.js | 5 ++ .../js/application/diff/DiffChangesetList.js | 42 +++++++++++++ .../rsrc/js/application/diff/DiffInline.js | 16 +++++ 5 files changed, 98 insertions(+), 30 deletions(-) diff --git a/resources/celerity/map.php b/resources/celerity/map.php index b6cf443b35..d6ad7e41fd 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -12,8 +12,8 @@ return array( 'core.pkg.css' => 'bb7f0446', 'core.pkg.js' => '1475bd91', 'darkconsole.pkg.js' => '1f9a31bc', - 'differential.pkg.css' => '9ebe4f44', - 'differential.pkg.js' => '40f4acb3', + 'differential.pkg.css' => 'a2755617', + 'differential.pkg.js' => '5bf658f0', 'diffusion.pkg.css' => 'b93d9b8c', 'diffusion.pkg.js' => '84c8f8fd', 'favicon.ico' => '30672e08', @@ -64,7 +64,7 @@ return array( 'rsrc/css/application/dashboard/dashboard.css' => 'fe5b1869', 'rsrc/css/application/diff/inline-comment-summary.css' => '51efda3a', 'rsrc/css/application/differential/add-comment.css' => 'c47f8c40', - 'rsrc/css/application/differential/changeset-view.css' => '2971e2a2', + 'rsrc/css/application/differential/changeset-view.css' => '983751ee', 'rsrc/css/application/differential/core.css' => '5b7b8ff4', 'rsrc/css/application/differential/phui-inline-comment.css' => 'ffd1a542', 'rsrc/css/application/differential/revision-comment.css' => '14b8565a', @@ -391,9 +391,9 @@ return array( 'rsrc/js/application/dashboard/behavior-dashboard-move-panels.js' => '408bf173', 'rsrc/js/application/dashboard/behavior-dashboard-query-panel-select.js' => '453c5375', 'rsrc/js/application/dashboard/behavior-dashboard-tab-panel.js' => 'd4eecc63', - 'rsrc/js/application/diff/DiffChangeset.js' => '3359ad02', - 'rsrc/js/application/diff/DiffChangesetList.js' => 'b42eb5ff', - 'rsrc/js/application/diff/DiffInline.js' => '45d37835', + 'rsrc/js/application/diff/DiffChangeset.js' => '1f6748ae', + 'rsrc/js/application/diff/DiffChangesetList.js' => '85abc805', + 'rsrc/js/application/diff/DiffInline.js' => '1d17130f', 'rsrc/js/application/diff/behavior-preview-link.js' => '051c7832', 'rsrc/js/application/differential/behavior-comment-preview.js' => '51c5ad07', 'rsrc/js/application/differential/behavior-diff-radios.js' => 'e1ff79b1', @@ -566,7 +566,7 @@ return array( 'conpherence-thread-manager' => '4d863052', 'conpherence-transaction-css' => '85129c68', 'd3' => 'a11a5ff2', - 'differential-changeset-view-css' => '2971e2a2', + 'differential-changeset-view-css' => '983751ee', 'differential-core-view-css' => '5b7b8ff4', 'differential-revision-add-comment-css' => 'c47f8c40', 'differential-revision-comment-css' => '14b8565a', @@ -777,9 +777,9 @@ return array( 'phabricator-darklog' => 'c8e1ffe3', 'phabricator-darkmessage' => 'c48cccdd', 'phabricator-dashboard-css' => 'fe5b1869', - 'phabricator-diff-changeset' => '3359ad02', - 'phabricator-diff-changeset-list' => 'b42eb5ff', - 'phabricator-diff-inline' => '45d37835', + 'phabricator-diff-changeset' => '1f6748ae', + 'phabricator-diff-changeset-list' => '85abc805', + 'phabricator-diff-inline' => '1d17130f', 'phabricator-drag-and-drop-file-upload' => '58dea2fa', 'phabricator-draggable-list' => 'bea6e7f4', 'phabricator-fatal-config-template-css' => '8f18fa41', @@ -1019,6 +1019,9 @@ return array( 'javelin-request', 'javelin-uri', ), + '1d17130f' => array( + 'javelin-dom', + ), '1def2711' => array( 'javelin-install', 'javelin-dom', @@ -1035,6 +1038,17 @@ return array( 'javelin-uri', 'javelin-routable', ), + '1f6748ae' => array( + 'javelin-dom', + 'javelin-util', + 'javelin-stratcom', + 'javelin-install', + 'javelin-workflow', + 'javelin-router', + 'javelin-behavior-device', + 'javelin-vector', + 'phabricator-diff-inline', + ), '1f6794f6' => array( 'javelin-behavior', 'javelin-stratcom', @@ -1072,9 +1086,6 @@ return array( 'javelin-install', 'javelin-util', ), - '2971e2a2' => array( - 'phui-inline-comment-view-css', - ), '2ae077e1' => array( 'javelin-behavior', 'javelin-dom', @@ -1110,17 +1121,6 @@ return array( 'javelin-dom', 'javelin-workflow', ), - '3359ad02' => array( - 'javelin-dom', - 'javelin-util', - 'javelin-stratcom', - 'javelin-install', - 'javelin-workflow', - 'javelin-router', - 'javelin-behavior-device', - 'javelin-vector', - 'phabricator-diff-inline', - ), '358b8c04' => array( 'javelin-install', 'javelin-util', @@ -1203,9 +1203,6 @@ return array( 'javelin-behavior', 'javelin-dom', ), - '45d37835' => array( - 'javelin-dom', - ), '469c0d9e' => array( 'javelin-behavior', 'javelin-dom', @@ -1541,6 +1538,9 @@ return array( 'javelin-dom', 'javelin-stratcom', ), + '85abc805' => array( + 'javelin-install', + ), '85ee8ce6' => array( 'aphront-dialog-view-css', ), @@ -1652,6 +1652,9 @@ return array( 'javelin-mask', 'phabricator-drag-and-drop-file-upload', ), + '983751ee' => array( + 'phui-inline-comment-view-css', + ), '988040b4' => array( 'javelin-install', 'javelin-dom', @@ -1819,9 +1822,6 @@ return array( 'b3e7d692' => array( 'javelin-install', ), - 'b42eb5ff' => array( - 'javelin-install', - ), 'b59e1e96' => array( 'javelin-behavior', 'javelin-stratcom', diff --git a/webroot/rsrc/css/application/differential/changeset-view.css b/webroot/rsrc/css/application/differential/changeset-view.css index 39df37003c..f1be2b5f99 100644 --- a/webroot/rsrc/css/application/differential/changeset-view.css +++ b/webroot/rsrc/css/application/differential/changeset-view.css @@ -408,3 +408,8 @@ tr.differential-inline-loading { .diff-banner-path { color: {$greytext}; } + +.diff-banner-has-unsaved, +.diff-banner-has-unsubmitted { + background: {$sh-yellowbackground}; +} diff --git a/webroot/rsrc/js/application/diff/DiffChangeset.js b/webroot/rsrc/js/application/diff/DiffChangeset.js index 8e70c5ac47..6b5ebf5317 100644 --- a/webroot/rsrc/js/application/diff/DiffChangeset.js +++ b/webroot/rsrc/js/application/diff/DiffChangeset.js @@ -679,6 +679,11 @@ JX.install('DiffChangeset', { return null; }, + getInlines: function() { + this._rebuildAllInlines(); + return this._inlines; + }, + _rebuildAllInlines: function() { var rows = JX.DOM.scry(this._node, 'tr'); for (var ii = 0; ii < rows.length; ii++) { diff --git a/webroot/rsrc/js/application/diff/DiffChangesetList.js b/webroot/rsrc/js/application/diff/DiffChangesetList.js index 60575e2aa2..b79f05296e 100644 --- a/webroot/rsrc/js/application/diff/DiffChangesetList.js +++ b/webroot/rsrc/js/application/diff/DiffChangesetList.js @@ -818,6 +818,11 @@ JX.install('DiffChangesetList', { this._redrawSelection(); this._redrawHover(); + // Force a banner redraw after a resize event. Particularly, this makes + // sure the inline state updates immediately after an inline edit + // operation, even if the changeset itself has not changed. + this._bannerChangeset = null; + this._redrawBanner(); }, @@ -1278,6 +1283,43 @@ JX.install('DiffChangesetList', { return; } + var changesets = this._changesets; + var unsaved = []; + var unsubmitted = []; + var undone = []; + var all = []; + + for (var ii = 0; ii < changesets.length; ii++) { + var inlines = changesets[ii].getInlines(); + for (var jj = 0; jj < inlines.length; jj++) { + var inline = inlines[jj]; + + if (inline.isDeleted()) { + continue; + } + + all.push(inline); + + if (inline.isEditing()) { + unsaved.push(inline); + } else if (inline.isDraft()) { + unsubmitted.push(inline); + } else if (!inline.isDone()) { + undone.push(inline); + } + } + } + + JX.DOM.alterClass( + node, + 'diff-banner-has-unsaved', + !!unsaved.length); + + JX.DOM.alterClass( + node, + 'diff-banner-has-unsubmitted', + !!unsubmitted.length); + var icon = new JX.PHUIXIconView() .setIcon(changeset.getIcon()) .getNode(); diff --git a/webroot/rsrc/js/application/diff/DiffInline.js b/webroot/rsrc/js/application/diff/DiffInline.js index b0eb9ca2cb..6d897c27ae 100644 --- a/webroot/rsrc/js/application/diff/DiffInline.js +++ b/webroot/rsrc/js/application/diff/DiffInline.js @@ -81,6 +81,22 @@ JX.install('DiffInline', { return this; }, + isDraft: function() { + return this._isDraft; + }, + + isDone: function() { + return this._isFixed; + }, + + isEditing: function() { + return this._isEditing; + }, + + isDeleted: function() { + return this._isDeleted; + }, + bindToRange: function(data) { this._displaySide = data.displaySide; this._number = parseInt(data.number, 10); From 2c0dab055f73e53f2989c9d1ce8ca26ae402a302 Mon Sep 17 00:00:00 2001 From: epriestley Date: Tue, 30 May 2017 14:32:54 -0700 Subject: [PATCH 12/31] Make "simple" a "button type", not a "color" Summary: Ref M1476. Currently, `setColor('simple')` is meaningful. Instead, `setButtonType('simple')`. Depends on D18047. Test Plan: Looked at UI examples, Phame, Auth. Notifications mooted by D18047. Reviewers: chad Reviewed By: chad Differential Revision: https://secure.phabricator.com/D18048 --- .../config/PhabricatorAuthListController.php | 2 +- .../guides/view/PhabricatorGuideListView.php | 2 +- .../phame/query/PhameBlogSearchEngine.php | 2 +- .../uiexample/examples/PHUIBoxExample.php | 10 ++++----- .../examples/PHUIButtonBarExample.php | 4 ++-- .../uiexample/examples/PHUIButtonExample.php | 8 +++---- src/view/phui/PHUIButtonView.php | 22 +++++++++++++++++++ src/view/phui/PHUIDocumentViewPro.php | 2 +- 8 files changed, 37 insertions(+), 15 deletions(-) diff --git a/src/applications/auth/controller/config/PhabricatorAuthListController.php b/src/applications/auth/controller/config/PhabricatorAuthListController.php index ae5808ed78..c5d4f7ad77 100644 --- a/src/applications/auth/controller/config/PhabricatorAuthListController.php +++ b/src/applications/auth/controller/config/PhabricatorAuthListController.php @@ -103,7 +103,7 @@ final class PhabricatorAuthListController $button = id(new PHUIButtonView()) ->setTag('a') - ->setColor(PHUIButtonView::SIMPLE) + ->setButtonType(PHUIButtonView::BUTTONTYPE_SIMPLE) ->setHref($this->getApplicationURI('config/new/')) ->setIcon('fa-plus') ->setDisabled(!$can_manage) diff --git a/src/applications/guides/view/PhabricatorGuideListView.php b/src/applications/guides/view/PhabricatorGuideListView.php index 04ab7c3058..089f325e0c 100644 --- a/src/applications/guides/view/PhabricatorGuideListView.php +++ b/src/applications/guides/view/PhabricatorGuideListView.php @@ -30,7 +30,7 @@ final class PhabricatorGuideListView extends AphrontView { ->setText(pht('Skip')) ->setTag('a') ->setHref($skip_href) - ->setColor(PHUIButtonView::SIMPLE); + ->setButtonType(PHUIButtonView::BUTTONTYPE_SIMPLE); $list_item->setSideColumn($skip); } $list->addItem($list_item); diff --git a/src/applications/phame/query/PhameBlogSearchEngine.php b/src/applications/phame/query/PhameBlogSearchEngine.php index 3d23a9763d..eaef32af1c 100644 --- a/src/applications/phame/query/PhameBlogSearchEngine.php +++ b/src/applications/phame/query/PhameBlogSearchEngine.php @@ -98,7 +98,7 @@ final class PhameBlogSearchEngine ->setTag('a') ->setText('New Post') ->setHref($this->getApplicationURI('/post/edit/?blog='.$id)) - ->setColor(PHUIButtonView::SIMPLE); + ->setButtonType(PHUIButtonView::BUTTONTYPE_SIMPLE); $item->setSideColumn($button); } diff --git a/src/applications/uiexample/examples/PHUIBoxExample.php b/src/applications/uiexample/examples/PHUIBoxExample.php index 7a2674da94..4a551de707 100644 --- a/src/applications/uiexample/examples/PHUIBoxExample.php +++ b/src/applications/uiexample/examples/PHUIBoxExample.php @@ -62,11 +62,11 @@ final class PHUIBoxExample extends PhabricatorUIExample { ); $button = id(new PHUIButtonView()) - ->setTag('a') - ->setColor(PHUIButtonView::SIMPLE) - ->setIcon('fa-heart') - ->setText(pht('Such Wow')) - ->addClass(PHUI::MARGIN_SMALL_RIGHT); + ->setTag('a') + ->setButtonType(PHUIButtonView::BUTTONTYPE_SIMPLE) + ->setIcon('fa-heart') + ->setText(pht('Such Wow')) + ->addClass(PHUI::MARGIN_SMALL_RIGHT); $badge1 = id(new PHUIBadgeMiniView()) ->setIcon('fa-bug') diff --git a/src/applications/uiexample/examples/PHUIButtonBarExample.php b/src/applications/uiexample/examples/PHUIButtonBarExample.php index 1501770dcf..d7992aa830 100644 --- a/src/applications/uiexample/examples/PHUIButtonBarExample.php +++ b/src/applications/uiexample/examples/PHUIButtonBarExample.php @@ -36,7 +36,7 @@ final class PHUIButtonBarExample extends PhabricatorUIExample { foreach ($icons as $text => $icon) { $button = id(new PHUIButtonView()) ->setTag('a') - ->setColor(PHUIButtonView::SIMPLE) + ->setButtonType(PHUIButtonView::BUTTONTYPE_SIMPLE) ->setTitle($text) ->setText($text); @@ -47,7 +47,7 @@ final class PHUIButtonBarExample extends PhabricatorUIExample { foreach ($icons as $text => $icon) { $button = id(new PHUIButtonView()) ->setTag('a') - ->setColor(PHUIButtonView::SIMPLE) + ->setButtonType(PHUIButtonView::BUTTONTYPE_SIMPLE) ->setTitle($text) ->setTooltip($text) ->setIcon($icon); diff --git a/src/applications/uiexample/examples/PHUIButtonExample.php b/src/applications/uiexample/examples/PHUIButtonExample.php index 900125cbc2..8f2e1e57a7 100644 --- a/src/applications/uiexample/examples/PHUIButtonExample.php +++ b/src/applications/uiexample/examples/PHUIButtonExample.php @@ -129,15 +129,15 @@ final class PHUIButtonExample extends PhabricatorUIExample { 'Subscribe' => 'fa-check-circle bluegrey', 'Edit' => 'fa-pencil bluegrey', ); - $colors = array( - PHUIButtonView::SIMPLE, + $designs = array( + PHUIButtonView::BUTTONTYPE_SIMPLE, ); $column = array(); - foreach ($colors as $color) { + foreach ($designs as $design) { foreach ($icons as $text => $icon) { $column[] = id(new PHUIButtonView()) ->setTag('a') - ->setColor($color) + ->setButtonType($design) ->setIcon($icon) ->setText($text) ->addClass(PHUI::MARGIN_SMALL_RIGHT); diff --git a/src/view/phui/PHUIButtonView.php b/src/view/phui/PHUIButtonView.php index ac3f8aabe0..0d0e0f3363 100644 --- a/src/view/phui/PHUIButtonView.php +++ b/src/view/phui/PHUIButtonView.php @@ -10,6 +10,9 @@ final class PHUIButtonView extends AphrontTagView { const SMALL = 'small'; const BIG = 'big'; + const BUTTONTYPE_DEFAULT = 'buttontype.default'; + const BUTTONTYPE_SIMPLE = 'buttontype.simple'; + private $size; private $text; private $subtext; @@ -25,6 +28,7 @@ final class PHUIButtonView extends AphrontTagView { private $tooltip; private $noCSS; private $hasCaret; + private $buttonType = self::BUTTONTYPE_DEFAULT; public function setName($name) { $this->name = $name; @@ -103,6 +107,15 @@ final class PHUIButtonView extends AphrontTagView { return $this->hasCaret; } + public function setButtonType($button_type) { + $this->buttonType = $button_type; + return $this; + } + + public function getButtonType() { + return $this->buttonType; + } + public function setIcon($icon, $first = true) { if (!($icon instanceof PHUIIconView)) { $icon = id(new PHUIIconView()) @@ -169,6 +182,15 @@ final class PHUIButtonView extends AphrontTagView { $classes[] = 'disabled'; } + switch ($this->getButtonType()) { + case self::BUTTONTYPE_DEFAULT: + // Nothing special for default buttons. + break; + case self::BUTTONTYPE_SIMPLE: + $classes[] = 'simple'; + break; + } + $sigil = null; $meta = null; if ($this->tooltip) { diff --git a/src/view/phui/PHUIDocumentViewPro.php b/src/view/phui/PHUIDocumentViewPro.php index d60cd78d44..51ecc3526e 100644 --- a/src/view/phui/PHUIDocumentViewPro.php +++ b/src/view/phui/PHUIDocumentViewPro.php @@ -79,7 +79,7 @@ final class PHUIDocumentViewPro extends AphrontTagView { $toc[] = id(new PHUIButtonView()) ->setTag('a') ->setIcon('fa-align-left') - ->setColor(PHUIButtonView::SIMPLE) + ->setButtonType(PHUIButtonView::BUTTONTYPE_SIMPLE) ->addClass('phui-document-toc') ->addSigil('jx-toggle-class') ->setMetaData(array( From 7725d7cc45c7792610746b4a773e4cb12743d873 Mon Sep 17 00:00:00 2001 From: epriestley Date: Tue, 30 May 2017 15:49:41 -0700 Subject: [PATCH 13/31] Remove some old UIExamples Summary: Ref M1476. I'm going to see if I can set up side-by-side "PHUI" vs "PHUIX" to make maintaining them a touch easier. Before doing that, nuke some really old UI examples that don't seem very useful. Test Plan: Viewed UIExamples, saw fewer bad ones. Reviewers: chad Reviewed By: chad Differential Revision: https://secure.phabricator.com/D18049 --- resources/celerity/map.php | 80 -------------- src/__phutil_library_map__.php | 16 --- .../examples/JavelinReactorUIExample.php | 95 ---------------- .../uiexample/examples/JavelinUIExample.php | 66 ------------ .../examples/JavelinViewUIExample.php | 45 -------- .../examples/PhabricatorBarePageUIExample.php | 25 ----- .../examples/PhabricatorBusyUIExample.php | 17 --- .../PhabricatorListFilterUIExample.php | 35 ------ .../PhabricatorSortTableUIExample.php | 96 ----------------- .../examples/PhabricatorTooltipUIExample.php | 102 ------------------ .../uiexample/JavelinViewExample.js | 19 ---- .../uiexample/ReactorButtonExample.js | 38 ------- .../uiexample/ReactorCheckboxExample.js | 17 --- .../uiexample/ReactorFocusExample.js | 16 --- .../uiexample/ReactorInputExample.js | 32 ------ .../uiexample/ReactorMouseoverExample.js | 16 --- .../uiexample/ReactorRadioExample.js | 24 ----- .../uiexample/ReactorSelectExample.js | 21 ---- .../uiexample/ReactorSendClassExample.js | 18 ---- .../uiexample/ReactorSendPropertiesExample.js | 26 ----- .../js/application/uiexample/busy-example.js | 9 -- 21 files changed, 813 deletions(-) delete mode 100644 src/applications/uiexample/examples/JavelinReactorUIExample.php delete mode 100644 src/applications/uiexample/examples/JavelinUIExample.php delete mode 100644 src/applications/uiexample/examples/JavelinViewUIExample.php delete mode 100644 src/applications/uiexample/examples/PhabricatorBarePageUIExample.php delete mode 100644 src/applications/uiexample/examples/PhabricatorBusyUIExample.php delete mode 100644 src/applications/uiexample/examples/PhabricatorListFilterUIExample.php delete mode 100644 src/applications/uiexample/examples/PhabricatorSortTableUIExample.php delete mode 100644 src/applications/uiexample/examples/PhabricatorTooltipUIExample.php delete mode 100644 webroot/rsrc/js/application/uiexample/JavelinViewExample.js delete mode 100644 webroot/rsrc/js/application/uiexample/ReactorButtonExample.js delete mode 100644 webroot/rsrc/js/application/uiexample/ReactorCheckboxExample.js delete mode 100644 webroot/rsrc/js/application/uiexample/ReactorFocusExample.js delete mode 100644 webroot/rsrc/js/application/uiexample/ReactorInputExample.js delete mode 100644 webroot/rsrc/js/application/uiexample/ReactorMouseoverExample.js delete mode 100644 webroot/rsrc/js/application/uiexample/ReactorRadioExample.js delete mode 100644 webroot/rsrc/js/application/uiexample/ReactorSelectExample.js delete mode 100644 webroot/rsrc/js/application/uiexample/ReactorSendClassExample.js delete mode 100644 webroot/rsrc/js/application/uiexample/ReactorSendPropertiesExample.js delete mode 100644 webroot/rsrc/js/application/uiexample/busy-example.js diff --git a/resources/celerity/map.php b/resources/celerity/map.php index d6ad7e41fd..56a38061a1 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -452,17 +452,6 @@ return array( 'rsrc/js/application/transactions/behavior-transaction-list.js' => '1f6794f6', 'rsrc/js/application/typeahead/behavior-typeahead-browse.js' => '635de1ec', 'rsrc/js/application/typeahead/behavior-typeahead-search.js' => '93d0c9e3', - 'rsrc/js/application/uiexample/JavelinViewExample.js' => 'd4a14807', - 'rsrc/js/application/uiexample/ReactorButtonExample.js' => 'd19198c8', - 'rsrc/js/application/uiexample/ReactorCheckboxExample.js' => '519705ea', - 'rsrc/js/application/uiexample/ReactorFocusExample.js' => '40a6a403', - 'rsrc/js/application/uiexample/ReactorInputExample.js' => '886fd850', - 'rsrc/js/application/uiexample/ReactorMouseoverExample.js' => '47c794d8', - 'rsrc/js/application/uiexample/ReactorRadioExample.js' => '988040b4', - 'rsrc/js/application/uiexample/ReactorSelectExample.js' => 'a155550f', - 'rsrc/js/application/uiexample/ReactorSendClassExample.js' => '1def2711', - 'rsrc/js/application/uiexample/ReactorSendPropertiesExample.js' => 'b1f0ccee', - 'rsrc/js/application/uiexample/busy-example.js' => '60479091', 'rsrc/js/application/uiexample/gesture-example.js' => '558829c2', 'rsrc/js/application/uiexample/notification-example.js' => '8ce821c5', 'rsrc/js/core/Busy.js' => '59a7976a', @@ -653,7 +642,6 @@ return array( 'javelin-behavior-passphrase-credential-control' => '3cb0b2fc', 'javelin-behavior-phabricator-active-nav' => 'e379b58e', 'javelin-behavior-phabricator-autofocus' => '7319e029', - 'javelin-behavior-phabricator-busy-example' => '60479091', 'javelin-behavior-phabricator-file-tree' => '88236f00', 'javelin-behavior-phabricator-gesture' => '3ab51e2c', 'javelin-behavior-phabricator-gesture-example' => '558829c2', @@ -808,16 +796,6 @@ return array( 'phabricator-title' => '485aaa6c', 'phabricator-tooltip' => '358b8c04', 'phabricator-ui-example-css' => '528b19de', - 'phabricator-uiexample-javelin-view' => 'd4a14807', - 'phabricator-uiexample-reactor-button' => 'd19198c8', - 'phabricator-uiexample-reactor-checkbox' => '519705ea', - 'phabricator-uiexample-reactor-focus' => '40a6a403', - 'phabricator-uiexample-reactor-input' => '886fd850', - 'phabricator-uiexample-reactor-mouseover' => '47c794d8', - 'phabricator-uiexample-reactor-radio' => '988040b4', - 'phabricator-uiexample-reactor-select' => 'a155550f', - 'phabricator-uiexample-reactor-sendclass' => '1def2711', - 'phabricator-uiexample-reactor-sendproperties' => 'b1f0ccee', 'phabricator-zindex-css' => '9d8f7c4b', 'phame-css' => 'b3a0b3a3', 'pholio-css' => 'ca89d380', @@ -1022,11 +1000,6 @@ return array( '1d17130f' => array( 'javelin-dom', ), - '1def2711' => array( - 'javelin-install', - 'javelin-dom', - 'javelin-reactor-dom', - ), '1e911d0f' => array( 'javelin-stratcom', 'javelin-request', @@ -1175,11 +1148,6 @@ return array( 'javelin-workflow', 'phabricator-draggable-list', ), - '40a6a403' => array( - 'javelin-install', - 'javelin-dom', - 'javelin-reactor-dom', - ), 42126667 => array( 'javelin-behavior', 'javelin-dom', @@ -1214,11 +1182,6 @@ return array( 'javelin-view-renderer', 'javelin-install', ), - '47c794d8' => array( - 'javelin-install', - 'javelin-dom', - 'javelin-reactor-dom', - ), 48086888 => array( 'javelin-behavior', 'javelin-dom', @@ -1285,11 +1248,6 @@ return array( 'javelin-typeahead-source', 'javelin-util', ), - '519705ea' => array( - 'javelin-install', - 'javelin-dom', - 'javelin-reactor-dom', - ), '51c5ad07' => array( 'javelin-behavior', 'javelin-stratcom', @@ -1386,10 +1344,6 @@ return array( 'phabricator-prefab', 'javelin-json', ), - 60479091 => array( - 'phabricator-busy', - 'javelin-behavior', - ), '60821bc7' => array( 'javelin-behavior', 'javelin-stratcom', @@ -1558,13 +1512,6 @@ return array( 'phabricator-keyboard-shortcut', 'javelin-stratcom', ), - '886fd850' => array( - 'javelin-install', - 'javelin-reactor-dom', - 'javelin-view-html', - 'javelin-view-interpreter', - 'javelin-view-renderer', - ), '887ad43f' => array( 'javelin-behavior', 'javelin-request', @@ -1655,11 +1602,6 @@ return array( '983751ee' => array( 'phui-inline-comment-view-css', ), - '988040b4' => array( - 'javelin-install', - 'javelin-dom', - 'javelin-reactor-dom', - ), '9a6dd75c' => array( 'javelin-behavior', 'javelin-stratcom', @@ -1697,11 +1639,6 @@ return array( 'javelin-util', 'phabricator-keyboard-shortcut', ), - 'a155550f' => array( - 'javelin-install', - 'javelin-dom', - 'javelin-reactor-dom', - ), 'a3a63478' => array( 'phui-workcard-view-css', ), @@ -1792,11 +1729,6 @@ return array( 'javelin-dom', 'phuix-dropdown-menu', ), - 'b1f0ccee' => array( - 'javelin-install', - 'javelin-dom', - 'javelin-reactor-dom', - ), 'b23b49e6' => array( 'javelin-behavior', 'javelin-dom', @@ -2013,13 +1945,6 @@ return array( 'javelin-workflow', 'phuix-icon-view', ), - 'd19198c8' => array( - 'javelin-install', - 'javelin-dom', - 'javelin-util', - 'javelin-dynval', - 'javelin-reactor-dom', - ), 'd254d646' => array( 'javelin-util', ), @@ -2029,11 +1954,6 @@ return array( 'javelin-uri', 'javelin-util', ), - 'd4a14807' => array( - 'javelin-install', - 'javelin-dom', - 'javelin-view', - ), 'd4eecc63' => array( 'javelin-behavior', 'javelin-dom', diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index aa11ace40c..7516619a01 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -1395,10 +1395,7 @@ phutil_register_library_map(array( 'HeraldTranscriptTestCase' => 'applications/herald/storage/__tests__/HeraldTranscriptTestCase.php', 'HeraldUtilityActionGroup' => 'applications/herald/action/HeraldUtilityActionGroup.php', 'Javelin' => 'infrastructure/javelin/Javelin.php', - 'JavelinReactorUIExample' => 'applications/uiexample/examples/JavelinReactorUIExample.php', - 'JavelinUIExample' => 'applications/uiexample/examples/JavelinUIExample.php', 'JavelinViewExampleServerView' => 'applications/uiexample/examples/JavelinViewExampleServerView.php', - 'JavelinViewUIExample' => 'applications/uiexample/examples/JavelinViewUIExample.php', 'LegalpadController' => 'applications/legalpad/controller/LegalpadController.php', 'LegalpadCreateDocumentsCapability' => 'applications/legalpad/capability/LegalpadCreateDocumentsCapability.php', 'LegalpadDAO' => 'applications/legalpad/storage/LegalpadDAO.php', @@ -2146,7 +2143,6 @@ phutil_register_library_map(array( 'PhabricatorBadgesTransactionComment' => 'applications/badges/storage/PhabricatorBadgesTransactionComment.php', 'PhabricatorBadgesTransactionQuery' => 'applications/badges/query/PhabricatorBadgesTransactionQuery.php', 'PhabricatorBadgesViewController' => 'applications/badges/controller/PhabricatorBadgesViewController.php', - 'PhabricatorBarePageUIExample' => 'applications/uiexample/examples/PhabricatorBarePageUIExample.php', 'PhabricatorBarePageView' => 'view/page/PhabricatorBarePageView.php', 'PhabricatorBaseURISetupCheck' => 'applications/config/check/PhabricatorBaseURISetupCheck.php', 'PhabricatorBcryptPasswordHasher' => 'infrastructure/util/password/PhabricatorBcryptPasswordHasher.php', @@ -2161,7 +2157,6 @@ phutil_register_library_map(array( 'PhabricatorBuiltinDraftEngine' => 'applications/transactions/draft/PhabricatorBuiltinDraftEngine.php', 'PhabricatorBuiltinPatchList' => 'infrastructure/storage/patch/PhabricatorBuiltinPatchList.php', 'PhabricatorBulkContentSource' => 'infrastructure/daemon/contentsource/PhabricatorBulkContentSource.php', - 'PhabricatorBusyUIExample' => 'applications/uiexample/examples/PhabricatorBusyUIExample.php', 'PhabricatorCacheDAO' => 'applications/cache/storage/PhabricatorCacheDAO.php', 'PhabricatorCacheEngine' => 'applications/system/engine/PhabricatorCacheEngine.php', 'PhabricatorCacheEngineExtension' => 'applications/system/engine/PhabricatorCacheEngineExtension.php', @@ -3030,7 +3025,6 @@ phutil_register_library_map(array( 'PhabricatorLiskFulltextEngineExtension' => 'applications/search/engineextension/PhabricatorLiskFulltextEngineExtension.php', 'PhabricatorLiskSearchEngineExtension' => 'applications/search/engineextension/PhabricatorLiskSearchEngineExtension.php', 'PhabricatorLiskSerializer' => 'infrastructure/storage/lisk/PhabricatorLiskSerializer.php', - 'PhabricatorListFilterUIExample' => 'applications/uiexample/examples/PhabricatorListFilterUIExample.php', 'PhabricatorLocalDiskFileStorageEngine' => 'applications/files/engine/PhabricatorLocalDiskFileStorageEngine.php', 'PhabricatorLocalTimeTestCase' => 'view/__tests__/PhabricatorLocalTimeTestCase.php', 'PhabricatorLocaleScopeGuard' => 'infrastructure/internationalization/scope/PhabricatorLocaleScopeGuard.php', @@ -3996,7 +3990,6 @@ phutil_register_library_map(array( 'PhabricatorSlowvoteVoteController' => 'applications/slowvote/controller/PhabricatorSlowvoteVoteController.php', 'PhabricatorSlug' => 'infrastructure/util/PhabricatorSlug.php', 'PhabricatorSlugTestCase' => 'infrastructure/util/__tests__/PhabricatorSlugTestCase.php', - 'PhabricatorSortTableUIExample' => 'applications/uiexample/examples/PhabricatorSortTableUIExample.php', 'PhabricatorSourceCodeView' => 'view/layout/PhabricatorSourceCodeView.php', 'PhabricatorSpaceEditField' => 'applications/transactions/editfield/PhabricatorSpaceEditField.php', 'PhabricatorSpacesApplication' => 'applications/spaces/application/PhabricatorSpacesApplication.php', @@ -4160,7 +4153,6 @@ phutil_register_library_map(array( 'PhabricatorTokensCurtainExtension' => 'applications/tokens/engineextension/PhabricatorTokensCurtainExtension.php', 'PhabricatorTokensSettingsPanel' => 'applications/settings/panel/PhabricatorTokensSettingsPanel.php', 'PhabricatorTokensToken' => 'applications/tokens/storage/PhabricatorTokensToken.php', - 'PhabricatorTooltipUIExample' => 'applications/uiexample/examples/PhabricatorTooltipUIExample.php', 'PhabricatorTransactionChange' => 'applications/transactions/data/PhabricatorTransactionChange.php', 'PhabricatorTransactionRemarkupChange' => 'applications/transactions/data/PhabricatorTransactionRemarkupChange.php', 'PhabricatorTransactions' => 'applications/transactions/constants/PhabricatorTransactions.php', @@ -6483,10 +6475,7 @@ phutil_register_library_map(array( 'HeraldTranscriptTestCase' => 'PhabricatorTestCase', 'HeraldUtilityActionGroup' => 'HeraldActionGroup', 'Javelin' => 'Phobject', - 'JavelinReactorUIExample' => 'PhabricatorUIExample', - 'JavelinUIExample' => 'PhabricatorUIExample', 'JavelinViewExampleServerView' => 'AphrontView', - 'JavelinViewUIExample' => 'PhabricatorUIExample', 'LegalpadController' => 'PhabricatorController', 'LegalpadCreateDocumentsCapability' => 'PhabricatorPolicyCapability', 'LegalpadDAO' => 'PhabricatorLiskDAO', @@ -7342,7 +7331,6 @@ phutil_register_library_map(array( 'PhabricatorBadgesTransactionComment' => 'PhabricatorApplicationTransactionComment', 'PhabricatorBadgesTransactionQuery' => 'PhabricatorApplicationTransactionQuery', 'PhabricatorBadgesViewController' => 'PhabricatorBadgesProfileController', - 'PhabricatorBarePageUIExample' => 'PhabricatorUIExample', 'PhabricatorBarePageView' => 'AphrontPageView', 'PhabricatorBaseURISetupCheck' => 'PhabricatorSetupCheck', 'PhabricatorBcryptPasswordHasher' => 'PhabricatorPasswordHasher', @@ -7357,7 +7345,6 @@ phutil_register_library_map(array( 'PhabricatorBuiltinDraftEngine' => 'PhabricatorDraftEngine', 'PhabricatorBuiltinPatchList' => 'PhabricatorSQLPatchList', 'PhabricatorBulkContentSource' => 'PhabricatorContentSource', - 'PhabricatorBusyUIExample' => 'PhabricatorUIExample', 'PhabricatorCacheDAO' => 'PhabricatorLiskDAO', 'PhabricatorCacheEngine' => 'Phobject', 'PhabricatorCacheEngineExtension' => 'Phobject', @@ -8358,7 +8345,6 @@ phutil_register_library_map(array( 'PhabricatorLiskFulltextEngineExtension' => 'PhabricatorFulltextEngineExtension', 'PhabricatorLiskSearchEngineExtension' => 'PhabricatorSearchEngineExtension', 'PhabricatorLiskSerializer' => 'Phobject', - 'PhabricatorListFilterUIExample' => 'PhabricatorUIExample', 'PhabricatorLocalDiskFileStorageEngine' => 'PhabricatorFileStorageEngine', 'PhabricatorLocalTimeTestCase' => 'PhabricatorTestCase', 'PhabricatorLocaleScopeGuard' => 'Phobject', @@ -9523,7 +9509,6 @@ phutil_register_library_map(array( 'PhabricatorSlowvoteVoteController' => 'PhabricatorSlowvoteController', 'PhabricatorSlug' => 'Phobject', 'PhabricatorSlugTestCase' => 'PhabricatorTestCase', - 'PhabricatorSortTableUIExample' => 'PhabricatorUIExample', 'PhabricatorSourceCodeView' => 'AphrontView', 'PhabricatorSpaceEditField' => 'PhabricatorEditField', 'PhabricatorSpacesApplication' => 'PhabricatorApplication', @@ -9704,7 +9689,6 @@ phutil_register_library_map(array( 'PhabricatorFlaggableInterface', 'PhabricatorConduitResultInterface', ), - 'PhabricatorTooltipUIExample' => 'PhabricatorUIExample', 'PhabricatorTransactionChange' => 'Phobject', 'PhabricatorTransactionRemarkupChange' => 'PhabricatorTransactionChange', 'PhabricatorTransactions' => 'Phobject', diff --git a/src/applications/uiexample/examples/JavelinReactorUIExample.php b/src/applications/uiexample/examples/JavelinReactorUIExample.php deleted file mode 100644 index 9e47545072..0000000000 --- a/src/applications/uiexample/examples/JavelinReactorUIExample.php +++ /dev/null @@ -1,95 +0,0 @@ - true), - ), - array( - pht('Reactive focus detector generates a boolean dynamic value'), - 'ReactorFocusExample', - 'phabricator-uiexample-reactor-focus', - array(), - ), - array( - pht('Reactive input box, with normal and calmed output'), - 'ReactorInputExample', - 'phabricator-uiexample-reactor-input', - array('init' => 'Initial value'), - ), - array( - pht('Reactive mouseover detector generates a boolean dynamic value'), - 'ReactorMouseoverExample', - 'phabricator-uiexample-reactor-mouseover', - array(), - ), - array( - pht('Reactive radio buttons generate a string dynamic value'), - 'ReactorRadioExample', - 'phabricator-uiexample-reactor-radio', - array(), - ), - array( - pht('Reactive select box generates a string dynamic value'), - 'ReactorSelectExample', - 'phabricator-uiexample-reactor-select', - array(), - ), - array( - pht( - '%s makes the class of an element a string dynamic value', - 'sendclass'), - 'ReactorSendClassExample', - 'phabricator-uiexample-reactor-sendclass', - array(), - ), - array( - pht( - '%s makes some properties of an object into dynamic values', - 'sendproperties'), - 'ReactorSendPropertiesExample', - 'phabricator-uiexample-reactor-sendproperties', - array(), - ), - ); - - foreach ($examples as $example) { - list($desc, $name, $resource, $params) = $example; - $template = new AphrontJavelinView(); - $template - ->setName($name) - ->setParameters($params) - ->setCelerityResource($resource); - $rows[] = array($desc, $template->render()); - } - - $table = new AphrontTableView($rows); - - $panel = new PHUIObjectBoxView(); - $panel->setHeaderText(pht('Example')); - $panel->appendChild($table); - - return $panel; - } -} diff --git a/src/applications/uiexample/examples/JavelinUIExample.php b/src/applications/uiexample/examples/JavelinUIExample.php deleted file mode 100644 index c85a2d4cde..0000000000 --- a/src/applications/uiexample/examples/JavelinUIExample.php +++ /dev/null @@ -1,66 +0,0 @@ -getRequest(); - $user = $request->getUser(); - - // toggle-class - - $container_id = celerity_generate_unique_node_id(); - $button_red_id = celerity_generate_unique_node_id(); - $button_blue_id = celerity_generate_unique_node_id(); - - $button_red = javelin_tag( - 'a', - array( - 'class' => 'button', - 'sigil' => 'jx-toggle-class', - 'href' => '#', - 'id' => $button_red_id, - 'meta' => array( - 'map' => array( - $container_id => 'jxui-red-border', - $button_red_id => 'jxui-active', - ), - ), - ), - pht('Toggle Red Border')); - - $button_blue = javelin_tag( - 'a', - array( - 'class' => 'button jxui-active', - 'sigil' => 'jx-toggle-class', - 'href' => '#', - 'id' => $button_blue_id, - 'meta' => array( - 'state' => true, - 'map' => array( - $container_id => 'jxui-blue-background', - $button_blue_id => 'jxui-active', - ), - ), - ), - pht('Toggle Blue Background')); - - $div = phutil_tag( - 'div', - array( - 'id' => $container_id, - 'class' => 'jxui-example-container jxui-blue-background', - ), - array($button_red, $button_blue)); - - return array($div); - } -} diff --git a/src/applications/uiexample/examples/JavelinViewUIExample.php b/src/applications/uiexample/examples/JavelinViewUIExample.php deleted file mode 100644 index f7df1749b4..0000000000 --- a/src/applications/uiexample/examples/JavelinViewUIExample.php +++ /dev/null @@ -1,45 +0,0 @@ -getRequest(); - - $init = $request->getStr('init'); - - $parent_server_template = new JavelinViewExampleServerView(); - - $parent_client_template = new AphrontJavelinView(); - $parent_client_template - ->setName('JavelinViewExample') - ->setCelerityResource('phabricator-uiexample-javelin-view'); - - $child_server_template = new JavelinViewExampleServerView(); - - $child_client_template = new AphrontJavelinView(); - $child_client_template - ->setName('JavelinViewExample') - ->setCelerityResource('phabricator-uiexample-javelin-view'); - - $parent_server_template->appendChild($parent_client_template); - $parent_client_template->appendChild($child_server_template); - $child_server_template->appendChild($child_client_template); - $child_client_template->appendChild(pht('Hey, it worked.')); - - $panel = new PHUIObjectBoxView(); - $panel->setHeaderText(pht('Example')); - $panel->appendChild( - phutil_tag_div('ml', $parent_server_template)); - - return $panel; - } -} diff --git a/src/applications/uiexample/examples/PhabricatorBarePageUIExample.php b/src/applications/uiexample/examples/PhabricatorBarePageUIExample.php deleted file mode 100644 index 3f377edadd..0000000000 --- a/src/applications/uiexample/examples/PhabricatorBarePageUIExample.php +++ /dev/null @@ -1,25 +0,0 @@ -appendChild( - phutil_tag( - 'h1', - array(), - $this->getDescription())); - - $response = new AphrontWebpageResponse(); - $response->setContent($view->render()); - return $response; - } -} diff --git a/src/applications/uiexample/examples/PhabricatorBusyUIExample.php b/src/applications/uiexample/examples/PhabricatorBusyUIExample.php deleted file mode 100644 index ab23e5cf79..0000000000 --- a/src/applications/uiexample/examples/PhabricatorBusyUIExample.php +++ /dev/null @@ -1,17 +0,0 @@ -setUser($this->getRequest()->getUser()); - $form - ->appendChild( - id(new AphrontFormTextControl()) - ->setLabel(pht('Query'))) - ->appendChild( - id(new AphrontFormSubmitControl()) - ->setValue(pht('Search'))); - - $filter->appendChild($form); - - - return $filter; - } -} diff --git a/src/applications/uiexample/examples/PhabricatorSortTableUIExample.php b/src/applications/uiexample/examples/PhabricatorSortTableUIExample.php deleted file mode 100644 index 113c38b92a..0000000000 --- a/src/applications/uiexample/examples/PhabricatorSortTableUIExample.php +++ /dev/null @@ -1,96 +0,0 @@ - 'Honda', - 'model' => 'Civic', - 'year' => 2004, - 'price' => 3199, - 'color' => pht('Blue'), - ), - array( - 'make' => 'Ford', - 'model' => 'Focus', - 'year' => 2001, - 'price' => 2549, - 'color' => pht('Red'), - ), - array( - 'make' => 'Toyota', - 'model' => 'Camry', - 'year' => 2009, - 'price' => 4299, - 'color' => pht('Black'), - ), - array( - 'make' => 'NASA', - 'model' => 'Shuttle', - 'year' => 1998, - 'price' => 1000000000, - 'color' => pht('White'), - ), - ); - - $request = $this->getRequest(); - - $orders = array( - 'make', - 'model', - 'year', - 'price', - ); - - $sort = $request->getStr('sort'); - list($sort, $reverse) = AphrontTableView::parseSort($sort); - if (!in_array($sort, $orders)) { - $sort = 'make'; - } - - $rows = isort($rows, $sort); - if ($reverse) { - $rows = array_reverse($rows); - } - - $table = new AphrontTableView($rows); - $table->setHeaders( - array( - pht('Make'), - pht('Model'), - pht('Year'), - pht('Price'), - pht('Color'), - )); - $table->setColumnClasses( - array( - '', - 'wide', - 'n', - 'n', - '', - )); - $table->makeSortable( - $request->getRequestURI(), - 'sort', - $sort, - $reverse, - $orders); - - $panel = new PHUIObjectBoxView(); - $panel->setHeaderText(pht('Sortable Table of Vehicles')); - $panel->setTable($table); - - return $panel; - } -} diff --git a/src/applications/uiexample/examples/PhabricatorTooltipUIExample.php b/src/applications/uiexample/examples/PhabricatorTooltipUIExample.php deleted file mode 100644 index 373161612a..0000000000 --- a/src/applications/uiexample/examples/PhabricatorTooltipUIExample.php +++ /dev/null @@ -1,102 +0,0 @@ - array( - 'tip' => 'Hi', - ), - 'lorem (north)' => array( - 'tip' => $lorem, - ), - 'lorem (east)' => array( - 'tip' => $lorem, - 'align' => 'E', - ), - 'lorem (south)' => array( - 'tip' => $lorem, - 'align' => 'S', - ), - 'lorem (west)' => array( - 'tip' => $lorem, - 'align' => 'W', - ), - 'lorem (large, north)' => array( - 'tip' => $lorem, - 'size' => 300, - ), - 'lorem (large, east)' => array( - 'tip' => $lorem, - 'size' => 300, - 'align' => 'E', - ), - 'lorem (large, west)' => array( - 'tip' => $lorem, - 'size' => 300, - 'align' => 'W', - ), - 'lorem (large, south)' => array( - 'tip' => $lorem, - 'size' => 300, - 'align' => 'S', - ), - 'overflow (north)' => array( - 'tip' => $overflow, - ), - 'overflow (east)' => array( - 'tip' => $overflow, - 'align' => 'E', - ), - 'overflow (south)' => array( - 'tip' => $overflow, - 'align' => 'S', - ), - 'overflow (west)' => array( - 'tip' => $overflow, - 'align' => 'W', - ), - ); - - $content = array(); - foreach ($metas as $key => $meta) { - $content[] = javelin_tag( - 'div', - array( - 'sigil' => 'has-tooltip', - 'meta' => $meta, - 'style' => $style, - ), - $key); - } - - return $content; - } -} diff --git a/webroot/rsrc/js/application/uiexample/JavelinViewExample.js b/webroot/rsrc/js/application/uiexample/JavelinViewExample.js deleted file mode 100644 index a8e17923b2..0000000000 --- a/webroot/rsrc/js/application/uiexample/JavelinViewExample.js +++ /dev/null @@ -1,19 +0,0 @@ -/** - * @provides phabricator-uiexample-javelin-view - * @requires javelin-install - * javelin-dom - * javelin-view - */ - -JX.install('JavelinViewExample', { - extend: 'View', - members: { - render: function(rendered_children) { - return JX.$N( - 'div', - { className: 'client-view' }, - rendered_children - ); - } - } -}); diff --git a/webroot/rsrc/js/application/uiexample/ReactorButtonExample.js b/webroot/rsrc/js/application/uiexample/ReactorButtonExample.js deleted file mode 100644 index 41982f192f..0000000000 --- a/webroot/rsrc/js/application/uiexample/ReactorButtonExample.js +++ /dev/null @@ -1,38 +0,0 @@ -/** - * @provides phabricator-uiexample-reactor-button - * @requires javelin-install - * javelin-dom - * javelin-util - * javelin-dynval - * javelin-reactor-dom - */ - -JX.install('ReactorButtonExample', { - extend: 'View', - members: { - render: function() { - var button = JX.$N('button', {}, 'Fun'); - var clicks = JX.RDOM.clickPulses(button); - - var time = JX.RDOM.time(); - - // function snapshot(pulses, dynval) { - // return new DynVal( - // pulses.transform(JX.bind(dynval, dynval.getValueNow)), - // dynval.getValueNow() - // ); - // } - // - // Below could be... - // time.snapshot(clicks) - // clicks.snapshot(time) - - var snapshot_time = new JX.DynVal( - clicks.transform(JX.bind(time, time.getValueNow)), - time.getValueNow() - ); - - return [button, JX.RDOM.$DT(snapshot_time)]; - } - } -}); diff --git a/webroot/rsrc/js/application/uiexample/ReactorCheckboxExample.js b/webroot/rsrc/js/application/uiexample/ReactorCheckboxExample.js deleted file mode 100644 index 983f6d96ab..0000000000 --- a/webroot/rsrc/js/application/uiexample/ReactorCheckboxExample.js +++ /dev/null @@ -1,17 +0,0 @@ -/** - * @provides phabricator-uiexample-reactor-checkbox - * @requires javelin-install - * javelin-dom - * javelin-reactor-dom - */ - -JX.install('ReactorCheckboxExample', { - extend: 'View', - members: { - render: function() { - var checkbox = JX.$N('input', {type: 'checkbox'}); - - return [checkbox, JX.RDOM.$DT(JX.RDOM.checkbox(checkbox))]; - } - } -}); diff --git a/webroot/rsrc/js/application/uiexample/ReactorFocusExample.js b/webroot/rsrc/js/application/uiexample/ReactorFocusExample.js deleted file mode 100644 index f4c53b2865..0000000000 --- a/webroot/rsrc/js/application/uiexample/ReactorFocusExample.js +++ /dev/null @@ -1,16 +0,0 @@ -/** - * @provides phabricator-uiexample-reactor-focus - * @requires javelin-install - * javelin-dom - * javelin-reactor-dom - */ - -JX.install('ReactorFocusExample', { - extend: 'View', - members: { - render: function() { - var input = JX.$N('input'); - return [input, JX.RDOM.$DT(JX.RDOM.hasFocus(input))]; - } - } -}); diff --git a/webroot/rsrc/js/application/uiexample/ReactorInputExample.js b/webroot/rsrc/js/application/uiexample/ReactorInputExample.js deleted file mode 100644 index 70f4c9fb70..0000000000 --- a/webroot/rsrc/js/application/uiexample/ReactorInputExample.js +++ /dev/null @@ -1,32 +0,0 @@ -/** - * @provides phabricator-uiexample-reactor-input - * @requires javelin-install - * javelin-reactor-dom - * javelin-view-html - * javelin-view-interpreter - * javelin-view-renderer - */ - -JX.install('ReactorInputExample', { - extend: 'View', - members: { - render: function() { - var html = JX.HTMLView.registerToInterpreter(new JX.ViewInterpreter()); - - var raw_input = JX.ViewRenderer.render( - html.input({ value: this.getAttr('init') }) - ); - var input = JX.RDOM.input(raw_input); - - return JX.ViewRenderer.render( - html.div( - raw_input, - html.br(), - html.span(JX.RDOM.$DT(input)), - html.br(), - html.span(JX.RDOM.$DT(input.calm(500))) - ) - ); - } - } -}); diff --git a/webroot/rsrc/js/application/uiexample/ReactorMouseoverExample.js b/webroot/rsrc/js/application/uiexample/ReactorMouseoverExample.js deleted file mode 100644 index 5f9656e2f3..0000000000 --- a/webroot/rsrc/js/application/uiexample/ReactorMouseoverExample.js +++ /dev/null @@ -1,16 +0,0 @@ -/** - * @provides phabricator-uiexample-reactor-mouseover - * @requires javelin-install - * javelin-dom - * javelin-reactor-dom - */ - -JX.install('ReactorMouseoverExample', { - extend: 'View', - members: { - render: function() { - var target = JX.$N('span', 'mouseover me '); - return [target, JX.RDOM.$DT(JX.RDOM.isMouseOver(target))]; - } - } -}); diff --git a/webroot/rsrc/js/application/uiexample/ReactorRadioExample.js b/webroot/rsrc/js/application/uiexample/ReactorRadioExample.js deleted file mode 100644 index 3e99e0e674..0000000000 --- a/webroot/rsrc/js/application/uiexample/ReactorRadioExample.js +++ /dev/null @@ -1,24 +0,0 @@ -/** - * @provides phabricator-uiexample-reactor-radio - * @requires javelin-install - * javelin-dom - * javelin-reactor-dom - */ - -JX.install('ReactorRadioExample', { - extend: 'View', - members: { - render: function() { - var radio_one = JX.$N('input', {type: 'radio', name: 'n', value: 'one'}); - var radio_two = JX.$N('input', {type: 'radio', name: 'n', value: 'two'}); - - radio_one.checked = true; - - return [ - radio_one, - radio_two, - JX.RDOM.$DT(JX.RDOM.radio([radio_one, radio_two])) - ]; - } - } -}); diff --git a/webroot/rsrc/js/application/uiexample/ReactorSelectExample.js b/webroot/rsrc/js/application/uiexample/ReactorSelectExample.js deleted file mode 100644 index 628fbed122..0000000000 --- a/webroot/rsrc/js/application/uiexample/ReactorSelectExample.js +++ /dev/null @@ -1,21 +0,0 @@ -/** - * @provides phabricator-uiexample-reactor-select - * @requires javelin-install - * javelin-dom - * javelin-reactor-dom - */ - -JX.install('ReactorSelectExample', { - extend: 'View', - members: { - render: function() { - var select = JX.$N('select', {}, [ - JX.$N('option', { value: 'goat' }, 'Goat'), - JX.$N('option', { value: 'bat' }, 'Bat'), - JX.$N('option', { value: 'duck' }, 'Duck') - ]); - - return [select, JX.RDOM.$DT(JX.RDOM.select(select))]; - } - } -}); diff --git a/webroot/rsrc/js/application/uiexample/ReactorSendClassExample.js b/webroot/rsrc/js/application/uiexample/ReactorSendClassExample.js deleted file mode 100644 index 62e44b7d0c..0000000000 --- a/webroot/rsrc/js/application/uiexample/ReactorSendClassExample.js +++ /dev/null @@ -1,18 +0,0 @@ -/** - * @provides phabricator-uiexample-reactor-sendclass - * @requires javelin-install - * javelin-dom - * javelin-reactor-dom - */ - -JX.install('ReactorSendClassExample', { - extend: 'View', - members: { - render: function() { - var input = JX.$N('input', { type: 'checkbox' }); - var span = JX.$N('a', 'Hey'); - JX.RDOM.sendClass(JX.RDOM.checkbox(input), span, 'disabled'); - return [input, span]; - } - } -}); diff --git a/webroot/rsrc/js/application/uiexample/ReactorSendPropertiesExample.js b/webroot/rsrc/js/application/uiexample/ReactorSendPropertiesExample.js deleted file mode 100644 index f297e413dc..0000000000 --- a/webroot/rsrc/js/application/uiexample/ReactorSendPropertiesExample.js +++ /dev/null @@ -1,26 +0,0 @@ -/** - * @provides phabricator-uiexample-reactor-sendproperties - * @requires javelin-install - * javelin-dom - * javelin-reactor-dom - */ - -JX.install('ReactorSendPropertiesExample', { - extend: 'View', - members: { - render: function() { - var color = JX.$N('input', {value: '#fff000'}); - var title = JX.$N('input', {value: 'seen on hover'}); - var target = JX.$N('span', 'Change my color and title'); - - JX.RDOM.sendProps(target, { - style: { - backgroundColor: JX.RDOM.input(color) - }, - title: JX.RDOM.input(title) - }); - - return [color, title, target]; - } - } -}); diff --git a/webroot/rsrc/js/application/uiexample/busy-example.js b/webroot/rsrc/js/application/uiexample/busy-example.js deleted file mode 100644 index 64ee390112..0000000000 --- a/webroot/rsrc/js/application/uiexample/busy-example.js +++ /dev/null @@ -1,9 +0,0 @@ -/** - * @provides javelin-behavior-phabricator-busy-example - * @requires phabricator-busy - * javelin-behavior - */ - -JX.behavior('phabricator-busy-example', function() { - JX.Busy.start(); -}); From 2ad521b96d39db43a86dd68acf3d0e463e632ea7 Mon Sep 17 00:00:00 2001 From: epriestley Date: Tue, 30 May 2017 16:05:03 -0700 Subject: [PATCH 14/31] Categorize UIExamples a little bit Summary: Ref M1476. I'm planning to add some PHUIX examples, but sort out the existing examples a little first. I added some categories: - Catalogs: these are what I look at most often (emoji, icons, colors). - Single use: elements with only one use (badges, feed stories, hovercards, setup issues). - Technical: examples which are really just "test this thing in the browser" (avatars, gestures, notifications, remarkup). - Other: evrything else, mostly general-purpose multi-use components. Test Plan: (See left nav.) {F4984042} Reviewers: chad Reviewed By: chad Differential Revision: https://secure.phabricator.com/D18050 --- src/__phutil_library_map__.php | 2 -- .../PhabricatorUIExampleRenderController.php | 11 ++++++++--- .../examples/JavelinViewExampleServerView.php | 14 -------------- .../uiexample/examples/MacroEmojiExample.php | 8 ++++++-- .../uiexample/examples/PHUIBadgeExample.php | 4 ++++ .../examples/PHUIColorPalletteExample.php | 4 ++++ .../uiexample/examples/PHUIFeedStoryExample.php | 6 +++++- .../uiexample/examples/PHUIHovercardUIExample.php | 4 ++++ .../uiexample/examples/PHUIIconExample.php | 4 ++++ .../PhabricatorFilesComposeAvatarExample.php | 6 +++++- .../examples/PhabricatorGestureUIExample.php | 4 ++++ .../examples/PhabricatorNotificationUIExample.php | 4 ++++ .../examples/PhabricatorRemarkupUIExample.php | 4 ++++ .../examples/PhabricatorSetupIssueUIExample.php | 4 ++++ .../uiexample/examples/PhabricatorUIExample.php | 4 ++++ 15 files changed, 60 insertions(+), 23 deletions(-) delete mode 100644 src/applications/uiexample/examples/JavelinViewExampleServerView.php diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 7516619a01..5bf2681b1f 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -1395,7 +1395,6 @@ phutil_register_library_map(array( 'HeraldTranscriptTestCase' => 'applications/herald/storage/__tests__/HeraldTranscriptTestCase.php', 'HeraldUtilityActionGroup' => 'applications/herald/action/HeraldUtilityActionGroup.php', 'Javelin' => 'infrastructure/javelin/Javelin.php', - 'JavelinViewExampleServerView' => 'applications/uiexample/examples/JavelinViewExampleServerView.php', 'LegalpadController' => 'applications/legalpad/controller/LegalpadController.php', 'LegalpadCreateDocumentsCapability' => 'applications/legalpad/capability/LegalpadCreateDocumentsCapability.php', 'LegalpadDAO' => 'applications/legalpad/storage/LegalpadDAO.php', @@ -6475,7 +6474,6 @@ phutil_register_library_map(array( 'HeraldTranscriptTestCase' => 'PhabricatorTestCase', 'HeraldUtilityActionGroup' => 'HeraldActionGroup', 'Javelin' => 'Phobject', - 'JavelinViewExampleServerView' => 'AphrontView', 'LegalpadController' => 'PhabricatorController', 'LegalpadCreateDocumentsCapability' => 'PhabricatorPolicyCapability', 'LegalpadDAO' => 'PhabricatorLiskDAO', diff --git a/src/applications/uiexample/controller/PhabricatorUIExampleRenderController.php b/src/applications/uiexample/controller/PhabricatorUIExampleRenderController.php index 6be978a6a9..025b9511b4 100644 --- a/src/applications/uiexample/controller/PhabricatorUIExampleRenderController.php +++ b/src/applications/uiexample/controller/PhabricatorUIExampleRenderController.php @@ -17,9 +17,14 @@ final class PhabricatorUIExampleRenderController extends PhabricatorController { $nav = new AphrontSideNavFilterView(); $nav->setBaseURI(new PhutilURI($this->getApplicationURI('view/'))); - foreach ($classes as $class => $obj) { - $name = $obj->getName(); - $nav->addFilter($class, $name); + $groups = mgroup($classes, 'getCategory'); + ksort($groups); + foreach ($groups as $group => $group_classes) { + $nav->addLabel($group); + foreach ($group_classes as $class => $obj) { + $name = $obj->getName(); + $nav->addFilter($class, $name); + } } $selected = $nav->selectFilter($id, head_key($classes)); diff --git a/src/applications/uiexample/examples/JavelinViewExampleServerView.php b/src/applications/uiexample/examples/JavelinViewExampleServerView.php deleted file mode 100644 index 2d59917a7c..0000000000 --- a/src/applications/uiexample/examples/JavelinViewExampleServerView.php +++ /dev/null @@ -1,14 +0,0 @@ - 'server-view', - ), - $this->renderChildren()); - } - -} diff --git a/src/applications/uiexample/examples/MacroEmojiExample.php b/src/applications/uiexample/examples/MacroEmojiExample.php index fddf20bc32..036a5a8932 100644 --- a/src/applications/uiexample/examples/MacroEmojiExample.php +++ b/src/applications/uiexample/examples/MacroEmojiExample.php @@ -3,11 +3,15 @@ final class MacroEmojiExample extends PhabricatorUIExample { public function getName() { - return pht('Emoji Support'); + return pht('Emoji'); } public function getDescription() { - return pht('Shiny happy people holding hands'); + return pht('Shiny happy people holding hands.'); + } + + public function getCategory() { + return pht('Catalogs'); } public function renderExample() { diff --git a/src/applications/uiexample/examples/PHUIBadgeExample.php b/src/applications/uiexample/examples/PHUIBadgeExample.php index 14eb3469d0..703595b76c 100644 --- a/src/applications/uiexample/examples/PHUIBadgeExample.php +++ b/src/applications/uiexample/examples/PHUIBadgeExample.php @@ -10,6 +10,10 @@ final class PHUIBadgeExample extends PhabricatorUIExample { return pht('Celebrate the moments of your life.'); } + public function getCategory() { + return pht('Single Use'); + } + public function renderExample() { $badges1 = array(); diff --git a/src/applications/uiexample/examples/PHUIColorPalletteExample.php b/src/applications/uiexample/examples/PHUIColorPalletteExample.php index 0e3193d24d..a8910b930d 100644 --- a/src/applications/uiexample/examples/PHUIColorPalletteExample.php +++ b/src/applications/uiexample/examples/PHUIColorPalletteExample.php @@ -10,6 +10,10 @@ final class PHUIColorPalletteExample extends PhabricatorUIExample { return pht('A Standard Palette of Colors for use.'); } + public function getCategory() { + return pht('Catalogs'); + } + public function renderExample() { $colors = array( diff --git a/src/applications/uiexample/examples/PHUIFeedStoryExample.php b/src/applications/uiexample/examples/PHUIFeedStoryExample.php index 375c6e42fd..0df757cada 100644 --- a/src/applications/uiexample/examples/PHUIFeedStoryExample.php +++ b/src/applications/uiexample/examples/PHUIFeedStoryExample.php @@ -8,7 +8,11 @@ final class PHUIFeedStoryExample extends PhabricatorUIExample { public function getDescription() { return pht( - 'An outlandish exaggeration of intricate tales from around the realm'); + 'An outlandish exaggeration of intricate tales from around the realm.'); + } + + public function getCategory() { + return pht('Single Use'); } public function renderExample() { diff --git a/src/applications/uiexample/examples/PHUIHovercardUIExample.php b/src/applications/uiexample/examples/PHUIHovercardUIExample.php index 8673441d09..8cdec56d68 100644 --- a/src/applications/uiexample/examples/PHUIHovercardUIExample.php +++ b/src/applications/uiexample/examples/PHUIHovercardUIExample.php @@ -12,6 +12,10 @@ final class PHUIHovercardUIExample extends PhabricatorUIExample { phutil_tag('tt', array(), 'PHUIHovercardView')); } + public function getCategory() { + return pht('Single Use'); + } + public function renderExample() { $request = $this->getRequest(); $user = $request->getUser(); diff --git a/src/applications/uiexample/examples/PHUIIconExample.php b/src/applications/uiexample/examples/PHUIIconExample.php index 1bf96ce8e5..35395fbff0 100644 --- a/src/applications/uiexample/examples/PHUIIconExample.php +++ b/src/applications/uiexample/examples/PHUIIconExample.php @@ -10,6 +10,10 @@ final class PHUIIconExample extends PhabricatorUIExample { return pht('Easily render icons or images with links and sprites.'); } + public function getCategory() { + return pht('Catalogs'); + } + private function listTransforms() { return array( 'ph-rotate-90', diff --git a/src/applications/uiexample/examples/PhabricatorFilesComposeAvatarExample.php b/src/applications/uiexample/examples/PhabricatorFilesComposeAvatarExample.php index 6ea5537f9d..57a65863db 100644 --- a/src/applications/uiexample/examples/PhabricatorFilesComposeAvatarExample.php +++ b/src/applications/uiexample/examples/PhabricatorFilesComposeAvatarExample.php @@ -3,13 +3,17 @@ final class PhabricatorFilesComposeAvatarExample extends PhabricatorUIExample { public function getName() { - return pht('Generate Avatar Images'); + return pht('Avatars'); } public function getDescription() { return pht('Tests various color palettes and sizes.'); } + public function getCategory() { + return pht('Technical'); + } + public function renderExample() { $request = $this->getRequest(); $viewer = $request->getUser(); diff --git a/src/applications/uiexample/examples/PhabricatorGestureUIExample.php b/src/applications/uiexample/examples/PhabricatorGestureUIExample.php index 1adb7dee16..2adfb795b2 100644 --- a/src/applications/uiexample/examples/PhabricatorGestureUIExample.php +++ b/src/applications/uiexample/examples/PhabricatorGestureUIExample.php @@ -14,6 +14,10 @@ final class PhabricatorGestureUIExample extends PhabricatorUIExample { phutil_tag('tt', array(), 'touchable')); } + public function getCategory() { + return pht('Technical'); + } + public function renderExample() { $id = celerity_generate_unique_node_id(); diff --git a/src/applications/uiexample/examples/PhabricatorNotificationUIExample.php b/src/applications/uiexample/examples/PhabricatorNotificationUIExample.php index 1b825693fa..5d15d884cc 100644 --- a/src/applications/uiexample/examples/PhabricatorNotificationUIExample.php +++ b/src/applications/uiexample/examples/PhabricatorNotificationUIExample.php @@ -12,6 +12,10 @@ final class PhabricatorNotificationUIExample extends PhabricatorUIExample { phutil_tag('tt', array(), 'JX.Notification')); } + public function getCategory() { + return pht('Technical'); + } + public function renderExample() { require_celerity_resource('phabricator-notification-css'); Javelin::initBehavior('phabricator-notification-example'); diff --git a/src/applications/uiexample/examples/PhabricatorRemarkupUIExample.php b/src/applications/uiexample/examples/PhabricatorRemarkupUIExample.php index 46f0262bbb..5044821d82 100644 --- a/src/applications/uiexample/examples/PhabricatorRemarkupUIExample.php +++ b/src/applications/uiexample/examples/PhabricatorRemarkupUIExample.php @@ -11,6 +11,10 @@ final class PhabricatorRemarkupUIExample extends PhabricatorUIExample { 'Demonstrates the visual appearance of various Remarkup elements.'); } + public function getCategory() { + return pht('Technical'); + } + public function renderExample() { $viewer = $this->getRequest()->getUser(); diff --git a/src/applications/uiexample/examples/PhabricatorSetupIssueUIExample.php b/src/applications/uiexample/examples/PhabricatorSetupIssueUIExample.php index e5370d30cf..d6386e59d4 100644 --- a/src/applications/uiexample/examples/PhabricatorSetupIssueUIExample.php +++ b/src/applications/uiexample/examples/PhabricatorSetupIssueUIExample.php @@ -10,6 +10,10 @@ final class PhabricatorSetupIssueUIExample extends PhabricatorUIExample { return pht('Setup errors and warnings.'); } + public function getCategory() { + return pht('Single Use'); + } + public function renderExample() { $request = $this->getRequest(); $user = $request->getUser(); diff --git a/src/applications/uiexample/examples/PhabricatorUIExample.php b/src/applications/uiexample/examples/PhabricatorUIExample.php index 5326cba3fe..7c84f6c9e4 100644 --- a/src/applications/uiexample/examples/PhabricatorUIExample.php +++ b/src/applications/uiexample/examples/PhabricatorUIExample.php @@ -17,6 +17,10 @@ abstract class PhabricatorUIExample extends Phobject { abstract public function getDescription(); abstract public function renderExample(); + public function getCategory() { + return pht('General'); + } + protected function createBasicDummyHandle($name, $type, $fullname = null, $uri = null) { From 683647f1fb9091b8928056d068be7bb954c127c9 Mon Sep 17 00:00:00 2001 From: epriestley Date: Tue, 30 May 2017 14:47:50 -0700 Subject: [PATCH 15/31] Add PHUIXButtonView and a UIExample Summary: Ref T12733. Ref M1476. This adds `PHUIXButtonView`, for client-side button rendering. It also adds a PHUIX example which renders the server and client versions of each component side-by-side so it's easier to see if they're messed up. Test Plan: {F4984128} Reviewers: chad Reviewed By: chad Maniphest Tasks: T12733 Differential Revision: https://secure.phabricator.com/D18051 --- resources/celerity/map.php | 13 ++ src/__phutil_library_map__.php | 2 + .../examples/PHUIXComponentsExample.php | 122 ++++++++++++++++++ webroot/rsrc/js/phuix/PHUIXButtonView.js | 109 ++++++++++++++++ webroot/rsrc/js/phuix/PHUIXExample.js | 65 ++++++++++ 5 files changed, 311 insertions(+) create mode 100644 src/applications/uiexample/examples/PHUIXComponentsExample.php create mode 100644 webroot/rsrc/js/phuix/PHUIXButtonView.js create mode 100644 webroot/rsrc/js/phuix/PHUIXExample.js diff --git a/resources/celerity/map.php b/resources/celerity/map.php index 56a38061a1..cbebfa5aef 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -523,7 +523,9 @@ return array( 'rsrc/js/phuix/PHUIXActionListView.js' => 'b5c256b8', 'rsrc/js/phuix/PHUIXActionView.js' => 'b3465b9b', 'rsrc/js/phuix/PHUIXAutocomplete.js' => 'f6699267', + 'rsrc/js/phuix/PHUIXButtonView.js' => 'da1c2a6b', 'rsrc/js/phuix/PHUIXDropdownMenu.js' => '8018ee50', + 'rsrc/js/phuix/PHUIXExample.js' => '68af71ca', 'rsrc/js/phuix/PHUIXFormControl.js' => '83e03671', 'rsrc/js/phuix/PHUIXIconView.js' => 'bff6884b', ), @@ -667,6 +669,7 @@ return array( 'javelin-behavior-phui-hovercards' => 'bcaccd64', 'javelin-behavior-phui-submenu' => 'a6f7a73b', 'javelin-behavior-phui-tab-group' => '0a0b10e9', + 'javelin-behavior-phuix-example' => '68af71ca', 'javelin-behavior-policy-control' => 'd0c516d5', 'javelin-behavior-policy-rule-editor' => '5e9f347c', 'javelin-behavior-project-boards' => '4250a34e', @@ -869,6 +872,7 @@ return array( 'phuix-action-list-view' => 'b5c256b8', 'phuix-action-view' => 'b3465b9b', 'phuix-autocomplete' => 'f6699267', + 'phuix-button-view' => 'da1c2a6b', 'phuix-dropdown-menu' => '8018ee50', 'phuix-form-control-view' => '83e03671', 'phuix-icon-view' => 'bff6884b', @@ -1371,6 +1375,11 @@ return array( '6882e80a' => array( 'javelin-dom', ), + '68af71ca' => array( + 'javelin-install', + 'javelin-dom', + 'phuix-button-view', + ), '69adf288' => array( 'javelin-install', ), @@ -1988,6 +1997,10 @@ return array( 'javelin-util', 'phabricator-shaped-request', ), + 'da1c2a6b' => array( + 'javelin-install', + 'javelin-dom', + ), 'de2e896f' => array( 'javelin-behavior', 'javelin-dom', diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 5bf2681b1f..13e447c48d 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -1806,6 +1806,7 @@ phutil_register_library_map(array( 'PHUIUserAvailabilityView' => 'applications/calendar/view/PHUIUserAvailabilityView.php', 'PHUIWorkboardView' => 'view/phui/PHUIWorkboardView.php', 'PHUIWorkpanelView' => 'view/phui/PHUIWorkpanelView.php', + 'PHUIXComponentsExample' => 'applications/uiexample/examples/PHUIXComponentsExample.php', 'PassphraseAbstractKey' => 'applications/passphrase/keys/PassphraseAbstractKey.php', 'PassphraseConduitAPIMethod' => 'applications/passphrase/conduit/PassphraseConduitAPIMethod.php', 'PassphraseController' => 'applications/passphrase/controller/PassphraseController.php', @@ -6938,6 +6939,7 @@ phutil_register_library_map(array( 'PHUIUserAvailabilityView' => 'AphrontTagView', 'PHUIWorkboardView' => 'AphrontTagView', 'PHUIWorkpanelView' => 'AphrontTagView', + 'PHUIXComponentsExample' => 'PhabricatorUIExample', 'PassphraseAbstractKey' => 'Phobject', 'PassphraseConduitAPIMethod' => 'ConduitAPIMethod', 'PassphraseController' => 'PhabricatorController', diff --git a/src/applications/uiexample/examples/PHUIXComponentsExample.php b/src/applications/uiexample/examples/PHUIXComponentsExample.php new file mode 100644 index 0000000000..a5c76a1e77 --- /dev/null +++ b/src/applications/uiexample/examples/PHUIXComponentsExample.php @@ -0,0 +1,122 @@ + 'fa-rocket', + ), + array( + 'icon' => 'fa-cloud', + 'color' => 'indigo', + ), + ); + + foreach ($icons as $spec) { + $icon = new PHUIIconView(); + + $icon->setIcon(idx($spec, 'icon'), idx($spec, 'color')); + + $client_id = celerity_generate_unique_node_id(); + + $server_view = $icon; + $client_view = javelin_tag( + 'div', + array( + 'id' => $client_id, + )); + + Javelin::initBehavior( + 'phuix-example', + array( + 'type' => 'icon', + 'id' => $client_id, + 'spec' => $spec, + )); + + $content[] = id(new AphrontMultiColumnView()) + ->addColumn($server_view) + ->addColumn($client_view); + } + + + $buttons = array( + array( + 'text' => pht('Submit'), + ), + array( + 'text' => pht('Activate'), + 'icon' => 'fa-rocket', + ), + array( + 'type' => PHUIButtonView::BUTTONTYPE_SIMPLE, + 'text' => pht('3 / 5 Comments'), + 'icon' => 'fa-comment', + ), + array( + 'color' => PHUIButtonView::GREEN, + 'text' => pht('Environmental!'), + ), + ); + + foreach ($buttons as $spec) { + $button = new PHUIButtonView(); + + if (idx($spec, 'text') !== null) { + $button->setText($spec['text']); + } + + if (idx($spec, 'icon') !== null) { + $button->setIcon($spec['icon']); + } + + if (idx($spec, 'type') !== null) { + $button->setButtonType($spec['type']); + } + + if (idx($spec, 'color') !== null) { + $button->setColor($spec['color']); + } + + $client_id = celerity_generate_unique_node_id(); + + $server_view = $button; + $client_view = javelin_tag( + 'div', + array( + 'id' => $client_id, + )); + + Javelin::initBehavior( + 'phuix-example', + array( + 'type' => 'button', + 'id' => $client_id, + 'spec' => $spec, + )); + + $content[] = id(new AphrontMultiColumnView()) + ->addColumn($server_view) + ->addColumn($client_view); + } + + return id(new PHUIBoxView()) + ->appendChild($content) + ->addMargin(PHUI::MARGIN_LARGE); + } +} diff --git a/webroot/rsrc/js/phuix/PHUIXButtonView.js b/webroot/rsrc/js/phuix/PHUIXButtonView.js new file mode 100644 index 0000000000..9fbefb8b1a --- /dev/null +++ b/webroot/rsrc/js/phuix/PHUIXButtonView.js @@ -0,0 +1,109 @@ +/** + * @provides phuix-button-view + * @requires javelin-install + * javelin-dom + */ +JX.install('PHUIXButtonView', { + + statics: { + BUTTONTYPE_DEFAULT: 'buttontype.default', + BUTTONTYPE_SIMPLE: 'buttontype.simple' + }, + + members: { + _node: null, + _textNode: null, + + _iconView: null, + _color: null, + _buttonType: null, + + setIcon: function(icon) { + this.getIconView().setIcon(icon); + return this; + }, + + getIconView: function() { + if (!this._iconView) { + this._iconView = new JX.PHUIXIconView(); + this._redraw(); + } + return this._iconView; + }, + + setColor: function(color) { + var node = this.getNode(); + + if (this._color) { + JX.DOM.alterClass(node, this._color, false); + } + this._color = color; + JX.DOM.alterClass(node, this._color, true); + + return this; + }, + + setButtonType: function(button_type) { + var self = JX.PHUIXButtonView; + + this._buttonType = button_type; + var node = this.getNode(); + + var is_simple = (this._buttonType == self.BUTTONTYPE_SIMPLE); + JX.DOM.alterClass(node, 'simple', is_simple); + + return this; + }, + + setText: function(text) { + JX.DOM.setContent(this._getTextNode(), text); + return this; + }, + + getNode: function() { + if (!this._node) { + var attrs = { + className: 'button' + }; + + this._node = JX.$N('button', attrs); + + this._redraw(); + } + + return this._node; + }, + + _getTextNode: function() { + if (!this._textNode) { + var attrs = { + className: 'phui-button-text' + }; + + this._textNode = JX.$N('div', attrs); + } + + return this._textNode; + }, + + _redraw: function() { + var node = this.getNode(); + + var icon = this._iconView; + var text = this._textNode; + + var content = []; + if (icon) { + content.push(icon.getNode()); + } + + if (text) { + content.push(text); + } + + JX.DOM.alterClass(node, 'has-icon', !!icon); + JX.DOM.setContent(node, content); + } + } + +}); diff --git a/webroot/rsrc/js/phuix/PHUIXExample.js b/webroot/rsrc/js/phuix/PHUIXExample.js new file mode 100644 index 0000000000..87f36b04c3 --- /dev/null +++ b/webroot/rsrc/js/phuix/PHUIXExample.js @@ -0,0 +1,65 @@ +/** + * @provides javelin-behavior-phuix-example + * @requires javelin-install + * javelin-dom + * phuix-button-view + */ + +JX.behavior('phuix-example', function(config) { + var node; + var spec; + var defaults; + + switch (config.type) { + case 'button': + var button = new JX.PHUIXButtonView(); + defaults = { + text: null, + icon: null, + type: null, + color: null + }; + + spec = JX.copy(defaults, config.spec); + + if (spec.text !== null) { + button.setText(spec.text); + } + + if (spec.icon !== null) { + button.setIcon(spec.icon); + } + + if (spec.type !== null) { + button.setButtonType(spec.type); + } + + if (spec.color !== null) { + button.setColor(spec.color); + } + + node = button.getNode(); + break; + case 'icon': + var icon = new JX.PHUIXIconView(); + defaults = { + icon: null, + color: null + }; + + spec = JX.copy(defaults, config.spec); + + if (spec.icon !== null) { + icon.setIcon(spec.icon); + } + + if (spec.color !== null) { + icon.setColor(spec.color); + } + + node = icon.getNode(); + break; + } + + JX.DOM.setContent(JX.$(config.id), node); +}); From 6295e37857085321b0490d4412c51ea914e67501 Mon Sep 17 00:00:00 2001 From: Chad Little Date: Tue, 30 May 2017 20:18:13 -0700 Subject: [PATCH 16/31] Have Browse button in History actually work Summary: Ref T12780. Makes the button do something useful, like link to the history at the right spot in the graph. Test Plan: Click on various browse buttons, get correct url. Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Maniphest Tasks: T12780 Differential Revision: https://secure.phabricator.com/D18054 --- .../diffusion/view/DiffusionHistoryListView.php | 12 +++--------- src/applications/diffusion/view/DiffusionView.php | 14 +++++++++++++- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/applications/diffusion/view/DiffusionHistoryListView.php b/src/applications/diffusion/view/DiffusionHistoryListView.php index f72bffcbe6..50713695be 100644 --- a/src/applications/diffusion/view/DiffusionHistoryListView.php +++ b/src/applications/diffusion/view/DiffusionHistoryListView.php @@ -105,13 +105,14 @@ final class DiffusionHistoryListView extends DiffusionHistoryView { } } - $browse = $this->linkBrowse( + $browse_button = $this->linkBrowse( $history->getPath(), array( 'commit' => $history->getCommitIdentifier(), 'branch' => $drequest->getBranch(), 'type' => $history->getFileType(), - )); + ), + true); $differential_view = null; if ($show_revisions && $commit) { @@ -192,13 +193,6 @@ final class DiffusionHistoryListView extends DiffusionHistoryView { ->setColor(PHUITagView::COLOR_INDIGO) ->setSlimShady(true); - $browse_button = id(new PHUIButtonView()) - ->setText(pht('Browse')) - ->setIcon('fa-code') - ->setTag('a') - ->setColor(PHUIButtonView::SIMPLE) - ->appendChild($audit_view); - $item = id(new PHUIObjectItemView()) ->setHeader($commit_desc) ->setHref($commit_link) diff --git a/src/applications/diffusion/view/DiffusionView.php b/src/applications/diffusion/view/DiffusionView.php index b615ce855c..1d89a9dbd7 100644 --- a/src/applications/diffusion/view/DiffusionView.php +++ b/src/applications/diffusion/view/DiffusionView.php @@ -58,7 +58,10 @@ abstract class DiffusionView extends AphrontView { id(new PHUIIconView())->setIcon('fa-history bluegrey')); } - final public function linkBrowse($path, array $details = array()) { + final public function linkBrowse( + $path, + array $details = array(), + $button = false) { require_celerity_resource('diffusion-icons-css'); Javelin::initBehavior('phabricator-tooltips'); @@ -111,6 +114,15 @@ abstract class DiffusionView extends AphrontView { ); } + if ($button) { + return id(new PHUIButtonView()) + ->setText(pht('Browse')) + ->setIcon('fa-code') + ->setHref($href) + ->setTag('a') + ->setButtonType(PHUIButtonView::BUTTONTYPE_SIMPLE); + } + return javelin_tag( 'a', array( From f8581f687c9b1634d7a020d11ed121a067ddefa0 Mon Sep 17 00:00:00 2001 From: Chad Little Date: Wed, 31 May 2017 17:02:36 +0000 Subject: [PATCH 17/31] Restrict green button to buttons Summary: Ref T12780. Button styles are bleeding over here on the icon, restrict to .button classes Test Plan: uiexamples. Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Maniphest Tasks: T12780 Differential Revision: https://secure.phabricator.com/D18055 --- resources/celerity/map.php | 6 +++--- webroot/rsrc/css/phui/phui-button.css | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/resources/celerity/map.php b/resources/celerity/map.php index cbebfa5aef..3da70886c5 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -9,7 +9,7 @@ return array( 'names' => array( 'conpherence.pkg.css' => 'ff161f2d', 'conpherence.pkg.js' => 'b5b51108', - 'core.pkg.css' => 'bb7f0446', + 'core.pkg.css' => 'c56695d0', 'core.pkg.js' => '1475bd91', 'darkconsole.pkg.js' => '1f9a31bc', 'differential.pkg.css' => 'a2755617', @@ -140,7 +140,7 @@ return array( 'rsrc/css/phui/phui-basic-nav-view.css' => 'a0705f53', 'rsrc/css/phui/phui-big-info-view.css' => 'bd903741', 'rsrc/css/phui/phui-box.css' => '269cbc99', - 'rsrc/css/phui/phui-button.css' => 'ccd8c6c5', + 'rsrc/css/phui/phui-button.css' => 'e14854c3', 'rsrc/css/phui/phui-chart.css' => '6bf6f78e', 'rsrc/css/phui/phui-cms.css' => '504b4b23', 'rsrc/css/phui/phui-comment-form.css' => '57af2e14', @@ -815,7 +815,7 @@ return array( 'phui-basic-nav-view-css' => 'a0705f53', 'phui-big-info-view-css' => 'bd903741', 'phui-box-css' => '269cbc99', - 'phui-button-css' => 'ccd8c6c5', + 'phui-button-css' => 'e14854c3', 'phui-calendar-css' => '477acfaa', 'phui-calendar-day-css' => '572b1893', 'phui-calendar-list-css' => '576be600', diff --git a/webroot/rsrc/css/phui/phui-button.css b/webroot/rsrc/css/phui/phui-button.css index e9d446a0ac..8b609c6cad 100644 --- a/webroot/rsrc/css/phui/phui-button.css +++ b/webroot/rsrc/css/phui/phui-button.css @@ -69,8 +69,8 @@ a.icon:visited { } button.green, -a.green, -a.green:visited { +a.green.button, +a.green.button:visited { background-color: {$green}; border-color: {$green}; background-image: linear-gradient(to bottom, #23BB5B, #139543); From f2fcafb40dde94ddf4ee22716fea74fca0334a64 Mon Sep 17 00:00:00 2001 From: epriestley Date: Tue, 30 May 2017 20:00:15 -0700 Subject: [PATCH 18/31] Help PROFESSIONAL SOFTWARE ENGINEERS copy text to their clipboard Summary: Ref T12780. I'd like 18,000 GitHub stars now please thank you Test Plan: this feature is awful Reviewers: chad Reviewed By: chad Subscribers: cspeckmim Maniphest Tasks: T12780 Differential Revision: https://secure.phabricator.com/D18053 --- resources/celerity/map.php | 13 +++-- .../uiexample/examples/PHUIButtonExample.php | 47 +++++++++++++++---- webroot/rsrc/css/core/core.css | 13 +++++ webroot/rsrc/js/core/behavior-copy.js | 43 +++++++++++++++++ 4 files changed, 105 insertions(+), 11 deletions(-) create mode 100644 webroot/rsrc/js/core/behavior-copy.js diff --git a/resources/celerity/map.php b/resources/celerity/map.php index 3da70886c5..90823f0bb8 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -9,7 +9,7 @@ return array( 'names' => array( 'conpherence.pkg.css' => 'ff161f2d', 'conpherence.pkg.js' => 'b5b51108', - 'core.pkg.css' => 'c56695d0', + 'core.pkg.css' => '0c6e11ed', 'core.pkg.js' => '1475bd91', 'darkconsole.pkg.js' => '1f9a31bc', 'differential.pkg.css' => 'a2755617', @@ -114,7 +114,7 @@ return array( 'rsrc/css/application/slowvote/slowvote.css' => 'a94b7230', 'rsrc/css/application/tokens/tokens.css' => '3d0f239e', 'rsrc/css/application/uiexample/example.css' => '528b19de', - 'rsrc/css/core/core.css' => '9f4cb463', + 'rsrc/css/core/core.css' => '23beb330', 'rsrc/css/core/remarkup.css' => 'd1a5e11e', 'rsrc/css/core/syntax.css' => 'cae95e89', 'rsrc/css/core/z-index.css' => '9d8f7c4b', @@ -474,6 +474,7 @@ return array( 'rsrc/js/core/behavior-autofocus.js' => '7319e029', 'rsrc/js/core/behavior-badge-view.js' => '8ff5e24c', 'rsrc/js/core/behavior-choose-control.js' => '327a00d1', + 'rsrc/js/core/behavior-copy.js' => 'b0b8f86d', 'rsrc/js/core/behavior-detect-timezone.js' => '4c193c96', 'rsrc/js/core/behavior-device.js' => 'bb1dd507', 'rsrc/js/core/behavior-drag-and-drop-textarea.js' => '484a6e22', @@ -644,6 +645,7 @@ return array( 'javelin-behavior-passphrase-credential-control' => '3cb0b2fc', 'javelin-behavior-phabricator-active-nav' => 'e379b58e', 'javelin-behavior-phabricator-autofocus' => '7319e029', + 'javelin-behavior-phabricator-clipboard-copy' => 'b0b8f86d', 'javelin-behavior-phabricator-file-tree' => '88236f00', 'javelin-behavior-phabricator-gesture' => '3ab51e2c', 'javelin-behavior-phabricator-gesture-example' => '558829c2', @@ -763,7 +765,7 @@ return array( 'phabricator-busy' => '59a7976a', 'phabricator-chatlog-css' => 'd295b020', 'phabricator-content-source-view-css' => '4b8b05d4', - 'phabricator-core-css' => '9f4cb463', + 'phabricator-core-css' => '23beb330', 'phabricator-countdown-css' => '16c52f5c', 'phabricator-darklog' => 'c8e1ffe3', 'phabricator-darkmessage' => 'c48cccdd', @@ -1738,6 +1740,11 @@ return array( 'javelin-dom', 'phuix-dropdown-menu', ), + 'b0b8f86d' => array( + 'javelin-behavior', + 'javelin-dom', + 'javelin-stratcom', + ), 'b23b49e6' => array( 'javelin-behavior', 'javelin-dom', diff --git a/src/applications/uiexample/examples/PHUIButtonExample.php b/src/applications/uiexample/examples/PHUIButtonExample.php index 8f2e1e57a7..fa4d317a5c 100644 --- a/src/applications/uiexample/examples/PHUIButtonExample.php +++ b/src/applications/uiexample/examples/PHUIButtonExample.php @@ -106,18 +106,49 @@ final class PHUIButtonExample extends PhabricatorUIExample { $column = array(); $icons = array( - 'Comment' => 'fa-comment', - 'Give Token' => 'fa-trophy', - 'Reverse Time' => 'fa-clock-o', - 'Implode Earth' => 'fa-exclamation-triangle red', + array( + 'text' => pht('Comment'), + 'icon' => 'fa-comment', + ), + array( + 'text' => pht('Give Token'), + 'icon' => 'fa-trophy', + ), + array( + 'text' => pht('Reverse Time'), + 'icon' => 'fa-clock-o', + ), + array( + 'text' => pht('Implode Earth'), + 'icon' => 'fa-exclamation-triangle', + ), + array( + 'text' => pht('Copy "Quack" to Clipboard'), + 'icon' => 'fa-clipboard', + 'copy' => pht('Quack'), + ), ); - foreach ($icons as $text => $icon) { - $column[] = id(new PHUIButtonView()) + foreach ($icons as $text => $spec) { + $button = id(new PHUIButtonView()) ->setTag('a') ->setColor(PHUIButtonView::GREY) - ->setIcon($icon) - ->setText($text) + ->setIcon(idx($spec, 'icon')) + ->setText(idx($spec, 'text')) ->addClass(PHUI::MARGIN_SMALL_RIGHT); + + $copy = idx($spec, 'copy'); + if ($copy !== null) { + Javelin::initBehavior('phabricator-clipboard-copy'); + + $button->addClass('clipboard-copy'); + $button->addSigil('clipboard-copy'); + $button->setMetadata( + array( + 'text' => $copy, + )); + } + + $column[] = $button; } $layout3 = id(new AphrontMultiColumnView()) diff --git a/webroot/rsrc/css/core/core.css b/webroot/rsrc/css/core/core.css index 01c4414454..d7145bb485 100644 --- a/webroot/rsrc/css/core/core.css +++ b/webroot/rsrc/css/core/core.css @@ -173,3 +173,16 @@ hr { height: 2px; background: {$sky}; } + +.clipboard-copy { + visibility: hidden; +} + +.supports-clipboard .clipboard-copy { + visibility: visible; +} + +.clipboard-buffer { + position: absolute; + left: -9999px; +} diff --git a/webroot/rsrc/js/core/behavior-copy.js b/webroot/rsrc/js/core/behavior-copy.js new file mode 100644 index 0000000000..4457f6e022 --- /dev/null +++ b/webroot/rsrc/js/core/behavior-copy.js @@ -0,0 +1,43 @@ +/** + * @provides javelin-behavior-phabricator-clipboard-copy + * @requires javelin-behavior + * javelin-dom + * javelin-stratcom + * @javelin + */ + +JX.behavior('phabricator-clipboard-copy', function() { + + if (!document.queryCommandSupported) { + return; + } + + if (!document.queryCommandSupported('copy')) { + return; + } + + JX.DOM.alterClass(document.body, 'supports-clipboard', true); + + JX.Stratcom.listen('click', 'clipboard-copy', function(e) { + e.kill(); + + var data = e.getNodeData('clipboard-copy'); + var attr = { + value: data.text || '', + className: 'clipboard-buffer' + }; + + var node = JX.$N('textarea', attr); + document.body.appendChild(node); + + try { + node.select(); + document.execCommand('copy'); + } catch (ignored) { + // Ignore any errors we hit. + } + + JX.DOM.remove(node); + }); + +}); From c001781264b47ad936badd30a3d278eefea752e3 Mon Sep 17 00:00:00 2001 From: Chad Little Date: Wed, 31 May 2017 13:11:15 -0700 Subject: [PATCH 19/31] Allow buttons to just be icons Summary: Let's buttons just be an icon, no pressure to also have text. Test Plan: UIExamples, Search, Home, Policy Controls... Probably 99% of them. Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Differential Revision: https://secure.phabricator.com/D18056 --- resources/celerity/map.php | 28 +++++++++---------- .../uiexample/examples/PHUIButtonExample.php | 12 ++++++++ .../form/control/AphrontFormPolicyControl.php | 2 +- src/view/phui/PHUIButtonView.php | 24 ++++++++++++++-- .../css/application/base/main-menu-view.css | 1 + webroot/rsrc/css/phui/phui-button.css | 14 ++-------- webroot/rsrc/js/phuix/PHUIXButtonView.js | 1 + 7 files changed, 52 insertions(+), 30 deletions(-) diff --git a/resources/celerity/map.php b/resources/celerity/map.php index 90823f0bb8..25bebbcdd0 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -9,7 +9,7 @@ return array( 'names' => array( 'conpherence.pkg.css' => 'ff161f2d', 'conpherence.pkg.js' => 'b5b51108', - 'core.pkg.css' => '0c6e11ed', + 'core.pkg.css' => 'eb39b754', 'core.pkg.js' => '1475bd91', 'darkconsole.pkg.js' => '1f9a31bc', 'differential.pkg.css' => 'a2755617', @@ -39,7 +39,7 @@ return array( 'rsrc/css/aphront/typeahead.css' => '8a84cc7d', 'rsrc/css/application/almanac/almanac.css' => 'dbb9b3af', 'rsrc/css/application/auth/auth.css' => '0877ed6e', - 'rsrc/css/application/base/main-menu-view.css' => 'de9fe8c4', + 'rsrc/css/application/base/main-menu-view.css' => '16053029', 'rsrc/css/application/base/notification-menu.css' => '6a697e43', 'rsrc/css/application/base/phui-theme.css' => '9f261c6b', 'rsrc/css/application/base/standard-page-view.css' => 'eb5b80c5', @@ -140,7 +140,7 @@ return array( 'rsrc/css/phui/phui-basic-nav-view.css' => 'a0705f53', 'rsrc/css/phui/phui-big-info-view.css' => 'bd903741', 'rsrc/css/phui/phui-box.css' => '269cbc99', - 'rsrc/css/phui/phui-button.css' => 'e14854c3', + 'rsrc/css/phui/phui-button.css' => '7ffbeee7', 'rsrc/css/phui/phui-chart.css' => '6bf6f78e', 'rsrc/css/phui/phui-cms.css' => '504b4b23', 'rsrc/css/phui/phui-comment-form.css' => '57af2e14', @@ -524,7 +524,7 @@ return array( 'rsrc/js/phuix/PHUIXActionListView.js' => 'b5c256b8', 'rsrc/js/phuix/PHUIXActionView.js' => 'b3465b9b', 'rsrc/js/phuix/PHUIXAutocomplete.js' => 'f6699267', - 'rsrc/js/phuix/PHUIXButtonView.js' => 'da1c2a6b', + 'rsrc/js/phuix/PHUIXButtonView.js' => '0f13520b', 'rsrc/js/phuix/PHUIXDropdownMenu.js' => '8018ee50', 'rsrc/js/phuix/PHUIXExample.js' => '68af71ca', 'rsrc/js/phuix/PHUIXFormControl.js' => '83e03671', @@ -783,7 +783,7 @@ return array( 'phabricator-flag-css' => 'bba8f811', 'phabricator-keyboard-shortcut' => '1ae869f2', 'phabricator-keyboard-shortcut-manager' => 'c19dd9b9', - 'phabricator-main-menu-view' => 'de9fe8c4', + 'phabricator-main-menu-view' => '16053029', 'phabricator-nav-view-css' => 'faf6a6fc', 'phabricator-notification' => 'ccf1cbf8', 'phabricator-notification-css' => '3f6c89c9', @@ -817,7 +817,7 @@ return array( 'phui-basic-nav-view-css' => 'a0705f53', 'phui-big-info-view-css' => 'bd903741', 'phui-box-css' => '269cbc99', - 'phui-button-css' => 'e14854c3', + 'phui-button-css' => '7ffbeee7', 'phui-calendar-css' => '477acfaa', 'phui-calendar-day-css' => '572b1893', 'phui-calendar-list-css' => '576be600', @@ -874,7 +874,7 @@ return array( 'phuix-action-list-view' => 'b5c256b8', 'phuix-action-view' => 'b3465b9b', 'phuix-autocomplete' => 'f6699267', - 'phuix-button-view' => 'da1c2a6b', + 'phuix-button-view' => '0f13520b', 'phuix-dropdown-menu' => '8018ee50', 'phuix-form-control-view' => '83e03671', 'phuix-icon-view' => 'bff6884b', @@ -953,6 +953,10 @@ return array( 'javelin-dom', 'javelin-router', ), + '0f13520b' => array( + 'javelin-install', + 'javelin-dom', + ), '0f764c35' => array( 'javelin-install', 'javelin-util', @@ -969,6 +973,9 @@ return array( 'javelin-dom', 'javelin-history', ), + 16053029 => array( + 'phui-theme-css', + ), '17bb8539' => array( 'javelin-behavior', 'javelin-stratcom', @@ -2004,10 +2011,6 @@ return array( 'javelin-util', 'phabricator-shaped-request', ), - 'da1c2a6b' => array( - 'javelin-install', - 'javelin-dom', - ), 'de2e896f' => array( 'javelin-behavior', 'javelin-dom', @@ -2015,9 +2018,6 @@ return array( 'javelin-typeahead-ondemand-source', 'javelin-dom', ), - 'de9fe8c4' => array( - 'phui-theme-css', - ), 'e0ec7f2f' => array( 'javelin-behavior', 'javelin-dom', diff --git a/src/applications/uiexample/examples/PHUIButtonExample.php b/src/applications/uiexample/examples/PHUIButtonExample.php index fa4d317a5c..8758264e7d 100644 --- a/src/applications/uiexample/examples/PHUIButtonExample.php +++ b/src/applications/uiexample/examples/PHUIButtonExample.php @@ -122,6 +122,18 @@ final class PHUIButtonExample extends PhabricatorUIExample { 'text' => pht('Implode Earth'), 'icon' => 'fa-exclamation-triangle', ), + array( + 'icon' => 'fa-rocket', + ), + array( + 'icon' => 'fa-clipboard', + ), + array( + 'icon' => 'fa-upload', + ), + array( + 'icon' => 'fa-street-view', + ), array( 'text' => pht('Copy "Quack" to Clipboard'), 'icon' => 'fa-clipboard', diff --git a/src/view/form/control/AphrontFormPolicyControl.php b/src/view/form/control/AphrontFormPolicyControl.php index 2ce13491af..6f343bf00e 100644 --- a/src/view/form/control/AphrontFormPolicyControl.php +++ b/src/view/form/control/AphrontFormPolicyControl.php @@ -324,7 +324,7 @@ final class AphrontFormPolicyControl extends AphrontFormControl { javelin_tag( 'a', array( - 'class' => 'grey button dropdown has-icon policy-control', + 'class' => 'grey button dropdown has-icon has-text policy-control', 'href' => '#', 'mustcapture' => true, 'sigil' => 'policy-control', diff --git a/src/view/phui/PHUIButtonView.php b/src/view/phui/PHUIButtonView.php index 0d0e0f3363..111a257108 100644 --- a/src/view/phui/PHUIButtonView.php +++ b/src/view/phui/PHUIButtonView.php @@ -174,6 +174,10 @@ final class PHUIButtonView extends AphrontTagView { $classes[] = 'has-icon'; } + if (strlen($this->text)) { + $classes[] = 'has-text'; + } + if ($this->iconFirst == false) { $classes[] = 'icon-last'; } @@ -226,10 +230,24 @@ final class PHUIButtonView extends AphrontTagView { $subtext = null; if ($this->subtext) { $subtext = phutil_tag( - 'div', array('class' => 'phui-button-subtext'), $this->subtext); + 'div', + array( + 'class' => 'phui-button-subtext', + ), + $this->subtext); + } + + if (strlen($this->text)) { + $text = phutil_tag( + 'div', + array( + 'class' => 'phui-button-text', + ), + array( + $text, + $subtext, + )); } - $text = phutil_tag( - 'div', array('class' => 'phui-button-text'), array($text, $subtext)); } $caret = null; diff --git a/webroot/rsrc/css/application/base/main-menu-view.css b/webroot/rsrc/css/application/base/main-menu-view.css index eb5cfad8c7..4de30fb8ce 100644 --- a/webroot/rsrc/css/application/base/main-menu-view.css +++ b/webroot/rsrc/css/application/base/main-menu-view.css @@ -247,6 +247,7 @@ a.phabricator-core-user-menu .caret:before { font-size: 15px; top: 4px; left: 8px; + position: absolute; } .phabricator-main-menu-search-dropdown .caret { diff --git a/webroot/rsrc/css/phui/phui-button.css b/webroot/rsrc/css/phui/phui-button.css index 8b609c6cad..cc8dce01f1 100644 --- a/webroot/rsrc/css/phui/phui-button.css +++ b/webroot/rsrc/css/phui/phui-button.css @@ -41,7 +41,7 @@ input[type="submit"] { font-weight: bold; font-size: {$normalfontsize}; display: inline-block; - padding: 4px 16px 5px; + padding: 4px 14px 5px; text-align: center; white-space: nowrap; border-radius: 3px; @@ -301,7 +301,7 @@ a.policy-control .phui-button-text { position: relative; } -.button .phui-icon-view { +.button.has-text .phui-icon-view { display: inline-block; position: absolute; top: 7px; @@ -313,10 +313,6 @@ a.policy-control .phui-button-text { right: 10px; } -.phui-button-bar .button .phui-icon-view { - left: 14px; -} - .button.has-icon .phui-button-text { margin-left: 16px; } @@ -374,12 +370,6 @@ a.policy-control .phui-button-text { border: 0; } -.phui-button-bar a.button.has-icon { - display: inline-block; - height: 18px; - width: 6px; -} - .phui-button-bar .phui-button-bar-first { border-top-right-radius: 0px; border-bottom-right-radius: 0px; diff --git a/webroot/rsrc/js/phuix/PHUIXButtonView.js b/webroot/rsrc/js/phuix/PHUIXButtonView.js index 9fbefb8b1a..67b59f24f1 100644 --- a/webroot/rsrc/js/phuix/PHUIXButtonView.js +++ b/webroot/rsrc/js/phuix/PHUIXButtonView.js @@ -102,6 +102,7 @@ JX.install('PHUIXButtonView', { } JX.DOM.alterClass(node, 'has-icon', !!icon); + JX.DOM.alterClass(node, 'has-text', !!text); JX.DOM.setContent(node, content); } } From fbb767343961b550c8df3de3d2b635c96c0a90cd Mon Sep 17 00:00:00 2001 From: Chad Little Date: Thu, 1 Jun 2017 06:47:23 -0700 Subject: [PATCH 20/31] Diffusion History List cleanup Summary: Removes the odd circle buttons, adds copy-pasta button. Test Plan: Review new layout locally. Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Differential Revision: https://secure.phabricator.com/D18057 --- .../view/DiffusionHistoryListView.php | 101 ++++-------------- 1 file changed, 22 insertions(+), 79 deletions(-) diff --git a/src/applications/diffusion/view/DiffusionHistoryListView.php b/src/applications/diffusion/view/DiffusionHistoryListView.php index 50713695be..55cda33153 100644 --- a/src/applications/diffusion/view/DiffusionHistoryListView.php +++ b/src/applications/diffusion/view/DiffusionHistoryListView.php @@ -10,19 +10,8 @@ final class DiffusionHistoryListView extends DiffusionHistoryView { require_celerity_resource('diffusion-history-css'); Javelin::initBehavior('phabricator-tooltips'); - $buildables = $this->loadBuildables( - mpull($this->getHistory(), 'getCommit')); - - $show_revisions = PhabricatorApplication::isClassInstalledForViewer( - 'PhabricatorDifferentialApplication', - $viewer); - $handles = $viewer->loadHandles($this->getRequiredHandlePHIDs()); - $show_builds = PhabricatorApplication::isClassInstalledForViewer( - 'PhabricatorHarbormasterApplication', - $this->getUser()); - $rows = array(); $ii = 0; $cur_date = 0; @@ -97,14 +86,6 @@ final class DiffusionHistoryListView extends DiffusionHistoryView { $commit_desc = phutil_tag('em', array(), pht("Importing\xE2\x80\xA6")); } - $build_view = null; - if ($show_builds) { - $buildable = idx($buildables, $commit->getPHID()); - if ($buildable !== null) { - $build_view = $this->renderBuildable($buildable); - } - } - $browse_button = $this->linkBrowse( $history->getPath(), array( @@ -114,63 +95,6 @@ final class DiffusionHistoryListView extends DiffusionHistoryView { ), true); - $differential_view = null; - if ($show_revisions && $commit) { - $d_id = idx($this->getRevisions(), $commit->getPHID()); - if ($d_id) { - $differential_view = id(new PHUIIconCircleView()) - ->setIcon('fa-gear') - ->setColor('green') - ->setState(PHUIIconCircleView::STATE_SUCCESS) - ->addSigil('has-tooltip') - ->setSize(PHUIIconCircleView::SMALL) - ->setHref('/D'.$d_id) - ->addClass('mmr') - ->setMetadata( - array( - 'tip' => 'Revision D'.$d_id, - )); - } - } - - $status = $commit->getAuditStatus(); - $icon = PhabricatorAuditCommitStatusConstants::getStatusIcon($status); - $color = PhabricatorAuditCommitStatusConstants::getStatusColor($status); - $name = PhabricatorAuditCommitStatusConstants::getStatusName($status); - $audit_view = id(new PHUIIconCircleView()) - ->setIcon('fa-code') - ->setColor($color) - ->setState($icon) - ->addSigil('has-tooltip') - ->setSize(PHUIIconCircleView::SMALL) - ->addClass('mmr') - ->setMetadata( - array( - 'tip' => $name, - )); - - if ($show_builds) { - $buildable = idx($buildables, $commit->getPHID()); - if ($buildable !== null) { - $status = $buildable->getBuildableStatus(); - $icon = HarbormasterBuildable::getBuildableStatusIcon($status); - $color = HarbormasterBuildable::getBuildableStatusColor($status); - $name = HarbormasterBuildable::getBuildableStatusName($status); - $build_view = id(new PHUIIconCircleView()) - ->setIcon('fa-recycle') - ->setColor($color) - ->setState($icon) - ->addSigil('has-tooltip') - ->setSize(PHUIIconCircleView::SMALL) - ->setHref('/'.$buildable->getMonogram()) - ->addClass('mmr') - ->setMetadata( - array( - 'tip' => $name, - )); - } - } - $message = null; $commit_link = $repository->getCommitURI( $history->getCommitIdentifier()); @@ -193,6 +117,27 @@ final class DiffusionHistoryListView extends DiffusionHistoryView { ->setColor(PHUITagView::COLOR_INDIGO) ->setSlimShady(true); + $clippy = null; + if ($commit) { + Javelin::initBehavior('phabricator-clipboard-copy'); + $clippy = id(new PHUIButtonView()) + ->setIcon('fa-clipboard') + ->setHref('#') + ->setTag('a') + ->addSigil('has-tooltip') + ->addSigil('clipboard-copy') + ->addClass('clipboard-copy') + ->addClass('mmr') + ->setButtonType(PHUIButtonView::BUTTONTYPE_SIMPLE) + ->setMetadata( + array( + 'text' => $history->getCommitIdentifier(), + 'tip' => pht('Copy'), + 'align' => 'N', + 'size' => 'auto', + )); + } + $item = id(new PHUIObjectItemView()) ->setHeader($commit_desc) ->setHref($commit_link) @@ -202,9 +147,7 @@ final class DiffusionHistoryListView extends DiffusionHistoryView { ->addAttribute($commit_tag) ->addAttribute($authored) ->setSideColumn(array( - $differential_view, - $audit_view, - $build_view, + $clippy, $browse_button, )); From 995c1503e7ef7fa8ebe067dcddd3f1ad6b58172a Mon Sep 17 00:00:00 2001 From: epriestley Date: Thu, 1 Jun 2017 07:58:10 -0700 Subject: [PATCH 21/31] Hide "X created Y, a subtask of P." feed stories again Summary: Fixes T12787. Modular Transactions don't actually support `shouldHideForFeed()`. I'll add some discussion to the task. Test Plan: Created a subtask, saw no more "X reopened Y, a subtask of P" feed story. Reviewers: chad Reviewed By: chad Maniphest Tasks: T12787 Differential Revision: https://secure.phabricator.com/D18058 --- .../maniphest/storage/ManiphestTransaction.php | 16 ++++++++++++++++ .../xaction/ManiphestTaskUnblockTransaction.php | 9 --------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/src/applications/maniphest/storage/ManiphestTransaction.php b/src/applications/maniphest/storage/ManiphestTransaction.php index e2739c1d09..6301241050 100644 --- a/src/applications/maniphest/storage/ManiphestTransaction.php +++ b/src/applications/maniphest/storage/ManiphestTransaction.php @@ -40,6 +40,22 @@ final class ManiphestTransaction return parent::shouldGenerateOldValue(); } + public function shouldHideForFeed() { + // NOTE: Modular transactions don't currently support this, and it has + // very few callsites, and it's publish-time rather than display-time. + // This should probably become a supported, display-time behavior. For + // discussion, see T12787. + + // Hide "alice created X, a task blocking Y." from feed because it + // will almost always appear adjacent to "alice created Y". + $is_new = $this->getMetadataValue('blocker.new'); + if ($is_new) { + return true; + } + + return parent::shouldHideForFeed(); + } + public function getRequiredHandlePHIDs() { $phids = parent::getRequiredHandlePHIDs(); diff --git a/src/applications/maniphest/xaction/ManiphestTaskUnblockTransaction.php b/src/applications/maniphest/xaction/ManiphestTaskUnblockTransaction.php index 905554a3a3..1c7a88dec7 100644 --- a/src/applications/maniphest/xaction/ManiphestTaskUnblockTransaction.php +++ b/src/applications/maniphest/xaction/ManiphestTaskUnblockTransaction.php @@ -9,15 +9,6 @@ final class ManiphestTaskUnblockTransaction return null; } - public function shouldHideForFeed() { - // Hide "alice created X, a task blocking Y." from feed because it - // will almost always appear adjacent to "alice created Y". - $is_new = $this->getMetadataValue('blocker.new'); - if ($is_new) { - return true; - } - } - public function getActionName() { $old = $this->getOldValue(); $new = $this->getNewValue(); From b69174a4c8f70d5f90d1cd703b27824e464ebcec Mon Sep 17 00:00:00 2001 From: epriestley Date: Thu, 1 Jun 2017 08:17:54 -0700 Subject: [PATCH 22/31] Remove non-operational `shouldHideFromFeed()` from ManiphestTaskPointsTransaction Summary: See D18018. Ref T12787. This doesn't actually work; we started publishing these stories as a side effect of converting to ModularTransactions, then I fixed the rendering. This mechanism has very few callsites and I suspect we may want to get rid of it (see T12787) so just keep publishing these stories for now. Test Plan: Changed the point value of a task, saw a feed story both before and after the patch. Reviewers: chad Reviewed By: chad Maniphest Tasks: T12787 Differential Revision: https://secure.phabricator.com/D18059 --- .../maniphest/xaction/ManiphestTaskPointsTransaction.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/applications/maniphest/xaction/ManiphestTaskPointsTransaction.php b/src/applications/maniphest/xaction/ManiphestTaskPointsTransaction.php index b1c20af9e6..8953664f27 100644 --- a/src/applications/maniphest/xaction/ManiphestTaskPointsTransaction.php +++ b/src/applications/maniphest/xaction/ManiphestTaskPointsTransaction.php @@ -17,10 +17,6 @@ final class ManiphestTaskPointsTransaction $object->setPoints($value); } - public function shouldHideForFeed() { - return true; - } - public function shouldHide() { if (!ManiphestTaskPoints::getIsEnabled()) { return true; From 0d8aba855021f666d9337a56e04d302022983677 Mon Sep 17 00:00:00 2001 From: Chad Little Date: Thu, 1 Jun 2017 12:36:20 -0700 Subject: [PATCH 23/31] Revert some changes to Diffusion History List Summary: Ref rPf2fcafb40dde94ddf4ee22716fea74fca0334a64#38208, I think this is a more usable layout. Gets rid of clippy, audit. Adds back Differential link as tag, Build Status as button. Test Plan: Faked data on this for Differential, Builds, should all work though. Test on real and fake repositories. Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Differential Revision: https://secure.phabricator.com/D18061 --- resources/celerity/map.php | 10 +-- .../view/DiffusionHistoryListView.php | 70 +++++++++++++------ .../diffusion/diffusion-history.css | 9 +++ webroot/rsrc/css/phui/phui-button.css | 32 +++++++-- 4 files changed, 86 insertions(+), 35 deletions(-) diff --git a/resources/celerity/map.php b/resources/celerity/map.php index 25bebbcdd0..fcd5a4bc50 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -9,7 +9,7 @@ return array( 'names' => array( 'conpherence.pkg.css' => 'ff161f2d', 'conpherence.pkg.js' => 'b5b51108', - 'core.pkg.css' => 'eb39b754', + 'core.pkg.css' => '38689e09', 'core.pkg.js' => '1475bd91', 'darkconsole.pkg.js' => '1f9a31bc', 'differential.pkg.css' => 'a2755617', @@ -71,7 +71,7 @@ return array( 'rsrc/css/application/differential/revision-history.css' => '0e8eb855', 'rsrc/css/application/differential/revision-list.css' => 'f3c47d33', 'rsrc/css/application/differential/table-of-contents.css' => 'ae4b7a55', - 'rsrc/css/application/diffusion/diffusion-history.css' => '4faf40cd', + 'rsrc/css/application/diffusion/diffusion-history.css' => 'de70e348', 'rsrc/css/application/diffusion/diffusion-icons.css' => 'a6a1e2ba', 'rsrc/css/application/diffusion/diffusion-readme.css' => '18bd3910', 'rsrc/css/application/diffusion/diffusion-source.css' => '750add59', @@ -140,7 +140,7 @@ return array( 'rsrc/css/phui/phui-basic-nav-view.css' => 'a0705f53', 'rsrc/css/phui/phui-big-info-view.css' => 'bd903741', 'rsrc/css/phui/phui-box.css' => '269cbc99', - 'rsrc/css/phui/phui-button.css' => '7ffbeee7', + 'rsrc/css/phui/phui-button.css' => '836844c9', 'rsrc/css/phui/phui-chart.css' => '6bf6f78e', 'rsrc/css/phui/phui-cms.css' => '504b4b23', 'rsrc/css/phui/phui-comment-form.css' => '57af2e14', @@ -565,7 +565,7 @@ return array( 'differential-revision-history-css' => '0e8eb855', 'differential-revision-list-css' => 'f3c47d33', 'differential-table-of-contents-css' => 'ae4b7a55', - 'diffusion-history-css' => '4faf40cd', + 'diffusion-history-css' => 'de70e348', 'diffusion-icons-css' => 'a6a1e2ba', 'diffusion-readme-css' => '18bd3910', 'diffusion-source-css' => '750add59', @@ -817,7 +817,7 @@ return array( 'phui-basic-nav-view-css' => 'a0705f53', 'phui-big-info-view-css' => 'bd903741', 'phui-box-css' => '269cbc99', - 'phui-button-css' => '7ffbeee7', + 'phui-button-css' => '836844c9', 'phui-calendar-css' => '477acfaa', 'phui-calendar-day-css' => '572b1893', 'phui-calendar-list-css' => '576be600', diff --git a/src/applications/diffusion/view/DiffusionHistoryListView.php b/src/applications/diffusion/view/DiffusionHistoryListView.php index 55cda33153..80ca5d76a8 100644 --- a/src/applications/diffusion/view/DiffusionHistoryListView.php +++ b/src/applications/diffusion/view/DiffusionHistoryListView.php @@ -10,8 +10,19 @@ final class DiffusionHistoryListView extends DiffusionHistoryView { require_celerity_resource('diffusion-history-css'); Javelin::initBehavior('phabricator-tooltips'); + $buildables = $this->loadBuildables( + mpull($this->getHistory(), 'getCommit')); + + $show_revisions = PhabricatorApplication::isClassInstalledForViewer( + 'PhabricatorDifferentialApplication', + $viewer); + $handles = $viewer->loadHandles($this->getRequiredHandlePHIDs()); + $show_builds = PhabricatorApplication::isClassInstalledForViewer( + 'PhabricatorHarbormasterApplication', + $this->getUser()); + $rows = array(); $ii = 0; $cur_date = 0; @@ -95,6 +106,40 @@ final class DiffusionHistoryListView extends DiffusionHistoryView { ), true); + $diff_tag = null; + if ($show_revisions && $commit) { + $d_id = idx($this->getRevisions(), $commit->getPHID()); + if ($d_id) { + $diff_tag = id(new PHUITagView()) + ->setName('D'.$d_id) + ->setType(PHUITagView::TYPE_SHADE) + ->setColor(PHUITagView::COLOR_BLUE) + ->setHref('/D'.$d_id) + ->addClass('diffusion-differential-tag') + ->setSlimShady(true); + } + } + + $build_view = null; + if ($show_builds) { + $buildable = idx($buildables, $commit->getPHID()); + if ($buildable !== null) { + $status = $buildable->getBuildableStatus(); + $icon = HarbormasterBuildable::getBuildableStatusIcon($status); + $color = HarbormasterBuildable::getBuildableStatusColor($status); + $name = HarbormasterBuildable::getBuildableStatusName($status); + $build_view = id(new PHUIButtonView()) + ->setTag('a') + ->setText($name) + ->setIcon($icon) + ->setColor($color) + ->setHref('/'.$buildable->getMonogram()) + ->addClass('mmr') + ->setButtonType(PHUIButtonView::BUTTONTYPE_SIMPLE) + ->addClass('diffusion-list-build-status'); + } + } + $message = null; $commit_link = $repository->getCommitURI( $history->getCommitIdentifier()); @@ -117,37 +162,16 @@ final class DiffusionHistoryListView extends DiffusionHistoryView { ->setColor(PHUITagView::COLOR_INDIGO) ->setSlimShady(true); - $clippy = null; - if ($commit) { - Javelin::initBehavior('phabricator-clipboard-copy'); - $clippy = id(new PHUIButtonView()) - ->setIcon('fa-clipboard') - ->setHref('#') - ->setTag('a') - ->addSigil('has-tooltip') - ->addSigil('clipboard-copy') - ->addClass('clipboard-copy') - ->addClass('mmr') - ->setButtonType(PHUIButtonView::BUTTONTYPE_SIMPLE) - ->setMetadata( - array( - 'text' => $history->getCommitIdentifier(), - 'tip' => pht('Copy'), - 'align' => 'N', - 'size' => 'auto', - )); - } - $item = id(new PHUIObjectItemView()) ->setHeader($commit_desc) ->setHref($commit_link) ->setDisabled($commit->isUnreachable()) ->setDescription($message) ->setImageURI($author_image) - ->addAttribute($commit_tag) + ->addAttribute(array($commit_tag, ' ', $diff_tag)) // For Copy Pasta ->addAttribute($authored) ->setSideColumn(array( - $clippy, + $build_view, $browse_button, )); diff --git a/webroot/rsrc/css/application/diffusion/diffusion-history.css b/webroot/rsrc/css/application/diffusion/diffusion-history.css index 43e05c8958..fd22f9b1a5 100644 --- a/webroot/rsrc/css/application/diffusion/diffusion-history.css +++ b/webroot/rsrc/css/application/diffusion/diffusion-history.css @@ -31,3 +31,12 @@ .diffusion-history-author-name a { color: {$darkbluetext}; } + +.diffusion-history-list .diffusion-differential-tag { + margin-left: 4px; +} + +a.phui-tag-view:hover.diffusion-differential-tag .phui-tag-core { + border-color: transparent; + text-decoration: underline; +} diff --git a/webroot/rsrc/css/phui/phui-button.css b/webroot/rsrc/css/phui/phui-button.css index cc8dce01f1..5b35eaa681 100644 --- a/webroot/rsrc/css/phui/phui-button.css +++ b/webroot/rsrc/css/phui/phui-button.css @@ -106,6 +106,22 @@ a.simple:visited .phui-icon-view { color: {$lightbluetext}; } +button.simple.red, +input[type="submit"].simple.red, +a.simple.red, +a.simple.red:visited { + background: #fff; + color: {$redtext}; + border: 1px solid {$sh-redborder}; +} + +button.simple.red .phui-icon-view, +input[type="submit"].simple.red .phui-icon-view, +a.simple.red .phui-icon-view, +a.simple.red:visited .phui-icon-view { + color: {$redtext}; +} + a.disabled, button.disabled, button[disabled] { @@ -145,16 +161,18 @@ button.green:hover { a.button.simple:hover, button.simple:hover { - background-color: {$lightblue}; - background-image: linear-gradient(to bottom, {$blue}, {$blue}); - color: #fff; + border-color: {$blueborder}; + background-image: none; + background-color: #fff; transition: 0s; } -a.button.simple:hover .phui-icon-view, -button.simple:hover .phui-icon-view { - color: #fff; - transition: 0.1s; +a.button.simple.red:hover, +button.simple.red:hover { + border-color: {$red}; + background-image: none; + background-color: #fff; + transition: 0s; } a.button.simple .phui-icon-view { From b9a4988df36ceac490af7a55b528c08594d75d2a Mon Sep 17 00:00:00 2001 From: epriestley Date: Thu, 1 Jun 2017 12:31:22 -0700 Subject: [PATCH 24/31] Mark "Settings" and "Nuance" as launchable applications Summary: Fixes T12790. I don't think this was actually a regression, Settings just wasn't launchable before global settings (since it had no real landing page, and the profile menu always had a link) and didn't get marked launchable once we added them. I also double-checked other un-launchable apps; Nuance is probably close enough to make launchable now while I'm in here. Test Plan: Typed "settings" into global typeahead, got settings. Reviewers: chad Reviewed By: chad Maniphest Tasks: T12790 Differential Revision: https://secure.phabricator.com/D18062 --- .../nuance/application/PhabricatorNuanceApplication.php | 5 ----- .../settings/application/PhabricatorSettingsApplication.php | 4 ---- 2 files changed, 9 deletions(-) diff --git a/src/applications/nuance/application/PhabricatorNuanceApplication.php b/src/applications/nuance/application/PhabricatorNuanceApplication.php index cd268dd95e..dc18a6585f 100644 --- a/src/applications/nuance/application/PhabricatorNuanceApplication.php +++ b/src/applications/nuance/application/PhabricatorNuanceApplication.php @@ -18,11 +18,6 @@ final class PhabricatorNuanceApplication extends PhabricatorApplication { return true; } - public function isLaunchable() { - // Try to hide this even more for now. - return false; - } - public function getBaseURI() { return '/nuance/'; } diff --git a/src/applications/settings/application/PhabricatorSettingsApplication.php b/src/applications/settings/application/PhabricatorSettingsApplication.php index d5add43d46..e5e0034e1a 100644 --- a/src/applications/settings/application/PhabricatorSettingsApplication.php +++ b/src/applications/settings/application/PhabricatorSettingsApplication.php @@ -22,10 +22,6 @@ final class PhabricatorSettingsApplication extends PhabricatorApplication { return false; } - public function isLaunchable() { - return false; - } - public function getRoutes() { $panel_pattern = '(?:page/(?P[^/]+)/(?:(?Psaved)/)?)?'; From b66bf6af9267b0ec40ab0383a1c2a914e05cac21 Mon Sep 17 00:00:00 2001 From: epriestley Date: Thu, 1 Jun 2017 10:41:57 -0700 Subject: [PATCH 25/31] When stabilizing document scroll position for diffs, stick to anchors harder Summary: Ref T12779. Try a little harder to get the autoscroll heuristic right, but also just stick to anchors if the URL has an anchor and the scroll position is near that anchor. Test Plan: - Loaded an anchored diff at a bunch of window sizes, seemed pretty sticky. - Added `usleep(100000 * mt_rand(1, 15))` to `ChangesetViewController` to make changesets load slowly and in random order, reloaded a bunch of times while scrolling around, things appeared reasonable. Reviewers: chad Reviewed By: chad Maniphest Tasks: T12779 Differential Revision: https://secure.phabricator.com/D18060 --- resources/celerity/map.php | 28 +++++++++---------- .../rsrc/js/application/diff/DiffChangeset.js | 27 ++++++++++++++++-- 2 files changed, 38 insertions(+), 17 deletions(-) diff --git a/resources/celerity/map.php b/resources/celerity/map.php index fcd5a4bc50..0bde2d3862 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -13,7 +13,7 @@ return array( 'core.pkg.js' => '1475bd91', 'darkconsole.pkg.js' => '1f9a31bc', 'differential.pkg.css' => 'a2755617', - 'differential.pkg.js' => '5bf658f0', + 'differential.pkg.js' => '9cab3335', 'diffusion.pkg.css' => 'b93d9b8c', 'diffusion.pkg.js' => '84c8f8fd', 'favicon.ico' => '30672e08', @@ -391,7 +391,7 @@ return array( 'rsrc/js/application/dashboard/behavior-dashboard-move-panels.js' => '408bf173', 'rsrc/js/application/dashboard/behavior-dashboard-query-panel-select.js' => '453c5375', 'rsrc/js/application/dashboard/behavior-dashboard-tab-panel.js' => 'd4eecc63', - 'rsrc/js/application/diff/DiffChangeset.js' => '1f6748ae', + 'rsrc/js/application/diff/DiffChangeset.js' => 'aaaf4cb5', 'rsrc/js/application/diff/DiffChangesetList.js' => '85abc805', 'rsrc/js/application/diff/DiffInline.js' => '1d17130f', 'rsrc/js/application/diff/behavior-preview-link.js' => '051c7832', @@ -770,7 +770,7 @@ return array( 'phabricator-darklog' => 'c8e1ffe3', 'phabricator-darkmessage' => 'c48cccdd', 'phabricator-dashboard-css' => 'fe5b1869', - 'phabricator-diff-changeset' => '1f6748ae', + 'phabricator-diff-changeset' => 'aaaf4cb5', 'phabricator-diff-changeset-list' => '85abc805', 'phabricator-diff-inline' => '1d17130f', 'phabricator-drag-and-drop-file-upload' => '58dea2fa', @@ -1024,17 +1024,6 @@ return array( 'javelin-uri', 'javelin-routable', ), - '1f6748ae' => array( - 'javelin-dom', - 'javelin-util', - 'javelin-stratcom', - 'javelin-install', - 'javelin-workflow', - 'javelin-router', - 'javelin-behavior-device', - 'javelin-vector', - 'phabricator-diff-inline', - ), '1f6794f6' => array( 'javelin-behavior', 'javelin-stratcom', @@ -1716,6 +1705,17 @@ return array( 'javelin-util', 'phabricator-prefab', ), + 'aaaf4cb5' => array( + 'javelin-dom', + 'javelin-util', + 'javelin-stratcom', + 'javelin-install', + 'javelin-workflow', + 'javelin-router', + 'javelin-behavior-device', + 'javelin-vector', + 'phabricator-diff-inline', + ), 'ab2f381b' => array( 'javelin-request', 'javelin-behavior', diff --git a/webroot/rsrc/js/application/diff/DiffChangeset.js b/webroot/rsrc/js/application/diff/DiffChangeset.js index 6b5ebf5317..b5ebe4ce70 100644 --- a/webroot/rsrc/js/application/diff/DiffChangeset.js +++ b/webroot/rsrc/js/application/diff/DiffChangeset.js @@ -516,14 +516,35 @@ JX.install('DiffChangeset', { var target_bot = (target_pos.y + target_dim.y); // Detect if the changeset is entirely (or, at least, almost entirely) - // above us. - var above_screen = (target_bot < old_pos.y + 128); + // above us. The height here is roughly the height of the persistent + // banner. + var above_screen = (target_bot < old_pos.y + 64); + + // If we have a URL anchor and are currently nearby, stick to it + // no matter what. + var on_target = null; + if (window.location.hash) { + try { + var anchor = JX.$(window.location.hash.replace('#', '')); + if (anchor) { + var anchor_pos = JX.$V(anchor); + if ((anchor_pos.y > old_pos.y) && + (anchor_pos.y < old_pos.y + 96)) { + on_target = anchor; + } + } + } catch (ignored) { + // If we have a bogus anchor, just ignore it. + } + } var frame = this._getContentFrame(); JX.DOM.setContent(frame, JX.$H(response.changeset)); if (this._stabilize) { - if (!near_top) { + if (on_target) { + JX.DOM.scrollToPosition(old_pos.x, JX.$V(on_target).y - 60); + } else if (!near_top) { if (near_bot || above_screen) { // Figure out how much taller the document got. var delta = (JX.Vector.getDocument().y - old_dim.y); From 9f8907ccf7f3943ee0ca846ff8712cdc32c1c72d Mon Sep 17 00:00:00 2001 From: epriestley Date: Thu, 1 Jun 2017 13:00:16 -0700 Subject: [PATCH 26/31] Make Owners behavior when multiple packages own the same path with different dominion rules more consistent Summary: Fixes T12789. See that task for discussion. Currently, when multiple packages own the same path but have different dominion rules we get some weird/aribtrary/inconsistent results. Instead, implement these rules: - If zero or more weak and one or more strong packages claim a path, the strong packages (exactly) all own it. - If one or more weak packages and zero strong packages claim a path, the weak packages all own it. The major change here is that instead of keeping the //first// weak package we run into, we keep all the weak packages with the longest claim that we run into. This needs to be implemented twice because Owners has two different near-copies of this logic, only one of which has test coverage. Some day maybe this will get fixed. Test Plan: - Added failing unit tests, made them pass. - Viewed all A/B strong/weak combinations in Diffusion, saw sensible ownership results. Reviewers: chad, lvital Reviewed By: lvital Subscribers: lvital Maniphest Tasks: T12789 Differential Revision: https://secure.phabricator.com/D18064 --- .../query/PhabricatorOwnersPackageQuery.php | 29 +++++- .../storage/PhabricatorOwnersPackage.php | 55 +++++++++--- .../PhabricatorOwnersPackageTestCase.php | 89 +++++++++++++++++++ 3 files changed, 156 insertions(+), 17 deletions(-) diff --git a/src/applications/owners/query/PhabricatorOwnersPackageQuery.php b/src/applications/owners/query/PhabricatorOwnersPackageQuery.php index a1c10cd5e9..ce411aad35 100644 --- a/src/applications/owners/query/PhabricatorOwnersPackageQuery.php +++ b/src/applications/owners/query/PhabricatorOwnersPackageQuery.php @@ -398,13 +398,36 @@ final class PhabricatorOwnersPackageQuery } } + // At each strength level, drop weak packages if there are also strong + // packages of the same strength. + $strength_map = igroup($matches, 'strength'); + foreach ($strength_map as $strength => $package_list) { + $any_strong = false; + foreach ($package_list as $package_id => $package) { + if (!$package['weak']) { + $any_strong = true; + break; + } + } + if ($any_strong) { + foreach ($package_list as $package_id => $package) { + if ($package['weak']) { + unset($matches[$package_id]); + } + } + } + } + $matches = isort($matches, 'strength'); $matches = array_reverse($matches); - $first_id = null; + $strongest = null; foreach ($matches as $package_id => $match) { - if ($first_id === null) { - $first_id = $package_id; + if ($strongest === null) { + $strongest = $match['strength']; + } + + if ($match['strength'] === $strongest) { continue; } diff --git a/src/applications/owners/storage/PhabricatorOwnersPackage.php b/src/applications/owners/storage/PhabricatorOwnersPackage.php index 2b22a7a145..5f7b4f28c1 100644 --- a/src/applications/owners/storage/PhabricatorOwnersPackage.php +++ b/src/applications/owners/storage/PhabricatorOwnersPackage.php @@ -297,27 +297,54 @@ final class PhabricatorOwnersPackage // a more specific package. if ($weak) { foreach ($path_packages as $match => $packages) { + + // Group packages by length. + $length_map = array(); + foreach ($packages as $package_id => $package) { + $length_map[$package['length']][$package_id] = $package; + } + + // For each path length, remove all weak packages if there are any + // strong packages of the same length. This makes sure that if there + // are one or more strong claims on a particular path, only those + // claims stand. + foreach ($length_map as $package_list) { + $any_strong = false; + foreach ($package_list as $package_id => $package) { + if (!isset($weak[$package_id])) { + $any_strong = true; + break; + } + } + + if ($any_strong) { + foreach ($package_list as $package_id => $package) { + if (isset($weak[$package_id])) { + unset($packages[$package_id]); + } + } + } + } + $packages = isort($packages, 'length'); $packages = array_reverse($packages, true); - $first = null; + $best_length = null; foreach ($packages as $package_id => $package) { - // If this is the first package we've encountered, note it and - // continue. We're iterating over the packages from longest to - // shortest match, so this package always has the strongest claim - // on the path. - if ($first === null) { - $first = $package_id; + // If this is the first package we've encountered, note its length. + // We're iterating over the packages from longest to shortest match, + // so packages of this length always have the best claim on the path. + if ($best_length === null) { + $best_length = $package['length']; + } + + // If this package has the same length as the best length, its claim + // stands. + if ($package['length'] === $best_length) { continue; } - // If this is the first package we saw, its claim stands even if it - // is a weak package. - if ($first === $package_id) { - continue; - } - - // If this is a weak package and not the first package we saw, + // If this is a weak package and does not have the best length, // cede its claim to the stronger package. if (isset($weak[$package_id])) { unset($packages[$package_id]); diff --git a/src/applications/owners/storage/__tests__/PhabricatorOwnersPackageTestCase.php b/src/applications/owners/storage/__tests__/PhabricatorOwnersPackageTestCase.php index 7d24fc6e8d..f21f09b44e 100644 --- a/src/applications/owners/storage/__tests__/PhabricatorOwnersPackageTestCase.php +++ b/src/applications/owners/storage/__tests__/PhabricatorOwnersPackageTestCase.php @@ -100,6 +100,95 @@ final class PhabricatorOwnersPackageTestCase extends PhabricatorTestCase { PhabricatorOwnersPackage::findLongestPathsPerPackage($rows, $paths)); + // Test cases where multiple packages own the same path, with various + // dominion rules. + + $main_c = 'src/applications/main/main.c'; + + $rules = array( + // All claims strong. + array( + PhabricatorOwnersPackage::DOMINION_STRONG, + PhabricatorOwnersPackage::DOMINION_STRONG, + PhabricatorOwnersPackage::DOMINION_STRONG, + ), + // All claims weak. + array( + PhabricatorOwnersPackage::DOMINION_WEAK, + PhabricatorOwnersPackage::DOMINION_WEAK, + PhabricatorOwnersPackage::DOMINION_WEAK, + ), + // Mixture of strong and weak claims, strong first. + array( + PhabricatorOwnersPackage::DOMINION_STRONG, + PhabricatorOwnersPackage::DOMINION_STRONG, + PhabricatorOwnersPackage::DOMINION_WEAK, + ), + // Mixture of strong and weak claims, weak first. + array( + PhabricatorOwnersPackage::DOMINION_WEAK, + PhabricatorOwnersPackage::DOMINION_STRONG, + PhabricatorOwnersPackage::DOMINION_STRONG, + ), + ); + + foreach ($rules as $rule_idx => $rule) { + $rows = array( + array( + 'id' => 1, + 'excluded' => 0, + 'dominion' => $rule[0], + 'path' => $main_c, + ), + array( + 'id' => 2, + 'excluded' => 0, + 'dominion' => $rule[1], + 'path' => $main_c, + ), + array( + 'id' => 3, + 'excluded' => 0, + 'dominion' => $rule[2], + 'path' => $main_c, + ), + ); + + $paths = array( + $main_c => $pvalue, + ); + + // If one or more packages have strong dominion, they should own the + // path. If not, all the packages with weak dominion should own the + // path. + $strong = array(); + $weak = array(); + foreach ($rule as $idx => $dominion) { + if ($dominion == PhabricatorOwnersPackage::DOMINION_STRONG) { + $strong[] = $idx + 1; + } else { + $weak[] = $idx + 1; + } + } + + if ($strong) { + $expect = $strong; + } else { + $expect = $weak; + } + + $expect = array_fill_keys($expect, strlen($main_c)); + $actual = PhabricatorOwnersPackage::findLongestPathsPerPackage( + $rows, + $paths); + + ksort($actual); + + $this->assertEqual( + $expect, + $actual, + pht('Ruleset "%s" for Identical Ownership', $rule_idx)); + } } } From b8ad999d50f6d7e28f2e2f76e453675f09335069 Mon Sep 17 00:00:00 2001 From: Chad Little Date: Thu, 1 Jun 2017 13:30:00 -0700 Subject: [PATCH 27/31] Move simple buttons, bar to own CSS file Summary: - Add a simple green button... maybe don't need - Fix tokenizer search icon - Splite simple and button-bar into own files Test Plan: uiexamples, various pages with buttons, diffusion Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Differential Revision: https://secure.phabricator.com/D18063 --- resources/celerity/map.php | 30 +++-- resources/celerity/packages.php | 1 + src/view/phui/PHUIButtonBarView.php | 2 +- src/view/phui/PHUIButtonView.php | 1 + webroot/rsrc/css/aphront/tokenizer.css | 1 + .../rsrc/css/phui/button/phui-button-bar.css | 61 +++++++++ .../css/phui/button/phui-button-simple.css | 105 +++++++++++++++ .../css/phui/{ => button}/phui-button.css | 123 ------------------ 8 files changed, 191 insertions(+), 133 deletions(-) create mode 100644 webroot/rsrc/css/phui/button/phui-button-bar.css create mode 100644 webroot/rsrc/css/phui/button/phui-button-simple.css rename webroot/rsrc/css/phui/{ => button}/phui-button.css (68%) diff --git a/resources/celerity/map.php b/resources/celerity/map.php index 0bde2d3862..c78cd104c5 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -9,7 +9,7 @@ return array( 'names' => array( 'conpherence.pkg.css' => 'ff161f2d', 'conpherence.pkg.js' => 'b5b51108', - 'core.pkg.css' => '38689e09', + 'core.pkg.css' => 'e8d63571', 'core.pkg.js' => '1475bd91', 'darkconsole.pkg.js' => '1f9a31bc', 'differential.pkg.css' => 'a2755617', @@ -33,7 +33,7 @@ return array( 'rsrc/css/aphront/panel-view.css' => '8427b78d', 'rsrc/css/aphront/phabricator-nav-view.css' => 'faf6a6fc', 'rsrc/css/aphront/table-view.css' => '34cf86b4', - 'rsrc/css/aphront/tokenizer.css' => '9a8cb501', + 'rsrc/css/aphront/tokenizer.css' => '15d5ff71', 'rsrc/css/aphront/tooltip.css' => '173b9431', 'rsrc/css/aphront/typeahead-browse.css' => '4f82e510', 'rsrc/css/aphront/typeahead.css' => '8a84cc7d', @@ -124,6 +124,9 @@ return array( 'rsrc/css/font/phui-font-icon-base.css' => '870a7360', 'rsrc/css/layout/phabricator-filetree-view.css' => 'fccf9f82', 'rsrc/css/layout/phabricator-source-code-view.css' => '4383192f', + 'rsrc/css/phui/button/phui-button-bar.css' => '39fe680c', + 'rsrc/css/phui/button/phui-button-simple.css' => 'd410596b', + 'rsrc/css/phui/button/phui-button.css' => '9f13ddcc', 'rsrc/css/phui/calendar/phui-calendar-day.css' => '572b1893', 'rsrc/css/phui/calendar/phui-calendar-list.css' => '576be600', 'rsrc/css/phui/calendar/phui-calendar-month.css' => '8e10e92c', @@ -140,7 +143,6 @@ return array( 'rsrc/css/phui/phui-basic-nav-view.css' => 'a0705f53', 'rsrc/css/phui/phui-big-info-view.css' => 'bd903741', 'rsrc/css/phui/phui-box.css' => '269cbc99', - 'rsrc/css/phui/phui-button.css' => '836844c9', 'rsrc/css/phui/phui-chart.css' => '6bf6f78e', 'rsrc/css/phui/phui-cms.css' => '504b4b23', 'rsrc/css/phui/phui-comment-form.css' => '57af2e14', @@ -539,7 +541,7 @@ return array( 'aphront-multi-column-view-css' => '84cc6640', 'aphront-panel-view-css' => '8427b78d', 'aphront-table-view-css' => '34cf86b4', - 'aphront-tokenizer-control-css' => '9a8cb501', + 'aphront-tokenizer-control-css' => '15d5ff71', 'aphront-tooltip-css' => '173b9431', 'aphront-typeahead-control-css' => '8a84cc7d', 'application-search-view-css' => '66ee5d46', @@ -817,7 +819,9 @@ return array( 'phui-basic-nav-view-css' => 'a0705f53', 'phui-big-info-view-css' => 'bd903741', 'phui-box-css' => '269cbc99', - 'phui-button-css' => '836844c9', + 'phui-button-bar-css' => '39fe680c', + 'phui-button-css' => '9f13ddcc', + 'phui-button-simple-css' => 'd410596b', 'phui-calendar-css' => '477acfaa', 'phui-calendar-day-css' => '572b1893', 'phui-calendar-list-css' => '576be600', @@ -973,6 +977,10 @@ return array( 'javelin-dom', 'javelin-history', ), + '15d5ff71' => array( + 'aphront-typeahead-control-css', + 'phui-tag-view-css', + ), 16053029 => array( 'phui-theme-css', ), @@ -1102,6 +1110,10 @@ return array( 'javelin-dom', 'javelin-vector', ), + '39fe680c' => array( + 'phui-button-css', + 'phui-button-simple-css', + ), '3ab51e2c' => array( 'javelin-behavior', 'javelin-behavior-device', @@ -1618,10 +1630,6 @@ return array( 'phuix-icon-view', 'javelin-behavior-phabricator-gesture', ), - '9a8cb501' => array( - 'aphront-typeahead-control-css', - 'phui-tag-view-css', - ), '9bbf3762' => array( 'javelin-behavior', 'javelin-dom', @@ -1971,6 +1979,9 @@ return array( 'd254d646' => array( 'javelin-util', ), + 'd410596b' => array( + 'phui-button-css', + ), 'd4505101' => array( 'javelin-stratcom', 'javelin-install', @@ -2177,6 +2188,7 @@ return array( 'phabricator-core-css', 'phabricator-zindex-css', 'phui-button-css', + 'phui-button-simple-css', 'phui-theme-css', 'phabricator-standard-page-view', 'aphront-dialog-view-css', diff --git a/resources/celerity/packages.php b/resources/celerity/packages.php index e756e696cb..abbf1d77e2 100644 --- a/resources/celerity/packages.php +++ b/resources/celerity/packages.php @@ -93,6 +93,7 @@ return array( 'phabricator-core-css', 'phabricator-zindex-css', 'phui-button-css', + 'phui-button-simple-css', 'phui-theme-css', 'phabricator-standard-page-view', 'aphront-dialog-view-css', diff --git a/src/view/phui/PHUIButtonBarView.php b/src/view/phui/PHUIButtonBarView.php index add91bbc8f..78443929d8 100644 --- a/src/view/phui/PHUIButtonBarView.php +++ b/src/view/phui/PHUIButtonBarView.php @@ -29,7 +29,7 @@ final class PHUIButtonBarView extends AphrontTagView { } protected function getTagContent() { - require_celerity_resource('phui-button-css'); + require_celerity_resource('phui-button-bar-css'); $i = 1; $j = count($this->buttons); diff --git a/src/view/phui/PHUIButtonView.php b/src/view/phui/PHUIButtonView.php index 111a257108..fff6b089e4 100644 --- a/src/view/phui/PHUIButtonView.php +++ b/src/view/phui/PHUIButtonView.php @@ -154,6 +154,7 @@ final class PHUIButtonView extends AphrontTagView { protected function getTagAttributes() { require_celerity_resource('phui-button-css'); + require_celerity_resource('phui-button-simple-css'); $classes = array(); $classes[] = 'button'; diff --git a/webroot/rsrc/css/aphront/tokenizer.css b/webroot/rsrc/css/aphront/tokenizer.css index 7116ce3ace..3f3f904e22 100644 --- a/webroot/rsrc/css/aphront/tokenizer.css +++ b/webroot/rsrc/css/aphront/tokenizer.css @@ -181,4 +181,5 @@ a.jx-tokenizer-token-invalid:hover { .button.tokenizer-browse-button .phui-icon-view { top: 7px; left: 9px; + position: absolute; } diff --git a/webroot/rsrc/css/phui/button/phui-button-bar.css b/webroot/rsrc/css/phui/button/phui-button-bar.css new file mode 100644 index 0000000000..17de25e808 --- /dev/null +++ b/webroot/rsrc/css/phui/button/phui-button-bar.css @@ -0,0 +1,61 @@ +/** + * @provides phui-button-bar-css + * @requires phui-button-css + * @requires phui-button-simple-css + */ + +.phui-button-bar-borderless .button { + border: 0; + background-color: transparent; + background-image: none; + padding-left: 10px; + padding-right: 10px; +} + +.phui-button-bar-borderless .button .phui-icon-view { + font-size: 15px; + color: rgba({$alphagrey},.4); +} + +.phui-button-bar-borderless .button:hover { + background-color: transparent; + background-image: none; + border-radius: 3px; +} + +.phui-button-bar-borderless .button:hover .phui-icon-view { + color: rgba({$alphagrey},.9); +} + +.phui-button-bar-borderless .button { + border: 0; +} + +.phui-button-bar .phui-button-bar-first { + border-top-right-radius: 0px; + border-bottom-right-radius: 0px; +} + +.phui-button-bar .phui-button-bar-middle { + border-radius: 0; + border-left: none; +} + +.phui-button-bar .phui-button-bar-last { + border-left: none; + border-top-left-radius: 0px; + border-bottom-left-radius: 0px; +} + +.phui-button-bar .button.simple:hover { + border-color: {$lightblueborder}; + background-color: #fff; + background-image: none; + color: {$sky}; +} + +.phui-button-bar .button.simple:hover .phui-icon-view { + border-color: {$lightblueborder}; + color: {$sky}; + background-image: none; +} diff --git a/webroot/rsrc/css/phui/button/phui-button-simple.css b/webroot/rsrc/css/phui/button/phui-button-simple.css new file mode 100644 index 0000000000..f631604936 --- /dev/null +++ b/webroot/rsrc/css/phui/button/phui-button-simple.css @@ -0,0 +1,105 @@ +/** + * @provides phui-button-simple-css + * @requires phui-button-css + */ + + +/* - Basic -------------------------------------------------------------------*/ + +button.simple, +input[type="submit"].simple, +a.simple, +a.simple:visited { + background: #fff; + color: {$bluetext}; + border: 1px solid {$lightblueborder}; +} + +button.simple .phui-icon-view, +input[type="submit"].simple .phui-icon-view, +a.simple .phui-icon-view, +a.simple:visited .phui-icon-view { + color: {$lightbluetext}; +} + +a.button.simple:hover, +button.simple:hover { + border-color: {$blueborder}; + background-image: none; + background-color: #fff; + transition: 0s; +} + +a.simple.current { + background: {$lightblue}; +} + + +/* - Red --------------------------------------------------------------------*/ + +button.simple.red, +input[type="submit"].simple.red, +a.simple.red, +a.simple.red:visited { + background: #fff; + color: {$redtext}; + border: 1px solid {$sh-redborder}; +} + +button.simple.red .phui-icon-view, +input[type="submit"].simple.red .phui-icon-view, +a.simple.red .phui-icon-view, +a.simple.red:visited .phui-icon-view { + color: {$redtext}; +} + +a.button.simple.red:hover, +button.simple.red:hover { + border-color: {$red}; + background-image: none; + background-color: #fff; + transition: 0s; +} + +/* - Green ------------------------------------------------------------------*/ + +button.simple.green, +input[type="submit"].simple.green, +a.simple.green, +a.simple.green:visited { + background: #fff; + color: {$greentext}; + border: 1px solid {$sh-greenborder}; +} + +button.simple.green .phui-icon-view, +input[type="submit"].simple.green .phui-icon-view, +a.simple.green .phui-icon-view, +a.simple.green:visited .phui-icon-view { + color: {$greentext}; +} + +a.button.simple.green:hover, +button.simple.green:hover { + border-color: {$green}; + background-image: none; + background-color: #fff; + transition: 0s; +} + + +/* - Misc -------------------------------------------------------------------*/ + +a.button.simple .phui-icon-view { + border: none; +} + +a.button.simple.phuix-dropdown-open { + background-color: #fff; + color: {$blue}; + box-shadow: none; +} + +a.button.simple.phuix-dropdown-open:hover .phui-icon-view { + color: {$blue}; +} diff --git a/webroot/rsrc/css/phui/phui-button.css b/webroot/rsrc/css/phui/button/phui-button.css similarity index 68% rename from webroot/rsrc/css/phui/phui-button.css rename to webroot/rsrc/css/phui/button/phui-button.css index 5b35eaa681..d8183febd2 100644 --- a/webroot/rsrc/css/phui/phui-button.css +++ b/webroot/rsrc/css/phui/button/phui-button.css @@ -86,42 +86,6 @@ a.grey:visited { color: {$darkgreytext}; } -button.simple, -input[type="submit"].simple, -a.simple, -a.simple:visited { - background: #fff; - color: {$bluetext}; - border: 1px solid {$lightblueborder}; -} - -a.simple.current { - background: {$lightblue}; -} - -button.simple .phui-icon-view, -input[type="submit"].simple .phui-icon-view, -a.simple .phui-icon-view, -a.simple:visited .phui-icon-view { - color: {$lightbluetext}; -} - -button.simple.red, -input[type="submit"].simple.red, -a.simple.red, -a.simple.red:visited { - background: #fff; - color: {$redtext}; - border: 1px solid {$sh-redborder}; -} - -button.simple.red .phui-icon-view, -input[type="submit"].simple.red .phui-icon-view, -a.simple.red .phui-icon-view, -a.simple.red:visited .phui-icon-view { - color: {$redtext}; -} - a.disabled, button.disabled, button[disabled] { @@ -159,36 +123,6 @@ button.green:hover { transition: 0.1s; } -a.button.simple:hover, -button.simple:hover { - border-color: {$blueborder}; - background-image: none; - background-color: #fff; - transition: 0s; -} - -a.button.simple.red:hover, -button.simple.red:hover { - border-color: {$red}; - background-image: none; - background-color: #fff; - transition: 0s; -} - -a.button.simple .phui-icon-view { - border: none; -} - -a.button.simple.phuix-dropdown-open { - background-color: #fff; - color: {$blue}; - box-shadow: none; -} - -a.button.simple.phuix-dropdown-open:hover .phui-icon-view { - color: {$blue}; -} - body a.button.disabled:hover, body button.disabled:hover, body a.button.disabled:active, @@ -359,60 +293,3 @@ a.policy-control .phui-button-text { font-weight: normal; } -/* PHUI Button Bar */ - -.phui-button-bar-borderless .button { - border: 0; - background-color: transparent; - background-image: none; - padding-left: 10px; - padding-right: 10px; -} - -.phui-button-bar-borderless .button .phui-icon-view { - font-size: 15px; - color: rgba({$alphagrey},.4); -} - -.phui-button-bar-borderless .button:hover { - background-color: transparent; - background-image: none; - border-radius: 3px; -} - -.phui-button-bar-borderless .button:hover .phui-icon-view { - color: rgba({$alphagrey},.9); -} - -.phui-button-bar-borderless .button { - border: 0; -} - -.phui-button-bar .phui-button-bar-first { - border-top-right-radius: 0px; - border-bottom-right-radius: 0px; -} - -.phui-button-bar .phui-button-bar-middle { - border-radius: 0; - border-left: none; -} - -.phui-button-bar .phui-button-bar-last { - border-left: none; - border-top-left-radius: 0px; - border-bottom-left-radius: 0px; -} - -.phui-button-bar .button.simple:hover { - border-color: {$lightblueborder}; - background-color: #fff; - background-image: none; - color: {$sky}; -} - -.phui-button-bar .button.simple:hover .phui-icon-view { - border-color: {$lightblueborder}; - color: {$sky}; - background-image: none; -} From d42d69aef6993d126428ba29e4ba9d8794ba2485 Mon Sep 17 00:00:00 2001 From: epriestley Date: Fri, 2 Jun 2017 04:02:56 -0700 Subject: [PATCH 28/31] Clean up some PHUI/PHUIX button behaviors Summary: Ref T12733. Some minor issues: - The `strlen(...)` test against `$this->text` fails if a caller does something like `setText(array(...))`. This is rare, but used in `DiffusionBrowseController`, from D15487. - Add PHUIX examples for icon-only buttons. - Remove unused `SIMPLE` constant now that no callsites remain. Test Plan: - Viewed a directory in Diffusion's "Browse" view in a Git repository, no longer saw a warning / error log. - Viewed PHUIX Components UI examples. - Grepped for `::SIMPLE`. Reviewers: chad Reviewed By: chad Maniphest Tasks: T12733 Differential Revision: https://secure.phabricator.com/D18065 --- .../examples/PHUIXComponentsExample.php | 17 +++++++++++++++++ src/view/phui/PHUIButtonView.php | 5 ++--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/applications/uiexample/examples/PHUIXComponentsExample.php b/src/applications/uiexample/examples/PHUIXComponentsExample.php index a5c76a1e77..0b6d90f28f 100644 --- a/src/applications/uiexample/examples/PHUIXComponentsExample.php +++ b/src/applications/uiexample/examples/PHUIXComponentsExample.php @@ -72,6 +72,23 @@ final class PHUIXComponentsExample extends PhabricatorUIExample { 'color' => PHUIButtonView::GREEN, 'text' => pht('Environmental!'), ), + array( + 'icon' => 'fa-cog', + ), + array( + 'icon' => 'fa-cog', + 'type' => PHUIButtonView::BUTTONTYPE_SIMPLE, + ), + array( + 'text' => array('2 + 2', ' ', '=', ' ', '4'), + ), + array( + 'color' => PHUIButtonView::GREY, + 'text' => pht('Cancel'), + ), + array( + 'text' => array(''), + ), ); foreach ($buttons as $spec) { diff --git a/src/view/phui/PHUIButtonView.php b/src/view/phui/PHUIButtonView.php index fff6b089e4..2e269bd9af 100644 --- a/src/view/phui/PHUIButtonView.php +++ b/src/view/phui/PHUIButtonView.php @@ -5,7 +5,6 @@ final class PHUIButtonView extends AphrontTagView { const GREEN = 'green'; const GREY = 'grey'; const DISABLED = 'disabled'; - const SIMPLE = 'simple'; const SMALL = 'small'; const BIG = 'big'; @@ -175,7 +174,7 @@ final class PHUIButtonView extends AphrontTagView { $classes[] = 'has-icon'; } - if (strlen($this->text)) { + if ($this->text !== null) { $classes[] = 'has-text'; } @@ -238,7 +237,7 @@ final class PHUIButtonView extends AphrontTagView { $this->subtext); } - if (strlen($this->text)) { + if ($this->text !== null) { $text = phutil_tag( 'div', array( From 335c3a7d12bdcbf9a88454de7db8d7895b98cfbb Mon Sep 17 00:00:00 2001 From: epriestley Date: Fri, 2 Jun 2017 04:37:11 -0700 Subject: [PATCH 29/31] In commit history list view, show all commits Summary: Currently, the last group of commits is not shown in the list view because the final `$list` is never added to `$view`. For example, if the first page would contain commits from "April 7", "April 6", and "April 5", commits from "April 5" are not shown. (If a repository has 100 commits in a single day, nothing is shown.) On this server, here's the bottom of page 1: {F4987087} Here's the top of page 2: {F4987088} However, here's `git log` between those commits: ``` $ git log --oneline 7e46^..5f49f 5f49f9c793 Add sound to logged out Conpherence 1644b45050 Disperse task subpriorities in blocks c6a7bcfe89 Make Pholio description behave as a remarkup field (e.g., subscribe mentioned users) bbc5f79227 Make membership lock/unlock feed stories read more naturally 789d57522b Make editing project images redirect to "Manage" more consistently 10b3879232 Make Project slug/hashtag transactions render a little more nicely abd791889c Update Maniphest title transaction again 5a34b299e4 Update Maniphest title language 601622013d Clarify milestone/subproject creation language c9889e3d55 Fix an issue in Phriction where moving a document just copied it instead fdf00f6df4 Clean up some minor UI behaviors in Differential 6c46f27d98 Add quest objectives to the minimap d783299a19 Fix Phriction status not set property on new document 93e28da76e Add more "disabled" UI to PHUIObjectItemView 7e46d7ab6a Migrate Project color to modular transactions ``` This group of commits does not currently appear anywhere in the list. Test Plan: Viewed a page of commits, saw 100 commits. Reviewers: chad Reviewed By: chad Differential Revision: https://secure.phabricator.com/D18066 --- .../diffusion/view/DiffusionHistoryListView.php | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/applications/diffusion/view/DiffusionHistoryListView.php b/src/applications/diffusion/view/DiffusionHistoryListView.php index 80ca5d76a8..486955c4d0 100644 --- a/src/applications/diffusion/view/DiffusionHistoryListView.php +++ b/src/applications/diffusion/view/DiffusionHistoryListView.php @@ -26,19 +26,12 @@ final class DiffusionHistoryListView extends DiffusionHistoryView { $rows = array(); $ii = 0; $cur_date = 0; - $list = null; $header = null; $view = array(); foreach ($this->getHistory() as $history) { $epoch = $history->getEpoch(); $new_date = date('Ymd', $history->getEpoch()); if ($cur_date != $new_date) { - if ($list) { - $view[] = id(new PHUIObjectBoxView()) - ->setHeader($header) - ->setBackground(PHUIObjectBoxView::BLUE_PROPERTY) - ->setObjectList($list); - } $date = ucfirst( phabricator_relative_date($history->getEpoch(), $viewer)); $header = id(new PHUIHeaderView()) @@ -46,6 +39,11 @@ final class DiffusionHistoryListView extends DiffusionHistoryView { $list = id(new PHUIObjectItemListView()) ->setFlush(true) ->addClass('diffusion-history-list'); + + $view[] = id(new PHUIObjectBoxView()) + ->setHeader($header) + ->setBackground(PHUIObjectBoxView::BLUE_PROPERTY) + ->setObjectList($list); } if ($epoch) { From 5335f29ff237d8b61d7f83e23e9df26ce19c2505 Mon Sep 17 00:00:00 2001 From: epriestley Date: Fri, 2 Jun 2017 04:47:59 -0700 Subject: [PATCH 30/31] Correct an issue where the commit list could group commits by server time Summary: Commits in the list are grouped by the date they occurred in server time. This may not be the date they occurred in client time. Use client time, not server time, to group commits. Test Plan: - Set server timezone to "Asia/Famagusta". - Set client timezone to "America/Los_Angeles". - Viewed Phabricator repository history. Here's what it looks like before the change: {F4987094} Note that the headers of the first two groups both say "Yesterday". This is because the first commits in each group occurred on June 1 and June 2, respectively, in Famagusta, but both occurred on June 1 in Los Angeles. Here's what it looks like after the change: {F4987095} Reviewers: chad Reviewed By: chad Differential Revision: https://secure.phabricator.com/D18067 --- .../diffusion/view/DiffusionHistoryListView.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/applications/diffusion/view/DiffusionHistoryListView.php b/src/applications/diffusion/view/DiffusionHistoryListView.php index 486955c4d0..533e15d644 100644 --- a/src/applications/diffusion/view/DiffusionHistoryListView.php +++ b/src/applications/diffusion/view/DiffusionHistoryListView.php @@ -23,15 +23,12 @@ final class DiffusionHistoryListView extends DiffusionHistoryView { 'PhabricatorHarbormasterApplication', $this->getUser()); - $rows = array(); - $ii = 0; - $cur_date = 0; - $header = null; + $cur_date = null; $view = array(); foreach ($this->getHistory() as $history) { $epoch = $history->getEpoch(); - $new_date = date('Ymd', $history->getEpoch()); - if ($cur_date != $new_date) { + $new_date = phabricator_date($history->getEpoch(), $viewer); + if ($cur_date !== $new_date) { $date = ucfirst( phabricator_relative_date($history->getEpoch(), $viewer)); $header = id(new PHUIHeaderView()) From 0a3b3911360694ee4d29a6905b05a925d03bbcf9 Mon Sep 17 00:00:00 2001 From: Chad Little Date: Fri, 2 Jun 2017 17:32:39 +0000 Subject: [PATCH 31/31] Add more simple button colors Summary: Saturate the color a little more, add yellow Test Plan: uiexamples Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Differential Revision: https://secure.phabricator.com/D18068 --- resources/celerity/map.php | 12 +++--- .../uiexample/examples/PHUIButtonExample.php | 18 +++++---- .../css/phui/button/phui-button-simple.css | 38 ++++++++++++++++--- 3 files changed, 49 insertions(+), 19 deletions(-) diff --git a/resources/celerity/map.php b/resources/celerity/map.php index c78cd104c5..702bc0e609 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -9,7 +9,7 @@ return array( 'names' => array( 'conpherence.pkg.css' => 'ff161f2d', 'conpherence.pkg.js' => 'b5b51108', - 'core.pkg.css' => 'e8d63571', + 'core.pkg.css' => 'ea94e844', 'core.pkg.js' => '1475bd91', 'darkconsole.pkg.js' => '1f9a31bc', 'differential.pkg.css' => 'a2755617', @@ -125,7 +125,7 @@ return array( 'rsrc/css/layout/phabricator-filetree-view.css' => 'fccf9f82', 'rsrc/css/layout/phabricator-source-code-view.css' => '4383192f', 'rsrc/css/phui/button/phui-button-bar.css' => '39fe680c', - 'rsrc/css/phui/button/phui-button-simple.css' => 'd410596b', + 'rsrc/css/phui/button/phui-button-simple.css' => '081cfeea', 'rsrc/css/phui/button/phui-button.css' => '9f13ddcc', 'rsrc/css/phui/calendar/phui-calendar-day.css' => '572b1893', 'rsrc/css/phui/calendar/phui-calendar-list.css' => '576be600', @@ -821,7 +821,7 @@ return array( 'phui-box-css' => '269cbc99', 'phui-button-bar-css' => '39fe680c', 'phui-button-css' => '9f13ddcc', - 'phui-button-simple-css' => 'd410596b', + 'phui-button-simple-css' => '081cfeea', 'phui-calendar-css' => '477acfaa', 'phui-calendar-day-css' => '572b1893', 'phui-calendar-list-css' => '576be600', @@ -936,6 +936,9 @@ return array( 'javelin-stratcom', 'javelin-workflow', ), + '081cfeea' => array( + 'phui-button-css', + ), '0825c27a' => array( 'javelin-behavior', 'javelin-dom', @@ -1979,9 +1982,6 @@ return array( 'd254d646' => array( 'javelin-util', ), - 'd410596b' => array( - 'phui-button-css', - ), 'd4505101' => array( 'javelin-stratcom', 'javelin-install', diff --git a/src/applications/uiexample/examples/PHUIButtonExample.php b/src/applications/uiexample/examples/PHUIButtonExample.php index 8758264e7d..aed5d5bf08 100644 --- a/src/applications/uiexample/examples/PHUIButtonExample.php +++ b/src/applications/uiexample/examples/PHUIButtonExample.php @@ -175,15 +175,19 @@ final class PHUIButtonExample extends PhabricatorUIExample { $designs = array( PHUIButtonView::BUTTONTYPE_SIMPLE, ); + $colors = array('', 'red', 'green', 'yellow'); $column = array(); foreach ($designs as $design) { - foreach ($icons as $text => $icon) { - $column[] = id(new PHUIButtonView()) - ->setTag('a') - ->setButtonType($design) - ->setIcon($icon) - ->setText($text) - ->addClass(PHUI::MARGIN_SMALL_RIGHT); + foreach ($colors as $color) { + foreach ($icons as $text => $icon) { + $column[] = id(new PHUIButtonView()) + ->setTag('a') + ->setButtonType($design) + ->setColor($color) + ->setIcon($icon) + ->setText($text) + ->addClass(PHUI::MARGIN_SMALL_RIGHT); + } } } diff --git a/webroot/rsrc/css/phui/button/phui-button-simple.css b/webroot/rsrc/css/phui/button/phui-button-simple.css index f631604936..fa0a8d11b2 100644 --- a/webroot/rsrc/css/phui/button/phui-button-simple.css +++ b/webroot/rsrc/css/phui/button/phui-button-simple.css @@ -41,7 +41,7 @@ button.simple.red, input[type="submit"].simple.red, a.simple.red, a.simple.red:visited { - background: #fff; + background: {$sh-redbackground}; color: {$redtext}; border: 1px solid {$sh-redborder}; } @@ -55,9 +55,9 @@ a.simple.red:visited .phui-icon-view { a.button.simple.red:hover, button.simple.red:hover { - border-color: {$red}; + border-color: {$sh-redtext}; background-image: none; - background-color: #fff; + background-color: {$sh-redbackground}; transition: 0s; } @@ -67,7 +67,7 @@ button.simple.green, input[type="submit"].simple.green, a.simple.green, a.simple.green:visited { - background: #fff; + background: {$sh-greenbackground}; color: {$greentext}; border: 1px solid {$sh-greenborder}; } @@ -81,9 +81,35 @@ a.simple.green:visited .phui-icon-view { a.button.simple.green:hover, button.simple.green:hover { - border-color: {$green}; + border-color: {$sh-greentext}; background-image: none; - background-color: #fff; + background-color: {$sh-greenbackground}; + transition: 0s; +} + +/* - Yellow -----------------------------------------------------------------*/ + +button.simple.yellow, +input[type="submit"].simple.yellow, +a.simple.yellow, +a.simple.yellow:visited { + background-color: {$sh-yellowbackground}; + color: {$sh-yellowtext}; + border: 1px solid {$sh-yellowborder}; +} + +button.simple.yellow .phui-icon-view, +input[type="submit"].simple.yellow .phui-icon-view, +a.simple.yellow .phui-icon-view, +a.simple.yellow:visited .phui-icon-view { + color: {$sh-yellowicon}; +} + +a.button.simple.yellow:hover, +button.simple.yellow:hover { + border-color: {$sh-yellowtext}; + background-image: none; + background-color: {$sh-yellowbackground}; transition: 0s; }