From 31cd9b21698f9adb131d7cda4de09adf337cc29a Mon Sep 17 00:00:00 2001 From: Chad Little Date: Fri, 16 May 2014 18:59:02 -0700 Subject: [PATCH] Update PHUIStatusItemView to FontAwesome Summary: Changes to using FontAwesome Test Plan: Testing UIExamples and each of the pages (except releelph) {F155942} Reviewers: epriestley Reviewed By: epriestley Subscribers: epriestley, Korvin Differential Revision: https://secure.phabricator.com/D9157 --- resources/celerity/map.php | 4 +- .../view/DifferentialReviewersView.php | 36 +++++++++++---- .../controller/DiffusionCommitController.php | 43 +++++++++++++---- .../DiffusionRepositoryEditMainController.php | 46 +++++++++---------- .../HarbormasterBuildableViewController.php | 20 +++++--- .../HarbormasterPlanViewController.php | 20 +++++--- .../event/HarbormasterUIEventListener.php | 26 +++++++---- .../event/PhrequentUIEventListener.php | 15 ++++-- .../ReleephIntentFieldSpecification.php | 11 +++-- .../examples/PhabricatorUIStatusExample.php | 31 +++++++++---- src/view/phui/PHUIStatusItemView.php | 22 +++++++-- webroot/rsrc/css/font/phui-font-icon-base.css | 3 ++ 12 files changed, 191 insertions(+), 86 deletions(-) diff --git a/resources/celerity/map.php b/resources/celerity/map.php index df1afd7f7a..5893124d30 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -113,7 +113,7 @@ return array( 'rsrc/css/diviner/diviner-shared.css' => '38813222', 'rsrc/css/font/font-awesome.css' => '73d075c3', 'rsrc/css/font/font-source-sans-pro.css' => '91d53463', - 'rsrc/css/font/phui-font-icon-base.css' => '104caddd', + 'rsrc/css/font/phui-font-icon-base.css' => '74cfb6a9', 'rsrc/css/layout/phabricator-action-header-view.css' => 'c14dfc57', 'rsrc/css/layout/phabricator-action-list-view.css' => 'dcd9875f', 'rsrc/css/layout/phabricator-crumbs-view.css' => '6a23399c', @@ -763,7 +763,7 @@ return array( 'phui-calendar-month-css' => 'a92e47d2', 'phui-document-view-css' => '3b078dc0', 'phui-feed-story-css' => '3a59c2cf', - 'phui-font-icon-base-css' => '104caddd', + 'phui-font-icon-base-css' => '74cfb6a9', 'phui-fontkit-css' => 'de84aa4a', 'phui-form-css' => 'b78ec020', 'phui-form-view-css' => '867463b4', diff --git a/src/applications/differential/view/DifferentialReviewersView.php b/src/applications/differential/view/DifferentialReviewersView.php index 732cc4ac80..03e777a668 100644 --- a/src/applications/differential/view/DifferentialReviewersView.php +++ b/src/applications/differential/view/DifferentialReviewersView.php @@ -43,49 +43,59 @@ final class DifferentialReviewersView extends AphrontView { switch ($reviewer->getStatus()) { case DifferentialReviewerStatus::STATUS_ADDED: - $item->setIcon('open', pht('Review Requested')); + $item->setIcon( + PHUIStatusItemView::ICON_OPEN, + 'bluegrey', + pht('Review Requested')); break; case DifferentialReviewerStatus::STATUS_ACCEPTED: if ($is_current) { $item->setIcon( - 'accept-green', + PHUIStatusItemView::ICON_ACCEPT, + 'green', pht('Accepted')); } else { $item->setIcon( - 'accept-dark', + PHUIStatusItemView::ICON_ACCEPT, + 'dark', pht('Accepted Prior Diff')); } break; case DifferentialReviewerStatus::STATUS_ACCEPTED_OLDER: $item->setIcon( - 'accept-dark', + PHUIStatusItemView::ICON_ACCEPT, + 'dark', pht('Accepted Prior Diff')); break; case DifferentialReviewerStatus::STATUS_REJECTED: if ($is_current) { $item->setIcon( - 'reject-red', + PHUIStatusItemView::ICON_REJECT, + 'red', pht('Requested Changes')); } else { $item->setIcon( - 'reject-dark', + PHUIStatusItemView::ICON_REJECT, + 'dark', pht('Requested Changes to Prior Diff')); } break; case DifferentialReviewerStatus::STATUS_REJECTED_OLDER: $item->setIcon( - 'reject-dark', + PHUIStatusItemView::ICON_REJECT, + 'dark', pht('Rejected Prior Diff')); break; case DifferentialReviewerStatus::STATUS_COMMENTED: if ($is_current) { $item->setIcon( - 'info', + PHUIStatusItemView::ICON_INFO, + 'bluegrey', pht('Commented')); } else { $item->setIcon( @@ -95,11 +105,17 @@ final class DifferentialReviewersView extends AphrontView { break; case DifferentialReviewerStatus::STATUS_BLOCKING: - $item->setIcon('minus-red', pht('Blocking Review')); + $item->setIcon( + PHUIStatusItemView::ICON_MINUS, + 'red', + pht('Blocking Review')); break; default: - $item->setIcon('question', pht('%s?', $reviewer->getStatus())); + $item->setIcon( + PHUIStatusItemView::ICON_QUESTION, + 'bluegrey', + pht('%s?', $reviewer->getStatus())); break; } diff --git a/src/applications/diffusion/controller/DiffusionCommitController.php b/src/applications/diffusion/controller/DiffusionCommitController.php index 425c6f0d20..c6dd87a946 100644 --- a/src/applications/diffusion/controller/DiffusionCommitController.php +++ b/src/applications/diffusion/controller/DiffusionCommitController.php @@ -1073,32 +1073,57 @@ final class DiffusionCommitController extends DiffusionController { switch ($request->getAuditStatus()) { case PhabricatorAuditStatusConstants::AUDIT_NOT_REQUIRED: - $item->setIcon('open-blue', pht('Commented')); + $item->setIcon( + PHUIStatusItemView::ICON_OPEN, + 'blue', + pht('Commented')); break; case PhabricatorAuditStatusConstants::AUDIT_REQUIRED: - $item->setIcon('warning-blue', pht('Audit Required')); + $item->setIcon( + PHUIStatusItemView::ICON_WARNING, + 'blue', + pht('Audit Required')); break; case PhabricatorAuditStatusConstants::CONCERNED: - $item->setIcon('reject-red', pht('Concern Raised')); + $item->setIcon( + PHUIStatusItemView::ICON_REJECT, + 'red', + pht('Concern Raised')); break; case PhabricatorAuditStatusConstants::ACCEPTED: - $item->setIcon('accept-green', pht('Accepted')); + $item->setIcon( + PHUIStatusItemView::ICON_ACCEPT, + 'green', + pht('Accepted')); break; case PhabricatorAuditStatusConstants::AUDIT_REQUESTED: - $item->setIcon('warning-dark', pht('Audit Requested')); + $item->setIcon( + PHUIStatusItemView::ICON_WARNING, + 'dark', + pht('Audit Requested')); break; case PhabricatorAuditStatusConstants::RESIGNED: - $item->setIcon('open-dark', pht('Resigned')); + $item->setIcon( + PHUIStatusItemView::ICON_OPEN, + 'dark', + pht('Resigned')); break; case PhabricatorAuditStatusConstants::CLOSED: - $item->setIcon('accept-blue', pht('Closed')); + $item->setIcon( + PHUIStatusItemView::ICON_ACCEPT, + 'blue', + pht('Closed')); break; case PhabricatorAuditStatusConstants::CC: - $item->setIcon('info-dark', pht('Subscribed')); + $item->setIcon( + PHUIStatusItemView::ICON_INFO, + 'dark', + pht('Subscribed')); break; default: $item->setIcon( - 'question-dark', + PHUIStatusItemView::ICON_QUESTION, + 'dark', pht('%s?', $request->getAuditStatus())); break; } diff --git a/src/applications/diffusion/controller/DiffusionRepositoryEditMainController.php b/src/applications/diffusion/controller/DiffusionRepositoryEditMainController.php index a1b89d1a89..50a74dd376 100644 --- a/src/applications/diffusion/controller/DiffusionRepositoryEditMainController.php +++ b/src/applications/diffusion/controller/DiffusionRepositoryEditMainController.php @@ -684,12 +684,12 @@ final class DiffusionRepositoryEditMainController if ($repository->isTracked()) { $view->addItem( id(new PHUIStatusItemView()) - ->setIcon('accept-green') + ->setIcon(PHUIStatusItemView::ICON_ACCEPT, 'green') ->setTarget(pht('Repository Active'))); } else { $view->addItem( id(new PHUIStatusItemView()) - ->setIcon('warning') + ->setIcon(PHUIStatusItemView::ICON_WARNING, 'bluegrey') ->setTarget(pht('Repository Inactive')) ->setNote( pht('Activate this repository to begin or resume import.'))); @@ -752,7 +752,7 @@ final class DiffusionRepositoryEditMainController if (!$where) { $view->addItem( id(new PHUIStatusItemView()) - ->setIcon('warning-red') + ->setIcon(PHUIStatusItemView::ICON_WARNING, 'red') ->setTarget( pht('Missing Binary %s', phutil_tag('tt', array(), $binary))) ->setNote(pht( @@ -762,7 +762,7 @@ final class DiffusionRepositoryEditMainController } else { $view->addItem( id(new PHUIStatusItemView()) - ->setIcon('accept-green') + ->setIcon(PHUIStatusItemView::ICON_ACCEPT, 'green') ->setTarget( pht('Found Binary %s', phutil_tag('tt', array(), $binary))) ->setNote(phutil_tag('tt', array(), $where))); @@ -787,7 +787,7 @@ final class DiffusionRepositoryEditMainController if (!$in_path) { $view->addItem( id(new PHUIStatusItemView()) - ->setIcon('warning-red') + ->setIcon(PHUIStatusItemView::ICON_WARNING, 'red') ->setTarget( pht('Missing Binary %s', phutil_tag('tt', array(), $binary))) ->setNote(pht( @@ -822,12 +822,12 @@ final class DiffusionRepositoryEditMainController if ($pull_daemon) { $view->addItem( id(new PHUIStatusItemView()) - ->setIcon('accept-green') + ->setIcon(PHUIStatusItemView::ICON_ACCEPT, 'green') ->setTarget(pht('Pull Daemon Running'))); } else { $view->addItem( id(new PHUIStatusItemView()) - ->setIcon('warning-red') + ->setIcon(PHUIStatusItemView::ICON_WARNING, 'red') ->setTarget(pht('Pull Daemon Not Running')) ->setNote($daemon_instructions)); } @@ -842,12 +842,12 @@ final class DiffusionRepositoryEditMainController if ($task_daemon) { $view->addItem( id(new PHUIStatusItemView()) - ->setIcon('accept-green') + ->setIcon(PHUIStatusItemView::ICON_ACCEPT, 'green') ->setTarget(pht('Task Daemon Running'))); } else { $view->addItem( id(new PHUIStatusItemView()) - ->setIcon('warning-red') + ->setIcon(PHUIStatusItemView::ICON_WARNING, 'red') ->setTarget(pht('Task Daemon Not Running')) ->setNote($daemon_instructions)); } @@ -857,13 +857,13 @@ final class DiffusionRepositoryEditMainController if (Filesystem::pathExists($local_parent)) { $view->addItem( id(new PHUIStatusItemView()) - ->setIcon('accept-green') + ->setIcon(PHUIStatusItemView::ICON_ACCEPT, 'green') ->setTarget(pht('Storage Directory OK')) ->setNote(phutil_tag('tt', array(), $local_parent))); } else { $view->addItem( id(new PHUIStatusItemView()) - ->setIcon('warning-red') + ->setIcon(PHUIStatusItemView::ICON_WARNING, 'red') ->setTarget(pht('No Storage Directory')) ->setNote( pht( @@ -880,7 +880,7 @@ final class DiffusionRepositoryEditMainController case PhabricatorRepositoryStatusMessage::CODE_ERROR: $view->addItem( id(new PHUIStatusItemView()) - ->setIcon('warning-red') + ->setIcon(PHUIStatusItemView::ICON_WARNING, 'red') ->setTarget(pht('Initialization Error')) ->setNote($message->getParameter('message'))); return $view; @@ -888,13 +888,13 @@ final class DiffusionRepositoryEditMainController if (Filesystem::pathExists($local_path)) { $view->addItem( id(new PHUIStatusItemView()) - ->setIcon('accept-green') + ->setIcon(PHUIStatusItemView::ICON_ACCEPT, 'green') ->setTarget(pht('Working Copy OK')) ->setNote(phutil_tag('tt', array(), $local_path))); } else { $view->addItem( id(new PHUIStatusItemView()) - ->setIcon('warning-red') + ->setIcon(PHUIStatusItemView::ICON_WARNING, 'red') ->setTarget(pht('Working Copy Error')) ->setNote( pht( @@ -909,14 +909,14 @@ final class DiffusionRepositoryEditMainController case PhabricatorRepositoryStatusMessage::CODE_WORKING: $view->addItem( id(new PHUIStatusItemView()) - ->setIcon('time-green') + ->setIcon(PHUIStatusItemView::ICON_CLOCK, 'green') ->setTarget(pht('Initializing Working Copy')) ->setNote(pht('Daemons are initializing the working copy.'))); return $view; default: $view->addItem( id(new PHUIStatusItemView()) - ->setIcon('warning-red') + ->setIcon(PHUIStatusItemView::ICON_WARNING, 'red') ->setTarget(pht('Unknown Init Status')) ->setNote($message->getStatusCode())); return $view; @@ -924,7 +924,7 @@ final class DiffusionRepositoryEditMainController } else { $view->addItem( id(new PHUIStatusItemView()) - ->setIcon('time-orange') + ->setIcon(PHUIStatusItemView::ICON_CLOCK, 'orange') ->setTarget(pht('No Working Copy Yet')) ->setNote( pht('Waiting for daemons to build a working copy.'))); @@ -938,14 +938,14 @@ final class DiffusionRepositoryEditMainController case PhabricatorRepositoryStatusMessage::CODE_ERROR: $view->addItem( id(new PHUIStatusItemView()) - ->setIcon('warning-red') + ->setIcon(PHUIStatusItemView::ICON_WARNING, 'red') ->setTarget(pht('Update Error')) ->setNote($message->getParameter('message'))); return $view; case PhabricatorRepositoryStatusMessage::CODE_OKAY: $view->addItem( id(new PHUIStatusItemView()) - ->setIcon('accept-green') + ->setIcon(PHUIStatusItemView::ICON_ACCEPT, 'green') ->setTarget(pht('Updates OK')) ->setNote( pht( @@ -956,7 +956,7 @@ final class DiffusionRepositoryEditMainController } else { $view->addItem( id(new PHUIStatusItemView()) - ->setIcon('time-orange') + ->setIcon(PHUIStatusItemView::ICON_CLOCK, 'orange') ->setTarget(pht('Waiting For Update')) ->setNote( pht('Waiting for daemons to read updates.'))); @@ -1005,21 +1005,21 @@ final class DiffusionRepositoryEditMainController $view->addItem( id(new PHUIStatusItemView()) - ->setIcon('time-green') + ->setIcon(PHUIStatusItemView::ICON_CLOCK, 'green') ->setTarget(pht('Importing')) ->setNote( pht('%s Complete', $percentage))); } else { $view->addItem( id(new PHUIStatusItemView()) - ->setIcon('accept-green') + ->setIcon(PHUIStatusItemView::ICON_ACCEPT, 'green') ->setTarget(pht('Fully Imported'))); } if (idx($messages, PhabricatorRepositoryStatusMessage::TYPE_NEEDS_UPDATE)) { $view->addItem( id(new PHUIStatusItemView()) - ->setIcon('up') + ->setIcon(PHUIStatusItemView::ICON_UP, 'indigo') ->setTarget(pht('Prioritized')) ->setNote(pht('This repository will be updated soon.'))); } diff --git a/src/applications/harbormaster/controller/HarbormasterBuildableViewController.php b/src/applications/harbormaster/controller/HarbormasterBuildableViewController.php index ed2942e846..a65447a940 100644 --- a/src/applications/harbormaster/controller/HarbormasterBuildableViewController.php +++ b/src/applications/harbormaster/controller/HarbormasterBuildableViewController.php @@ -252,27 +252,33 @@ final class HarbormasterBuildableViewController foreach ($targets as $target) { switch ($target->getTargetStatus()) { case HarbormasterBuildTarget::STATUS_PENDING: - $icon = 'time-green'; + $icon = PHUIStatusItemView::ICON_CLOCK; + $color = 'green'; $status_name = pht('Pending'); break; case HarbormasterBuildTarget::STATUS_BUILDING: - $icon = 'right-green'; + $icon = PHUIStatusItemView::ICON_RIGHT; + $color = 'green'; $status_name = pht('Building'); break; case HarbormasterBuildTarget::STATUS_WAITING: - $icon = 'time-orange'; + $icon = PHUIStatusItemView::ICON_CLOCK; + $color = 'orange'; $status_name = pht('Waiting'); break; case HarbormasterBuildTarget::STATUS_PASSED: - $icon = 'accept-green'; + $icon = PHUIStatusItemView::ICON_ACCEPT; + $color = 'green'; $status_name = pht('Passed'); break; case HarbormasterBuildTarget::STATUS_FAILED: - $icon = 'reject-red'; + $icon = PHUIStatusItemView::ICON_REJECT; + $color = 'red'; $status_name = pht('Failed'); break; default: - $icon = 'question'; + $icon = PHUIStatusItemView::ICON_QUESTION; + $color = 'bluegrey'; $status_name = pht('Unknown'); break; } @@ -286,7 +292,7 @@ final class HarbormasterBuildableViewController $target_list->addItem( id(new PHUIStatusItemView()) - ->setIcon($icon, $status_name) + ->setIcon($icon, $color, $status_name) ->setTarget(pht('Target %d', $target->getID())) ->setNote($name)); } diff --git a/src/applications/harbormaster/controller/HarbormasterPlanViewController.php b/src/applications/harbormaster/controller/HarbormasterPlanViewController.php index 75128e03f3..aa4f5d5a81 100644 --- a/src/applications/harbormaster/controller/HarbormasterPlanViewController.php +++ b/src/applications/harbormaster/controller/HarbormasterPlanViewController.php @@ -314,14 +314,16 @@ final class HarbormasterPlanViewController $bound = phutil_tag('em', array(), pht('(null)')); if ($is_input) { // This is an unbound input. For now, all inputs are always required. - $icon = 'warning-red'; + $icon = PHUIStatusItemView::ICON_WARNING; + $color = 'red'; $icon_label = pht('Required Input'); $has_conflicts = true; $error = pht('This input is required, but not configured.'); } else { // This is an unnamed output. Outputs do not necessarily need to be // named. - $icon = 'open'; + $icon = PHUIStatusItemView::ICON_OPEN; + $color = 'bluegrey'; $icon_label = pht('Unused Output'); } } else { @@ -329,10 +331,12 @@ final class HarbormasterPlanViewController if ($is_input) { if (isset($available_artifacts[$key])) { if ($available_artifacts[$key] == idx($artifact, 'type')) { - $icon = 'accept-green'; + $icon = PHUIStatusItemView::ICON_ACCEPT; + $color = 'green'; $icon_label = pht('Valid Input'); } else { - $icon = 'warning-red'; + $icon = PHUIStatusItemView::ICON_WARNING; + $color = 'red'; $icon_label = pht('Bad Input Type'); $has_conflicts = true; $error = pht( @@ -342,7 +346,8 @@ final class HarbormasterPlanViewController idx($artifact, 'type')); } } else { - $icon = 'question-red'; + $icon = PHUIStatusItemView::ICON_QUESTION; + $color = 'red'; $icon_label = pht('Unknown Input'); $has_conflicts = true; $error = pht( @@ -351,7 +356,8 @@ final class HarbormasterPlanViewController $key); } } else { - $icon = 'down-green'; + $icon = PHUIStatusItemView::ICON_DOWN; + $color = 'green'; $icon_label = pht('Valid Output'); } } @@ -367,7 +373,7 @@ final class HarbormasterPlanViewController $list->addItem( id(new PHUIStatusItemView()) - ->setIcon($icon, $icon_label) + ->setIcon($icon, $color, $icon_label) ->setTarget($artifact['name']) ->setNote($note)); } diff --git a/src/applications/harbormaster/event/HarbormasterUIEventListener.php b/src/applications/harbormaster/event/HarbormasterUIEventListener.php index 72ffbf7970..235ec17827 100644 --- a/src/applications/harbormaster/event/HarbormasterUIEventListener.php +++ b/src/applications/harbormaster/event/HarbormasterUIEventListener.php @@ -77,32 +77,40 @@ final class HarbormasterUIEventListener switch ($status) { case HarbormasterBuild::STATUS_INACTIVE: - $icon = 'open-dark'; + $icon = PHUIStatusItemView::ICON_OPEN; + $color = 'dark'; break; case HarbormasterBuild::STATUS_PENDING: - $icon = 'open-blue'; + $icon = PHUIStatusItemView::ICON_OPEN; + $color = 'blue'; break; case HarbormasterBuild::STATUS_BUILDING: - $icon = 'right-blue'; + $icon = PHUIStatusItemView::ICON_RIGHT; + $color = 'blue'; break; case HarbormasterBuild::STATUS_PASSED: - $icon = 'accept-green'; + $icon = PHUIStatusItemView::ICON_ACCEPT; + $color = 'green'; break; case HarbormasterBuild::STATUS_FAILED: - $icon = 'reject-red'; + $icon = PHUIStatusItemView::ICON_REJECT; + $color = 'red'; break; case HarbormasterBuild::STATUS_ERROR: - $icon = 'minus-red'; + $icon = PHUIStatusItemView::ICON_MINUS; + $color = 'red'; break; case HarbormasterBuild::STATUS_STOPPED: - $icon = 'minus-dark'; + $icon = PHUIStatusItemView::ICON_MINUS; + $color = 'dark'; break; default: - $icon = 'question'; + $icon = PHUIStatusItemView::ICON_QUESTION; + $color = 'bluegrey'; break; } - $item->setIcon($icon, $status_name); + $item->setIcon($icon, $color, $status_name); $status_view->addItem($item); diff --git a/src/applications/phrequent/event/PhrequentUIEventListener.php b/src/applications/phrequent/event/PhrequentUIEventListener.php index e0ce8df4da..4778686b9c 100644 --- a/src/applications/phrequent/event/PhrequentUIEventListener.php +++ b/src/applications/phrequent/event/PhrequentUIEventListener.php @@ -117,13 +117,22 @@ final class PhrequentUIEventListener switch ($state) { case 'active': - $item->setIcon('time-green', pht('Working Now')); + $item->setIcon( + PHUIStatusItemView::ICON_CLOCK, + 'green', + pht('Working Now')); break; case 'suspended': - $item->setIcon('time-yellow', pht('Interrupted')); + $item->setIcon( + PHUIStatusItemView::ICON_CLOCK, + 'yellow', + pht('Interrupted')); break; case 'stopped': - $item->setIcon('time-orange', pht('Not Working Now')); + $item->setIcon( + PHUIStatusItemView::ICON_CLOCK, + 'bluegrey', + pht('Not Working Now')); break; } diff --git a/src/applications/releeph/field/specification/ReleephIntentFieldSpecification.php b/src/applications/releeph/field/specification/ReleephIntentFieldSpecification.php index 2c1288cab2..481454e4ec 100644 --- a/src/applications/releeph/field/specification/ReleephIntentFieldSpecification.php +++ b/src/applications/releeph/field/specification/ReleephIntentFieldSpecification.php @@ -44,15 +44,18 @@ final class ReleephIntentFieldSpecification foreach ($intents as $phid => $intent) { switch ($intent) { case ReleephRequest::INTENT_WANT: - $icon = 'accept-green'; + $icon = PHUIStatusItemView::ICON_ACCEPT; + $color = 'green'; $label = pht('Want'); break; case ReleephRequest::INTENT_PASS: - $icon = 'reject-red'; + $icon = PHUIStatusItemView::ICON_REJECT; + $color = 'red'; $label = pht('Pass'); break; default: - $icon = 'question'; + $icon = PHUIStatusItemView::ICON_QUESTION; + $color = 'bluegrey'; $label = pht('Unknown Intent (%s)', $intent); break; } @@ -64,7 +67,7 @@ final class ReleephIntentFieldSpecification $view->addItem( id(new PHUIStatusItemView()) - ->setIcon($icon, $label) + ->setIcon($icon, $color, $label) ->setTarget($target)); } diff --git a/src/applications/uiexample/examples/PhabricatorUIStatusExample.php b/src/applications/uiexample/examples/PhabricatorUIStatusExample.php index 9237ec6be8..c50f76ca48 100644 --- a/src/applications/uiexample/examples/PhabricatorUIStatusExample.php +++ b/src/applications/uiexample/examples/PhabricatorUIStatusExample.php @@ -19,26 +19,26 @@ final class PhabricatorUIStatusExample extends PhabricatorUIExample { $view->addItem( id(new PHUIStatusItemView()) - ->setIcon('accept-green', pht('Yum')) + ->setIcon(PHUIStatusItemView::ICON_ACCEPT, 'green', pht('Yum')) ->setTarget(pht('Apple')) ->setNote(pht('You can eat them.'))); $view->addItem( id(new PHUIStatusItemView()) - ->setIcon('add-blue', pht('Has Peel')) + ->setIcon(PHUIStatusItemView::ICON_ADD, 'blue', pht('Has Peel')) ->setTarget(pht('Banana')) ->setNote(pht('Comes in bunches.')) ->setHighlighted(true)); $view->addItem( id(new PHUIStatusItemView()) - ->setIcon('warning-dark', pht('Caution')) + ->setIcon(PHUIStatusItemView::ICON_WARNING, 'dark', pht('Caution')) ->setTarget(pht('Pomegranite')) ->setNote(pht('Lots of seeds. Watch out.'))); $view->addItem( id(new PHUIStatusItemView()) - ->setIcon('reject-red', pht('Bleh!')) + ->setIcon(PHUIStatusItemView::ICON_REJECT, 'red', pht('Bleh!')) ->setTarget(pht('Zucchini')) ->setNote(pht('Slimy and gross. Yuck!'))); @@ -54,15 +54,28 @@ final class PhabricatorUIStatusExample extends PhabricatorUIExample { $view = new PHUIStatusListView(); - $manifest = PHUIIconView::getSheetManifest(PHUIIconView::SPRITE_STATUS); + $manifest = array( + PHUIStatusItemView::ICON_ACCEPT => 'PHUIStatusItemView::ICON_ACCEPT', + PHUIStatusItemView::ICON_REJECT => 'PHUIStatusItemView::ICON_REJECT', + PHUIStatusItemView::ICON_LEFT => 'PHUIStatusItemView::ICON_LEFT', + PHUIStatusItemView::ICON_RIGHT => 'PHUIStatusItemView::ICON_RIGHT', + PHUIStatusItemView::ICON_UP => 'PHUIStatusItemView::ICON_UP', + PHUIStatusItemView::ICON_DOWN => 'PHUIStatusItemView::ICON_DOWN', + PHUIStatusItemView::ICON_QUESTION => 'PHUIStatusItemView::ICON_QUESTION', + PHUIStatusItemView::ICON_WARNING => 'PHUIStatusItemView::ICON_WARNING', + PHUIStatusItemView::ICON_INFO => 'PHUIStatusItemView::ICON_INFO', + PHUIStatusItemView::ICON_ADD => 'PHUIStatusItemView::ICON_ADD', + PHUIStatusItemView::ICON_MINUS => 'PHUIStatusItemView::ICON_MINUS', + PHUIStatusItemView::ICON_OPEN => 'PHUIStatusItemView::ICON_OPEN', + PHUIStatusItemView::ICON_CLOCK => 'PHUIStatusItemView::ICON_CLOCK', + ); - foreach ($manifest as $sprite) { - $name = substr($sprite['name'], strlen('status-')); + foreach ($manifest as $icon => $label) { $view->addItem( id(new PHUIStatusItemView()) - ->setIcon($name) - ->setTarget($name)); + ->setIcon($icon, 'indigo') + ->setTarget($label)); } $out[] = id(new PHUIHeaderView()) diff --git a/src/view/phui/PHUIStatusItemView.php b/src/view/phui/PHUIStatusItemView.php index a93579d4f4..e82799fc27 100644 --- a/src/view/phui/PHUIStatusItemView.php +++ b/src/view/phui/PHUIStatusItemView.php @@ -4,13 +4,30 @@ final class PHUIStatusItemView extends AphrontTagView { private $icon; private $iconLabel; + private $iconColor; private $target; private $note; private $highlighted; - public function setIcon($icon, $label = null) { + const ICON_ACCEPT = 'fa-check-circle'; + const ICON_REJECT = 'fa-times-circle'; + const ICON_LEFT = 'fa-chevron-circle-left'; + const ICON_RIGHT = 'fa-chevron-circle-right'; + const ICON_UP = 'fa-chevron-circle-up'; + const ICON_DOWN = 'fa-chevron-circle-down'; + const ICON_QUESTION = 'fa-question-circle'; + const ICON_WARNING = 'fa-exclamation-circle'; + const ICON_INFO = 'fa-info-circle'; + const ICON_ADD = 'fa-plus-circle'; + const ICON_MINUS = 'fa-minus-circle'; + const ICON_OPEN = 'fa-circle-o'; + const ICON_CLOCK = 'fa-clock-o'; + + /* render_textarea */ + public function setIcon($icon, $color = null, $label = null) { $this->icon = $icon; $this->iconLabel = $label; + $this->iconColor = $color; return $this; } @@ -53,8 +70,7 @@ final class PHUIStatusItemView extends AphrontTagView { $icon = null; if ($this->icon) { $icon = id(new PHUIIconView()) - ->setSpriteSheet(PHUIIconView::SPRITE_STATUS) - ->setSpriteIcon($this->icon); + ->setIconFont($this->icon.' '.$this->iconColor); if ($this->iconLabel) { Javelin::initBehavior('phabricator-tooltips'); diff --git a/webroot/rsrc/css/font/phui-font-icon-base.css b/webroot/rsrc/css/font/phui-font-icon-base.css index f55e834401..7a763cb7fe 100644 --- a/webroot/rsrc/css/font/phui-font-icon-base.css +++ b/webroot/rsrc/css/font/phui-font-icon-base.css @@ -104,6 +104,9 @@ } } +.phui-icon-view.dark { + color: {$darkgreytext}; +} .phui-icon-view.bluegrey { color: #7787a6; }