From 6a11d8d0d12eae0565e57f65b685fb4606d06109 Mon Sep 17 00:00:00 2001 From: epriestley Date: Tue, 14 Feb 2012 16:23:53 -0800 Subject: [PATCH] Reduce size of "Unbreak Now" and "Needs Triage" panels when no action is required Summary: Make these things like 1/4th the size if they aren't actionable. Test Plan: Loaded home page with actionable, unactionable panels. Reviewers: btrahan Reviewed By: btrahan CC: aran, epriestley Differential Revision: https://secure.phabricator.com/D1613 --- src/__celerity_resource_map__.php | 102 +++++++++--------- src/__phutil_library_map__.php | 2 + .../PhabricatorDirectoryMainController.php | 30 +++--- .../directory/controller/main/__init__.php | 1 + .../layout/minipanel/AphrontMiniPanelView.php | 28 +++++ src/view/layout/minipanel/__init__.php | 12 +++ webroot/rsrc/css/aphront/panel-view.css | 12 +++ 7 files changed, 124 insertions(+), 63 deletions(-) create mode 100644 src/view/layout/minipanel/AphrontMiniPanelView.php create mode 100644 src/view/layout/minipanel/__init__.php diff --git a/src/__celerity_resource_map__.php b/src/__celerity_resource_map__.php index ac1aa99985..76d042af86 100644 --- a/src/__celerity_resource_map__.php +++ b/src/__celerity_resource_map__.php @@ -108,7 +108,7 @@ celerity_register_resource_map(array( ), 'aphront-panel-view-css' => array( - 'uri' => '/res/f4157618/rsrc/css/aphront/panel-view.css', + 'uri' => '/res/b7ba1078/rsrc/css/aphront/panel-view.css', 'type' => 'css', 'requires' => array( @@ -330,6 +330,17 @@ celerity_register_resource_map(array( ), 'disk' => '/rsrc/js/javelin/lib/behavior.js', ), + 0 => + array( + 'uri' => '/res/b6096fdd/rsrc/js/javelin/lib/__tests__/URI.js', + 'type' => 'js', + 'requires' => + array( + 0 => 'javelin-uri', + 1 => 'javelin-php-serializer', + ), + 'disk' => '/rsrc/js/javelin/lib/__tests__/URI.js', + ), 'javelin-behavior-aphront-basic-tokenizer' => array( 'uri' => '/res/9be30797/rsrc/js/application/core/behavior-tokenizer.js', @@ -1479,17 +1490,6 @@ celerity_register_resource_map(array( ), 'disk' => '/rsrc/css/application/profile/profile-header-view.css', ), - 0 => - array( - 'uri' => '/res/b6096fdd/rsrc/js/javelin/lib/__tests__/URI.js', - 'type' => 'js', - 'requires' => - array( - 0 => 'javelin-uri', - 1 => 'javelin-php-serializer', - ), - 'disk' => '/rsrc/js/javelin/lib/__tests__/URI.js', - ), 'phabricator-remarkup-css' => array( 'uri' => '/res/39f358b8/rsrc/css/core/remarkup.css', @@ -1729,6 +1729,30 @@ celerity_register_resource_map(array( 'uri' => '/res/pkg/03ef179e/diffusion.pkg.css', 'type' => 'css', ), + '2729c1c6' => + array( + 'name' => 'core.pkg.css', + 'symbols' => + array( + 0 => 'phabricator-core-css', + 1 => 'phabricator-core-buttons-css', + 2 => 'phabricator-standard-page-view', + 3 => 'aphront-dialog-view-css', + 4 => 'aphront-form-view-css', + 5 => 'aphront-panel-view-css', + 6 => 'aphront-side-nav-view-css', + 7 => 'aphront-table-view-css', + 8 => 'aphront-crumbs-view-css', + 9 => 'aphront-tokenizer-control-css', + 10 => 'aphront-typeahead-control-css', + 11 => 'aphront-list-filter-view-css', + 12 => 'phabricator-directory-css', + 13 => 'phabricator-remarkup-css', + 14 => 'syntax-highlighting-css', + ), + 'uri' => '/res/pkg/2729c1c6/core.pkg.css', + 'type' => 'css', + ), '46547a92' => array( 'name' => 'core.pkg.js', @@ -1763,30 +1787,6 @@ celerity_register_resource_map(array( 'uri' => '/res/pkg/540effd7/typeahead.pkg.js', 'type' => 'js', ), - '775f5bae' => - array( - 'name' => 'core.pkg.css', - 'symbols' => - array( - 0 => 'phabricator-core-css', - 1 => 'phabricator-core-buttons-css', - 2 => 'phabricator-standard-page-view', - 3 => 'aphront-dialog-view-css', - 4 => 'aphront-form-view-css', - 5 => 'aphront-panel-view-css', - 6 => 'aphront-side-nav-view-css', - 7 => 'aphront-table-view-css', - 8 => 'aphront-crumbs-view-css', - 9 => 'aphront-tokenizer-control-css', - 10 => 'aphront-typeahead-control-css', - 11 => 'aphront-list-filter-view-css', - 12 => 'phabricator-directory-css', - 13 => 'phabricator-remarkup-css', - 14 => 'syntax-highlighting-css', - ), - 'uri' => '/res/pkg/775f5bae/core.pkg.css', - 'type' => 'css', - ), '80580cea' => array( 'name' => 'differential.pkg.css', @@ -1854,16 +1854,16 @@ celerity_register_resource_map(array( ), 'reverse' => array( - 'aphront-crumbs-view-css' => '775f5bae', - 'aphront-dialog-view-css' => '775f5bae', - 'aphront-form-view-css' => '775f5bae', + 'aphront-crumbs-view-css' => '2729c1c6', + 'aphront-dialog-view-css' => '2729c1c6', + 'aphront-form-view-css' => '2729c1c6', 'aphront-headsup-action-list-view-css' => '80580cea', - 'aphront-list-filter-view-css' => '775f5bae', - 'aphront-panel-view-css' => '775f5bae', - 'aphront-side-nav-view-css' => '775f5bae', - 'aphront-table-view-css' => '775f5bae', - 'aphront-tokenizer-control-css' => '775f5bae', - 'aphront-typeahead-control-css' => '775f5bae', + 'aphront-list-filter-view-css' => '2729c1c6', + 'aphront-panel-view-css' => '2729c1c6', + 'aphront-side-nav-view-css' => '2729c1c6', + 'aphront-table-view-css' => '2729c1c6', + 'aphront-tokenizer-control-css' => '2729c1c6', + 'aphront-typeahead-control-css' => '2729c1c6', 'differential-changeset-view-css' => '80580cea', 'differential-core-view-css' => '80580cea', 'differential-inline-comment-editor' => 'ef420ead', @@ -1912,16 +1912,16 @@ celerity_register_resource_map(array( 'javelin-vector' => 'b164acea', 'javelin-workflow' => '46547a92', 'phabricator-content-source-view-css' => '80580cea', - 'phabricator-core-buttons-css' => '775f5bae', - 'phabricator-core-css' => '775f5bae', - 'phabricator-directory-css' => '775f5bae', + 'phabricator-core-buttons-css' => '2729c1c6', + 'phabricator-core-css' => '2729c1c6', + 'phabricator-directory-css' => '2729c1c6', 'phabricator-drag-and-drop-file-upload' => 'ef420ead', 'phabricator-keyboard-shortcut' => '46547a92', 'phabricator-keyboard-shortcut-manager' => '46547a92', 'phabricator-object-selector-css' => '80580cea', - 'phabricator-remarkup-css' => '775f5bae', + 'phabricator-remarkup-css' => '2729c1c6', 'phabricator-shaped-request' => 'ef420ead', - 'phabricator-standard-page-view' => '775f5bae', - 'syntax-highlighting-css' => '775f5bae', + 'phabricator-standard-page-view' => '2729c1c6', + 'syntax-highlighting-css' => '2729c1c6', ), )); diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index a7d1492631..8103052c22 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -59,6 +59,7 @@ phutil_register_library_map(array( 'AphrontJavelinView' => 'view/javelin-view', 'AphrontKeyboardShortcutsAvailableView' => 'view/widget/keyboardshortcuts', 'AphrontListFilterView' => 'view/layout/listfilter', + 'AphrontMiniPanelView' => 'view/layout/minipanel', 'AphrontMySQLDatabaseConnection' => 'storage/connection/mysql', 'AphrontMySQLDatabaseConnectionTestCase' => 'storage/connection/mysql/__tests__', 'AphrontNullView' => 'view/null', @@ -885,6 +886,7 @@ phutil_register_library_map(array( 'AphrontJavelinView' => 'AphrontView', 'AphrontKeyboardShortcutsAvailableView' => 'AphrontView', 'AphrontListFilterView' => 'AphrontView', + 'AphrontMiniPanelView' => 'AphrontView', 'AphrontMySQLDatabaseConnection' => 'AphrontDatabaseConnection', 'AphrontMySQLDatabaseConnectionTestCase' => 'PhabricatorTestCase', 'AphrontNullView' => 'AphrontView', diff --git a/src/applications/directory/controller/main/PhabricatorDirectoryMainController.php b/src/applications/directory/controller/main/PhabricatorDirectoryMainController.php index 2017b4ac31..e0f8676ea3 100644 --- a/src/applications/directory/controller/main/PhabricatorDirectoryMainController.php +++ b/src/applications/directory/controller/main/PhabricatorDirectoryMainController.php @@ -65,10 +65,6 @@ class PhabricatorDirectoryMainController $user = $this->getRequest()->getUser(); $user_phid = $user->getPHID(); - $panel = new AphrontPanelView(); - $panel->setHeader('Unbreak Now!'); - $panel->setCaption('Open tasks with "Unbreak Now!" priority.'); - $task_query = new ManiphestTaskQuery(); $task_query->withStatus(ManiphestTaskQuery::STATUS_OPEN); $task_query->withPriority(ManiphestTaskPriority::PRIORITY_UNBREAK_NOW); @@ -78,6 +74,9 @@ class PhabricatorDirectoryMainController $tasks = $task_query->execute(); if ($tasks) { + $panel = new AphrontPanelView(); + $panel->setHeader('Unbreak Now!'); + $panel->setCaption('Open tasks with "Unbreak Now!" priority.'); $panel->addButton( phutil_render_tag( 'a', @@ -89,8 +88,11 @@ class PhabricatorDirectoryMainController $panel->appendChild($this->buildTaskListView($tasks)); } else { + $panel = new AphrontMiniPanelView(); $panel->appendChild( - '

Nothing appears to be critically broken right now.

'); + '

No "Unbreak Now!" Tasks: '. + 'Nothing appears to be critically broken right now.

'); + $panel = '
'.$panel->render(); } return $panel; @@ -100,12 +102,6 @@ class PhabricatorDirectoryMainController $user = $this->getRequest()->getUser(); $user_phid = $user->getPHID(); - $panel = new AphrontPanelView(); - $panel->setHeader('Needs Triage'); - $panel->setCaption( - 'Open tasks with "Needs Triage" priority in '. - 'projects you are a member of.'); - $task_query = new ManiphestTaskQuery(); $task_query->withStatus(ManiphestTaskQuery::STATUS_OPEN); $task_query->withPriority(ManiphestTaskPriority::PRIORITY_TRIAGE); @@ -116,6 +112,12 @@ class PhabricatorDirectoryMainController $tasks = $task_query->execute(); if ($tasks) { + $panel = new AphrontPanelView(); + $panel->setHeader('Needs Triage'); + $panel->setCaption( + 'Open tasks with "Needs Triage" priority in '. + 'projects you are a member of.'); + $panel->addButton( phutil_render_tag( 'a', @@ -128,7 +130,11 @@ class PhabricatorDirectoryMainController 'View All Triage ('.$task_query->getRowCount().") \xC2\xBB")); $panel->appendChild($this->buildTaskListView($tasks)); } else { - $panel->appendChild('

No tasks in your projects need triage.

'); + $panel = new AphrontMiniPanelView(); + $panel->appendChild( + '

No "Needs Triage" Tasks: '. + 'No tasks in projects you are a member of '. + 'need triage.

'); } return $panel; diff --git a/src/applications/directory/controller/main/__init__.php b/src/applications/directory/controller/main/__init__.php index 88fcc28d03..cef30ecd4d 100644 --- a/src/applications/directory/controller/main/__init__.php +++ b/src/applications/directory/controller/main/__init__.php @@ -17,6 +17,7 @@ phutil_require_module('phabricator', 'applications/maniphest/query'); phutil_require_module('phabricator', 'applications/maniphest/view/tasklist'); phutil_require_module('phabricator', 'applications/phid/handle/data'); phutil_require_module('phabricator', 'applications/project/query/project'); +phutil_require_module('phabricator', 'view/layout/minipanel'); phutil_require_module('phabricator', 'view/layout/panel'); phutil_require_module('phutil', 'markup'); diff --git a/src/view/layout/minipanel/AphrontMiniPanelView.php b/src/view/layout/minipanel/AphrontMiniPanelView.php new file mode 100644 index 0000000000..6fb0501c27 --- /dev/null +++ b/src/view/layout/minipanel/AphrontMiniPanelView.php @@ -0,0 +1,28 @@ +'. + $this->renderChildren(). + ''; + } + +} diff --git a/src/view/layout/minipanel/__init__.php b/src/view/layout/minipanel/__init__.php new file mode 100644 index 0000000000..fac65f28e2 --- /dev/null +++ b/src/view/layout/minipanel/__init__.php @@ -0,0 +1,12 @@ +