diff --git a/src/__celerity_resource_map__.php b/src/__celerity_resource_map__.php index ba7ff0c8af..b4c3c87315 100644 --- a/src/__celerity_resource_map__.php +++ b/src/__celerity_resource_map__.php @@ -16,6 +16,15 @@ celerity_register_resource_map(array( ), 'disk' => '/rsrc/css/aphront/attached-file-view.css', ), + 'aphront-contextbar-view-css' => + array( + 'uri' => '/res/3e2f3045/rsrc/css/aphront/context-bar.css', + 'type' => 'css', + 'requires' => + array( + ), + 'disk' => '/rsrc/css/aphront/context-bar.css', + ), 'aphront-crumbs-view-css' => array( 'uri' => '/res/9009e6bd/rsrc/css/aphront/crumbs-view.css', @@ -625,6 +634,17 @@ celerity_register_resource_map(array( ), 'disk' => '/rsrc/js/application/maniphest/behavior-transaction-preview.js', ), + 0 => + array( + 'uri' => '/res/1da00bfe/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-owners-path-editor' => array( 'uri' => '/res/9cf78ffc/rsrc/js/application/owners/owners-path-editor.js', @@ -649,6 +669,33 @@ celerity_register_resource_map(array( ), 'disk' => '/rsrc/js/application/core/behavior-keyboard-shortcuts.js', ), + 'javelin-behavior-phabricator-object-selector' => + array( + 'uri' => '/res/34f9a11e/rsrc/js/application/core/behavior-object-selector.js', + 'type' => 'js', + 'requires' => + array( + 0 => 'javelin-behavior', + 1 => 'javelin-dom', + 2 => 'javelin-request', + 3 => 'javelin-util', + 4 => 'javelin-stratcom', + ), + 'disk' => '/rsrc/js/application/core/behavior-object-selector.js', + ), + 'javelin-behavior-phabricator-watch-anchor' => + array( + 'uri' => '/res/bb6fa5b2/rsrc/js/application/core/behavior-watch-anchor.js', + 'type' => 'js', + 'requires' => + array( + 0 => 'javelin-behavior', + 1 => 'javelin-stratcom', + 2 => 'javelin-util', + 3 => 'javelin-dom', + ), + 'disk' => '/rsrc/js/application/core/behavior-watch-anchor.js', + ), 'javelin-behavior-phriction-document-preview' => array( 'uri' => '/res/f1665ecd/rsrc/js/application/phriction/phriction-document-preview.js', @@ -680,44 +727,6 @@ celerity_register_resource_map(array( ), 'disk' => '/rsrc/js/application/projects/projects-resource-editor.js', ), - 0 => - array( - 'uri' => '/res/1da00bfe/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-phabricator-object-selector' => - array( - 'uri' => '/res/34f9a11e/rsrc/js/application/core/behavior-object-selector.js', - 'type' => 'js', - 'requires' => - array( - 0 => 'javelin-behavior', - 1 => 'javelin-dom', - 2 => 'javelin-request', - 3 => 'javelin-util', - 4 => 'javelin-stratcom', - ), - 'disk' => '/rsrc/js/application/core/behavior-object-selector.js', - ), - 'javelin-behavior-phabricator-watch-anchor' => - array( - 'uri' => '/res/bb6fa5b2/rsrc/js/application/core/behavior-watch-anchor.js', - 'type' => 'js', - 'requires' => - array( - 0 => 'javelin-behavior', - 1 => 'javelin-stratcom', - 2 => 'javelin-util', - 3 => 'javelin-dom', - ), - 'disk' => '/rsrc/js/application/core/behavior-watch-anchor.js', - ), 'javelin-behavior-refresh-csrf' => array( 'uri' => '/res/39aa51f7/rsrc/js/application/core/behavior-refresh-csrf.js', @@ -1209,7 +1218,7 @@ celerity_register_resource_map(array( ), 'phabricator-standard-page-view' => array( - 'uri' => '/res/e8238633/rsrc/css/application/base/standard-page-view.css', + 'uri' => '/res/cbc3bb69/rsrc/css/application/base/standard-page-view.css', 'type' => 'css', 'requires' => array( @@ -1265,6 +1274,30 @@ celerity_register_resource_map(array( 'uri' => '/res/pkg/03ef179e/diffusion.pkg.css', 'type' => 'css', ), + '124bba3b' => + 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/124bba3b/core.pkg.css', + 'type' => 'css', + ), '25f94e94' => array ( 'name' => 'typeahead.pkg.js', @@ -1300,30 +1333,6 @@ celerity_register_resource_map(array( 'uri' => '/res/pkg/307df223/javelin.pkg.js', 'type' => 'js', ), - '3638143d' => - 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/3638143d/core.pkg.css', - 'type' => 'css', - ), '3f2092d7' => array ( 'name' => 'differential.pkg.css', @@ -1374,15 +1383,15 @@ celerity_register_resource_map(array( ), 'reverse' => array ( - 'aphront-crumbs-view-css' => '3638143d', - 'aphront-dialog-view-css' => '3638143d', - 'aphront-form-view-css' => '3638143d', - 'aphront-list-filter-view-css' => '3638143d', - 'aphront-panel-view-css' => '3638143d', - 'aphront-side-nav-view-css' => '3638143d', - 'aphront-table-view-css' => '3638143d', - 'aphront-tokenizer-control-css' => '3638143d', - 'aphront-typeahead-control-css' => '3638143d', + 'aphront-crumbs-view-css' => '124bba3b', + 'aphront-dialog-view-css' => '124bba3b', + 'aphront-form-view-css' => '124bba3b', + 'aphront-list-filter-view-css' => '124bba3b', + 'aphront-panel-view-css' => '124bba3b', + 'aphront-side-nav-view-css' => '124bba3b', + 'aphront-table-view-css' => '124bba3b', + 'aphront-tokenizer-control-css' => '124bba3b', + 'aphront-typeahead-control-css' => '124bba3b', 'differential-changeset-view-css' => '3f2092d7', 'differential-core-view-css' => '3f2092d7', 'differential-revision-add-comment-css' => '3f2092d7', @@ -1419,13 +1428,13 @@ celerity_register_resource_map(array( 'javelin-util' => '307df223', 'javelin-vector' => '307df223', 'javelin-workflow' => 'd0713563', - 'phabricator-core-buttons-css' => '3638143d', - 'phabricator-core-css' => '3638143d', - 'phabricator-directory-css' => '3638143d', + 'phabricator-core-buttons-css' => '124bba3b', + 'phabricator-core-css' => '124bba3b', + 'phabricator-directory-css' => '124bba3b', 'phabricator-keyboard-shortcut' => 'd0713563', 'phabricator-keyboard-shortcut-manager' => 'd0713563', - 'phabricator-remarkup-css' => '3638143d', - 'phabricator-standard-page-view' => '3638143d', - 'syntax-highlighting-css' => '3638143d', + 'phabricator-remarkup-css' => '124bba3b', + 'phabricator-standard-page-view' => '124bba3b', + 'syntax-highlighting-css' => '124bba3b', ), )); diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 632acb085b..17f1cd4339 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -15,6 +15,7 @@ phutil_register_library_map(array( 'AphrontApplicationConfiguration' => 'aphront/applicationconfiguration', 'AphrontAttachedFileView' => 'view/control/attachedfile', 'AphrontCSRFException' => 'aphront/exception/csrf', + 'AphrontContextBarView' => 'view/layout/contextbar', 'AphrontController' => 'aphront/controller', 'AphrontCrumbsView' => 'view/layout/crumbs', 'AphrontDatabaseConnection' => 'storage/connection/base', @@ -658,6 +659,7 @@ phutil_register_library_map(array( 'AphrontAjaxResponse' => 'AphrontResponse', 'AphrontAttachedFileView' => 'AphrontView', 'AphrontCSRFException' => 'AphrontException', + 'AphrontContextBarView' => 'AphrontView', 'AphrontCrumbsView' => 'AphrontView', 'AphrontDefaultApplicationConfiguration' => 'AphrontApplicationConfiguration', 'AphrontDefaultApplicationController' => 'AphrontController', diff --git a/src/applications/maniphest/controller/taskdetail/ManiphestTaskDetailController.php b/src/applications/maniphest/controller/taskdetail/ManiphestTaskDetailController.php index d605bf9d56..ca713ed339 100644 --- a/src/applications/maniphest/controller/taskdetail/ManiphestTaskDetailController.php +++ b/src/applications/maniphest/controller/taskdetail/ManiphestTaskDetailController.php @@ -188,18 +188,18 @@ class ManiphestTaskDetailController extends ManiphestController { implode("\n", $table). ''; - $create_new_button = ''; + $context_bar = null; if ($request->getStr('workflow') == 'create') { - $create_new_button = - '
'. - phutil_render_tag( - 'a', - array( - 'href' => '/maniphest/task/create/?template='.$task->getID(), - 'class' => 'green button', - ), - 'Create New Task'). - '
'; + $context_bar = new AphrontContextBarView(); + $context_bar->addButton( + phutil_render_tag( + 'a', + array( + 'href' => '/maniphest/task/create/?template='.$task->getID(), + 'class' => 'green button', + ), + 'Create Another Task')); + $context_bar->appendChild('New task created.'); } $actions = array(); @@ -241,7 +241,6 @@ class ManiphestTaskDetailController extends ManiphestController { '
'. $action_list->render(). '
'. - $create_new_button. '

'. ''. phutil_escape_html('T'.$task->getID()). @@ -426,6 +425,7 @@ class ManiphestTaskDetailController extends ManiphestController { return $this->buildStandardPageResponse( array( + $context_bar, $panel, $transaction_view, $comment_panel, diff --git a/src/applications/maniphest/controller/taskdetail/__init__.php b/src/applications/maniphest/controller/taskdetail/__init__.php index 48dcf52d9c..38252741af 100644 --- a/src/applications/maniphest/controller/taskdetail/__init__.php +++ b/src/applications/maniphest/controller/taskdetail/__init__.php @@ -29,6 +29,7 @@ phutil_require_module('phabricator', 'view/form/control/select'); phutil_require_module('phabricator', 'view/form/control/submit'); phutil_require_module('phabricator', 'view/form/control/textarea'); phutil_require_module('phabricator', 'view/form/control/tokenizer'); +phutil_require_module('phabricator', 'view/layout/contextbar'); phutil_require_module('phabricator', 'view/layout/filepreview'); phutil_require_module('phabricator', 'view/layout/headsup/action'); phutil_require_module('phabricator', 'view/layout/headsup/actionlist'); diff --git a/src/applications/maniphest/controller/taskedit/ManiphestTaskEditController.php b/src/applications/maniphest/controller/taskedit/ManiphestTaskEditController.php index 5d7e8d78aa..e3c9d5d426 100644 --- a/src/applications/maniphest/controller/taskedit/ManiphestTaskEditController.php +++ b/src/applications/maniphest/controller/taskedit/ManiphestTaskEditController.php @@ -72,6 +72,8 @@ class ManiphestTaskEditController extends ManiphestController { } } + $template_id = $request->getStr('template'); + $errors = array(); $e_title = true; @@ -210,21 +212,17 @@ class ManiphestTaskEditController extends ManiphestController { $task->setCCPHIDs(array( $user->getPHID(), )); + if ($template_id) { + $template_task = id(new ManiphestTask())->load($template_id); + if ($template_task) { + $task->setCCPHIDs($template_task->getCCPHIDs()); + $task->setProjectPHIDs($template_task->getProjectPHIDs()); + $task->setOwnerPHID($template_task->getOwnerPHID()); + } + } } } - $template_task = null; - $template_id = $request->getStr('template'); - if ($template_id && !$request->isFormPost()) { - $template_task = id(new ManiphestTask())->load($template_id); - } - - if (!$task->getID() && $template_task) { - $task->setCCPHIDs($template_task->getCCPHIDs()); - $task->setProjectPHIDs($template_task->getProjectPHIDs()); - $task->setOwnerPHID($template_task->getOwnerPHID()); - } - $phids = array_merge( array($task->getOwnerPHID()), $task->getCCPHIDs(), @@ -267,12 +265,17 @@ class ManiphestTaskEditController extends ManiphestController { $projects_value = array(); } + $cancel_id = nonempty($task->getID(), $template_id); + if ($cancel_id) { + $cancel_uri = '/T'.$cancel_id; + } else { + $cancel_uri = '/maniphest/'; + } + if ($task->getID()) { - $cancel_uri = '/T'.$task->getID(); $button_name = 'Save Task'; $header_name = 'Edit Task'; } else { - $cancel_uri = '/maniphest/'; $button_name = 'Create Task'; $header_name = 'Create New Task'; } @@ -283,6 +286,7 @@ class ManiphestTaskEditController extends ManiphestController { $form ->setUser($user) ->setAction($request->getRequestURI()->getPath()) + ->addHiddenInput('template', $template_id) ->appendChild( id(new AphrontFormTextAreaControl()) ->setLabel('Title') diff --git a/src/view/layout/contextbar/AphrontContextBarView.php b/src/view/layout/contextbar/AphrontContextBarView.php new file mode 100644 index 0000000000..9e4ae771cb --- /dev/null +++ b/src/view/layout/contextbar/AphrontContextBarView.php @@ -0,0 +1,48 @@ +buttons[] = $button; + return $this; + } + + public function render() { + $view = new AphrontNullView(); + $view->appendChild($this->buttons); + + require_celerity_resource('aphront-contextbar-view-css'); + + return + '
'. + '
'. + '
'. + $view->render(). + '
'. + '
'. + $this->renderChildren(). + '
'. + '
'. + '
'. + '
'; + } + +} diff --git a/src/view/layout/contextbar/__init__.php b/src/view/layout/contextbar/__init__.php new file mode 100644 index 0000000000..a4d30a71f5 --- /dev/null +++ b/src/view/layout/contextbar/__init__.php @@ -0,0 +1,14 @@ +