From 0bd8388684227053530f69cfa942740f2b2ab8ca Mon Sep 17 00:00:00 2001 From: Andre Klapper Date: Mon, 3 Feb 2025 18:53:21 +0100 Subject: [PATCH] Strike through archived projects in navigation crumbs Summary: Going to e.g. the workboard of an archived project, there is no indication when the project has been archived (the blurred project icon is only displayed if the viewport width is >920px). This can lead to confusion why a workboard is completely empty. Thus render an archived project as strike-through in the navigation bread crumbs. Closes T15890 Test Plan: * Go to the {Profile, Workboard, Reports, Members, Subprojects, Reports} pages of an active and an archived project and look at the navigation crumbs bar below Phorge's global top bar. * Create an active subproject and active milestone of an archived project (and vice versa) and look at the navigation crumbs. Reviewers: O1 Blessed Committers, valerio.bozzolan Reviewed By: O1 Blessed Committers, valerio.bozzolan Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno Tags: #projects Maniphest Tasks: T15890 Differential Revision: https://we.phorge.it/D25774 --- resources/celerity/map.php | 6 +++--- .../controller/PhabricatorProjectController.php | 4 ++-- src/view/phui/PHUICrumbView.php | 16 ++++++++++++++++ src/view/phui/PHUICrumbsView.php | 9 ++++++--- webroot/rsrc/css/phui/phui-crumbs-view.css | 4 ++++ 5 files changed, 31 insertions(+), 8 deletions(-) diff --git a/resources/celerity/map.php b/resources/celerity/map.php index d068ad1d24..2f22ce03c6 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -9,7 +9,7 @@ return array( 'names' => array( 'conpherence.pkg.css' => '2f25eb4f', 'conpherence.pkg.js' => '020aebcf', - 'core.pkg.css' => 'ac619266', + 'core.pkg.css' => '112931ab', 'core.pkg.js' => '8c86adab', 'dark-console.pkg.js' => '187792c2', 'differential.pkg.css' => '94bb10ca', @@ -146,7 +146,7 @@ return array( 'rsrc/css/phui/phui-cms.css' => '8c05c41e', 'rsrc/css/phui/phui-comment-form.css' => '3c6679a3', 'rsrc/css/phui/phui-comment-panel.css' => 'ec4e31c0', - 'rsrc/css/phui/phui-crumbs-view.css' => '614f43cf', + 'rsrc/css/phui/phui-crumbs-view.css' => 'a6a337a4', 'rsrc/css/phui/phui-curtain-object-ref-view.css' => '51d93266', 'rsrc/css/phui/phui-curtain-view.css' => '68c5efb6', 'rsrc/css/phui/phui-document-pro.css' => '48e72f0a', @@ -838,7 +838,7 @@ return array( 'phui-cms-css' => '8c05c41e', 'phui-comment-form-css' => '3c6679a3', 'phui-comment-panel-css' => 'ec4e31c0', - 'phui-crumbs-view-css' => '614f43cf', + 'phui-crumbs-view-css' => 'a6a337a4', 'phui-curtain-object-ref-view-css' => '51d93266', 'phui-curtain-view-css' => '68c5efb6', 'phui-document-summary-view-css' => 'b068eed1', diff --git a/src/applications/project/controller/PhabricatorProjectController.php b/src/applications/project/controller/PhabricatorProjectController.php index 998cbac613..6f7a70f0ab 100644 --- a/src/applications/project/controller/PhabricatorProjectController.php +++ b/src/applications/project/controller/PhabricatorProjectController.php @@ -137,8 +137,8 @@ abstract class PhabricatorProjectController extends PhabricatorController { break; } } - - $crumbs->addTextCrumb($ancestor->getName(), $crumb_uri); + $archived = $ancestor->isArchived(); + $crumbs->addTextCrumb($ancestor->getName(), $crumb_uri, $archived); } } diff --git a/src/view/phui/PHUICrumbView.php b/src/view/phui/PHUICrumbView.php index 5174de59cd..bf7890ac87 100644 --- a/src/view/phui/PHUICrumbView.php +++ b/src/view/phui/PHUICrumbView.php @@ -4,6 +4,7 @@ final class PHUICrumbView extends AphrontView { private $name; private $href; + private $strikethrough = false; private $icon; private $isLastCrumb; private $workflow; @@ -54,6 +55,17 @@ final class PHUICrumbView extends AphrontView { return $this; } + /** + * Render this crumb as strike-through. + * + * @param bool $strikethrough True to render the crumb strike-through. + * @return $this + */ + public function setStrikethrough(bool $strikethrough) { + $this->strikethrough = $strikethrough; + return $this; + } + public function setIcon($icon) { $this->icon = $icon; return $this; @@ -90,6 +102,10 @@ final class PHUICrumbView extends AphrontView { ->setIcon($this->icon); } + if ($this->strikethrough) { + $classes[] = 'phui-crumb-strikethrough'; + } + // Surround the crumb name with spaces so that double clicking it only // selects the crumb itself. $name = array(' ', $this->name); diff --git a/src/view/phui/PHUICrumbsView.php b/src/view/phui/PHUICrumbsView.php index 416566a98a..8430c07d92 100644 --- a/src/view/phui/PHUICrumbsView.php +++ b/src/view/phui/PHUICrumbsView.php @@ -15,15 +15,18 @@ final class PHUICrumbsView extends AphrontView { * Convenience method for adding a simple crumb with just text, or text and * a link. * - * @param string $text Text of the crumb. + * @param string $text Text of the crumb. * @param string $href (optional) href for the crumb. + * @param bool $strikethrough (optional) Strikethrough (=inactive/disabled) + * for the crumb. * @return $this */ - public function addTextCrumb($text, $href = null) { + public function addTextCrumb($text, $href = null, $strikethrough = false) { return $this->addCrumb( id(new PHUICrumbView()) ->setName($text) - ->setHref($href)); + ->setHref($href) + ->setStrikethrough($strikethrough)); } public function addCrumb(PHUICrumbView $crumb) { diff --git a/webroot/rsrc/css/phui/phui-crumbs-view.css b/webroot/rsrc/css/phui/phui-crumbs-view.css index 0811b36134..0830119f10 100644 --- a/webroot/rsrc/css/phui/phui-crumbs-view.css +++ b/webroot/rsrc/css/phui/phui-crumbs-view.css @@ -71,6 +71,10 @@ margin: 0 4px; } +.phui-crumb-strikethrough > .phui-crumb-name { + text-decoration: line-through; +} + .device-phone .phui-crumb-icon { margin-left: 7px; }