From 989c7748e927b75a59a11680f273e33c215af981 Mon Sep 17 00:00:00 2001 From: Chad Little Date: Tue, 4 Jun 2013 10:58:49 -0700 Subject: [PATCH] Prompt to adding a project if none in Maniphest Summary: Adds 'Add Project...' if no projects present on Maniphest items. Also - I can't seem to get a dialog to pop, what am I missing? Fixes T3308 Test Plan: Click add project, get edit form. Reviewers: epriestley, btrahan Reviewed By: epriestley CC: aran, Korvin Maniphest Tasks: T3308 Differential Revision: https://secure.phabricator.com/D6121 --- src/__celerity_resource_map__.php | 14 +++++++------- .../maniphest/view/ManiphestTaskListView.php | 14 ++++++-------- .../view/ManiphestTaskProjectsView.php | 19 +++++++++++++++---- .../css/application/projects/project-tag.css | 10 ++++++++++ 4 files changed, 38 insertions(+), 19 deletions(-) diff --git a/src/__celerity_resource_map__.php b/src/__celerity_resource_map__.php index f4a29b855f..3e332da3d2 100644 --- a/src/__celerity_resource_map__.php +++ b/src/__celerity_resource_map__.php @@ -3275,7 +3275,7 @@ celerity_register_resource_map(array( ), 'phabricator-project-tag-css' => array( - 'uri' => '/res/1b5efcb2/rsrc/css/application/projects/project-tag.css', + 'uri' => '/res/383b8c30/rsrc/css/application/projects/project-tag.css', 'type' => 'css', 'requires' => array( @@ -4199,7 +4199,7 @@ celerity_register_resource_map(array( 'uri' => '/res/pkg/a9f14d76/javelin.pkg.js', 'type' => 'js', ), - '6b1fccc6' => + '03ab92cf' => array( 'name' => 'maniphest.pkg.css', 'symbols' => @@ -4209,7 +4209,7 @@ celerity_register_resource_map(array( 2 => 'aphront-attached-file-view-css', 3 => 'phabricator-project-tag-css', ), - 'uri' => '/res/pkg/6b1fccc6/maniphest.pkg.css', + 'uri' => '/res/pkg/03ab92cf/maniphest.pkg.css', 'type' => 'css', ), '1621e522' => @@ -4229,7 +4229,7 @@ celerity_register_resource_map(array( ), 'reverse' => array( - 'aphront-attached-file-view-css' => '6b1fccc6', + 'aphront-attached-file-view-css' => '03ab92cf', 'aphront-dialog-view-css' => '8e459ff2', 'aphront-error-view-css' => '8e459ff2', 'aphront-form-view-css' => '8e459ff2', @@ -4328,8 +4328,8 @@ celerity_register_resource_map(array( 'javelin-vector' => 'a9f14d76', 'javelin-workflow' => 'a9f14d76', 'lightbox-attachment-css' => '8e459ff2', - 'maniphest-task-summary-css' => '6b1fccc6', - 'maniphest-transaction-detail-css' => '6b1fccc6', + 'maniphest-task-summary-css' => '03ab92cf', + 'maniphest-transaction-detail-css' => '03ab92cf', 'phabricator-action-list-view-css' => '8e459ff2', 'phabricator-application-launch-view-css' => '8e459ff2', 'phabricator-busy' => '98f60e3f', @@ -4358,7 +4358,7 @@ celerity_register_resource_map(array( 'phabricator-object-selector-css' => 'dd27a69b', 'phabricator-phtize' => '98f60e3f', 'phabricator-prefab' => '98f60e3f', - 'phabricator-project-tag-css' => '6b1fccc6', + 'phabricator-project-tag-css' => '03ab92cf', 'phabricator-property-list-view-css' => '8e459ff2', 'phabricator-remarkup-css' => '8e459ff2', 'phabricator-shaped-request' => '9488bb69', diff --git a/src/applications/maniphest/view/ManiphestTaskListView.php b/src/applications/maniphest/view/ManiphestTaskListView.php index 0446f4c5ee..28364d45fc 100644 --- a/src/applications/maniphest/view/ManiphestTaskListView.php +++ b/src/applications/maniphest/view/ManiphestTaskListView.php @@ -86,15 +86,13 @@ final class ManiphestTaskListView extends ManiphestView { $item->addSigil('maniphest-task'); } - if ($task->getProjectPHIDs()) { - $projects_view = new ManiphestTaskProjectsView(); - $projects_view->setHandles( - array_select_keys( - $handles, - $task->getProjectPHIDs())); + $projects_view = new ManiphestTaskProjectsView(); + $projects_view->setHandles( + array_select_keys( + $handles, + $task->getProjectPHIDs())); - $item->addAttribute($projects_view); - } + $item->addAttribute($projects_view); $item->setMetadata( array( diff --git a/src/applications/maniphest/view/ManiphestTaskProjectsView.php b/src/applications/maniphest/view/ManiphestTaskProjectsView.php index db9d4959db..2497244ccc 100644 --- a/src/applications/maniphest/view/ManiphestTaskProjectsView.php +++ b/src/applications/maniphest/view/ManiphestTaskProjectsView.php @@ -20,14 +20,25 @@ final class ManiphestTaskProjectsView extends ManiphestView { $show = array_slice($this->handles, 0, 2); $tags = array(); - foreach ($show as $handle) { + if ($show) { + foreach ($show as $handle) { + $tags[] = phutil_tag( + 'a', + array( + 'href' => $handle->getURI(), + 'class' => 'phabricator-project-tag', + ), + phutil_utf8_shorten($handle->getName(), 24)); + } + } else { $tags[] = phutil_tag( 'a', array( - 'href' => $handle->getURI(), - 'class' => 'phabricator-project-tag', + 'class' => 'phabricator-project-tag phabricator-project-tag-grey', + 'href' => '/maniphest/view/all/?s&projects='. + ManiphestTaskOwner::PROJECT_NO_PROJECT ), - phutil_utf8_shorten($handle->getName(), 24)); + pht('No Project')); } if (count($this->handles) > 2) { diff --git a/webroot/rsrc/css/application/projects/project-tag.css b/webroot/rsrc/css/application/projects/project-tag.css index 7cefd99541..416a34d79b 100644 --- a/webroot/rsrc/css/application/projects/project-tag.css +++ b/webroot/rsrc/css/application/projects/project-tag.css @@ -23,6 +23,16 @@ white-space: nowrap; } +.phabricator-project-tag.phabricator-project-tag-grey { + border: 1px solid #ccc; + background: #f7f7f7; + color: #888; +} + +.phabricator-project-tag.phabricator-project-tag-grey:hover { + background: #e7e7e7; +} + .phabricator-project-tag:last-child { margin-right: 0px; }