1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-18 12:52:42 +01:00

Simplify PHUIObjectItemList a bit

Summary: I don't think we use footicons, removing that CSS. States were added but only used in Auth, convert them to statusIcon instead.

Test Plan: Visit Auth, UIExamples, grep for `setState`

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin

Differential Revision: https://secure.phabricator.com/D16418
This commit is contained in:
Chad Little 2016-08-18 12:24:35 -07:00
parent aba4366020
commit 1cca7fbcce
6 changed files with 8 additions and 219 deletions

View file

@ -7,7 +7,7 @@
*/ */
return array( return array(
'names' => array( 'names' => array(
'core.pkg.css' => '3cea8606', 'core.pkg.css' => 'ba6d7e7a',
'core.pkg.js' => 'b562c3db', 'core.pkg.js' => 'b562c3db',
'darkconsole.pkg.js' => 'e7393ebb', 'darkconsole.pkg.js' => 'e7393ebb',
'differential.pkg.css' => '3fb7f532', 'differential.pkg.css' => '3fb7f532',
@ -147,7 +147,7 @@ return array(
'rsrc/css/phui/phui-info-view.css' => '28efab79', 'rsrc/css/phui/phui-info-view.css' => '28efab79',
'rsrc/css/phui/phui-list.css' => '9da2aa00', 'rsrc/css/phui/phui-list.css' => '9da2aa00',
'rsrc/css/phui/phui-object-box.css' => '6b487c57', 'rsrc/css/phui/phui-object-box.css' => '6b487c57',
'rsrc/css/phui/phui-object-item-list-view.css' => '8d99e42b', 'rsrc/css/phui/phui-object-item-list-view.css' => 'aefe157c',
'rsrc/css/phui/phui-pager.css' => 'bea33d23', 'rsrc/css/phui/phui-pager.css' => 'bea33d23',
'rsrc/css/phui/phui-pinboard-view.css' => '2495140e', 'rsrc/css/phui/phui-pinboard-view.css' => '2495140e',
'rsrc/css/phui/phui-profile-menu.css' => '8a3fc181', 'rsrc/css/phui/phui-profile-menu.css' => '8a3fc181',
@ -856,7 +856,7 @@ return array(
'phui-inline-comment-view-css' => '5953c28e', 'phui-inline-comment-view-css' => '5953c28e',
'phui-list-view-css' => '9da2aa00', 'phui-list-view-css' => '9da2aa00',
'phui-object-box-css' => '6b487c57', 'phui-object-box-css' => '6b487c57',
'phui-object-item-list-view-css' => '8d99e42b', 'phui-object-item-list-view-css' => 'aefe157c',
'phui-pager-css' => 'bea33d23', 'phui-pager-css' => 'bea33d23',
'phui-pinboard-view-css' => '2495140e', 'phui-pinboard-view-css' => '2495140e',
'phui-profile-menu-css' => '8a3fc181', 'phui-profile-menu-css' => '8a3fc181',

View file

@ -53,7 +53,7 @@ final class PhabricatorAuthListController
} }
if ($config->getIsEnabled()) { if ($config->getIsEnabled()) {
$item->setState(PHUIObjectItemView::STATE_SUCCESS); $item->setStatusIcon('fa-check-circle green');
$item->addAction( $item->addAction(
id(new PHUIListItemView()) id(new PHUIListItemView())
->setIcon('fa-times') ->setIcon('fa-times')
@ -61,8 +61,8 @@ final class PhabricatorAuthListController
->setDisabled(!$can_manage) ->setDisabled(!$can_manage)
->addSigil('workflow')); ->addSigil('workflow'));
} else { } else {
$item->setState(PHUIObjectItemView::STATE_FAIL); $item->setStatusIcon('fa-ban red');
$item->addIcon('fa-times grey', pht('Disabled')); $item->addIcon('fa-ban grey', pht('Disabled'));
$item->addAction( $item->addAction(
id(new PHUIListItemView()) id(new PHUIListItemView())
->setIcon('fa-plus') ->setIcon('fa-plus')

View file

@ -340,55 +340,6 @@ final class PHUIObjectItemListExample extends PhabricatorUIExample {
$out[] = $box; $out[] = $box;
$list = id(new PHUIObjectItemListView())
->setStates(true);
$list->addItem(
id(new PHUIObjectItemView())
->setObjectName('X1200')
->setHeader(pht('Action Passed'))
->addAttribute(pht('That went swimmingly, go you'))
->setHref('#')
->setState(PHUIObjectItemView::STATE_SUCCESS));
$list->addItem(
id(new PHUIObjectItemView())
->setObjectName('X1201')
->setHeader(pht('Action Failed'))
->addAttribute(pht('Whoopsies, might want to fix that'))
->setHref('#')
->setState(PHUIObjectItemView::STATE_FAIL));
$list->addItem(
id(new PHUIObjectItemView())
->setObjectName('X1202')
->setHeader(pht('Action Warning'))
->addAttribute(pht('We need to talk about things'))
->setHref('#')
->setState(PHUIObjectItemView::STATE_WARN));
$list->addItem(
id(new PHUIObjectItemView())
->setObjectName('X1203')
->setHeader(pht('Action Noted'))
->addAttribute(pht('The weather seems nice today'))
->setHref('#')
->setState(PHUIObjectItemView::STATE_NOTE));
$list->addItem(
id(new PHUIObjectItemView())
->setObjectName('X1203')
->setHeader(pht('Action In Progress'))
->addAttribute(pht('Outlook fuzzy, try again later'))
->setHref('#')
->setState(PHUIObjectItemView::STATE_BUILD));
$box = id(new PHUIObjectBoxView())
->setHeaderText(pht('State Icons'))
->setObjectList($list);
$out[] = array($box);
return $out; return $out;
} }
} }

View file

@ -9,7 +9,6 @@ final class PHUIObjectItemListView extends AphrontTagView {
private $flush; private $flush;
private $simple; private $simple;
private $allowEmptyList; private $allowEmptyList;
private $states;
private $itemClass = 'phui-object-item-standard'; private $itemClass = 'phui-object-item-standard';
public function setAllowEmptyList($allow_empty_list) { public function setAllowEmptyList($allow_empty_list) {
@ -51,11 +50,6 @@ final class PHUIObjectItemListView extends AphrontTagView {
return $this; return $this;
} }
public function setStates($states) {
$this->states = $states;
return $this;
}
public function setItemClass($item_class) { public function setItemClass($item_class) {
$this->itemClass = $item_class; $this->itemClass = $item_class;
return $this; return $this;
@ -69,9 +63,6 @@ final class PHUIObjectItemListView extends AphrontTagView {
$classes = array(); $classes = array();
$classes[] = 'phui-object-item-list-view'; $classes[] = 'phui-object-item-list-view';
if ($this->states) {
$classes[] = 'phui-object-list-states';
}
if ($this->flush) { if ($this->flush) {
$classes[] = 'phui-object-list-flush'; $classes[] = 'phui-object-list-flush';
} }

View file

@ -19,8 +19,6 @@ final class PHUIObjectItemView extends AphrontTagView {
private $headIcons = array(); private $headIcons = array();
private $disabled; private $disabled;
private $imageURI; private $imageURI;
private $state;
private $fontIcon;
private $imageIcon; private $imageIcon;
private $titleText; private $titleText;
private $badge; private $badge;
@ -29,16 +27,6 @@ final class PHUIObjectItemView extends AphrontTagView {
private $launchButton; private $launchButton;
private $coverImage; private $coverImage;
const AGE_FRESH = 'fresh';
const AGE_STALE = 'stale';
const AGE_OLD = 'old';
const STATE_SUCCESS = 'green';
const STATE_FAIL = 'red';
const STATE_WARN = 'yellow';
const STATE_NOTE = 'blue';
const STATE_BUILD = 'sky';
public function setDisabled($disabled) { public function setDisabled($disabled) {
$this->disabled = $disabled; $this->disabled = $disabled;
return $this; return $this;
@ -156,63 +144,9 @@ final class PHUIObjectItemView extends AphrontTagView {
return $this; return $this;
} }
public function setState($state) { public function setEpoch($epoch) {
$this->state = $state;
switch ($state) {
case self::STATE_SUCCESS:
$fi = 'fa-check-circle green';
break;
case self::STATE_FAIL:
$fi = 'fa-times-circle red';
break;
case self::STATE_WARN:
$fi = 'fa-exclamation-circle yellow';
break;
case self::STATE_NOTE:
$fi = 'fa-info-circle blue';
break;
case self::STATE_BUILD:
$fi = 'fa-refresh ph-spin sky';
break;
}
$this->setIcon($fi);
return $this;
}
public function setIcon($icon) {
$this->fontIcon = id(new PHUIIconView())
->setIcon($icon);
return $this;
}
public function setEpoch($epoch, $age = self::AGE_FRESH) {
$date = phabricator_datetime($epoch, $this->getUser()); $date = phabricator_datetime($epoch, $this->getUser());
$this->addIcon('none', $date);
$days = floor((time() - $epoch) / 60 / 60 / 24);
switch ($age) {
case self::AGE_FRESH:
$this->addIcon('none', $date);
break;
case self::AGE_STALE:
$attr = array(
'tip' => pht('Stale (%s day(s))', new PhutilNumber($days)),
'class' => 'icon-age-stale',
);
$this->addIcon('fa-clock-o yellow', $date, $attr);
break;
case self::AGE_OLD:
$attr = array(
'tip' => pht('Old (%s day(s))', new PhutilNumber($days)),
'class' => 'icon-age-old',
);
$this->addIcon('fa-clock-o red', $date, $attr);
break;
default:
throw new Exception(pht("Unknown age '%s'!", $age));
}
return $this; return $this;
} }
@ -309,10 +243,6 @@ final class PHUIObjectItemView extends AphrontTagView {
$item_classes[] = 'phui-object-item-disabled'; $item_classes[] = 'phui-object-item-disabled';
} }
if ($this->state) {
$item_classes[] = 'phui-object-item-state-'.$this->state;
}
switch ($this->effect) { switch ($this->effect) {
case 'highlighted': case 'highlighted':
$item_classes[] = 'phui-object-item-highlighted'; $item_classes[] = 'phui-object-item-highlighted';
@ -338,10 +268,6 @@ final class PHUIObjectItemView extends AphrontTagView {
$item_classes[] = 'phui-object-item-with-image-icon'; $item_classes[] = 'phui-object-item-with-image-icon';
} }
if ($this->fontIcon) {
$item_classes[] = 'phui-object-item-with-ficon';
}
return array( return array(
'class' => $item_classes, 'class' => $item_classes,
); );
@ -596,16 +522,6 @@ final class PHUIObjectItemView extends AphrontTagView {
$this->getImageIcon()); $this->getImageIcon());
} }
$ficon = null;
if ($this->fontIcon) {
$image = phutil_tag(
'div',
array(
'class' => 'phui-object-item-ficon',
),
$this->fontIcon);
}
if ($image && $this->href) { if ($image && $this->href) {
$image = phutil_tag( $image = phutil_tag(
'a', 'a',

View file

@ -487,46 +487,6 @@ ul.phui-object-item-list-view .phui-object-item-selected
} }
/* - Foot Icons ----------------------------------------------------------------
Object counts shown in the footer.
*/
.phui-object-item-foot-icons {
margin-left: 10px;
bottom: 0;
position: absolute;
}
.phui-object-item-with-foot-icons .phui-object-item-content,
.device-phone .phui-object-item-with-foot-icons .phui-object-item-col2 {
padding-bottom: 24px;
}
.device-phone .phui-object-item-with-foot-icons .phui-object-item-content {
padding-bottom: 0;
}
.phui-object-item-foot-icon {
display: inline-block;
background: {$lightgreyborder};
color: #ffffff;
font-weight: bold;
margin-right: 3px;
padding: 3px 6px 0;
height: 17px;
vertical-align: middle;
position: relative;
font-size: 12px;
-webkit-font-smoothing: antialiased;
}
.phui-object-item-foot-icon .phui-icon-view {
margin-right: 4px;
}
/* - Handle Icons -------------------------------------------------------------- /* - Handle Icons --------------------------------------------------------------
Shows owners, reviewers, etc., using profile picture icons. Shows owners, reviewers, etc., using profile picture icons.
@ -621,35 +581,6 @@ ul.phui-object-item-list-view .phui-object-item-selected
list-style: none; list-style: none;
} }
/* - State ---------------------------------------------------------------------
Provides a list of object status or states, success or fail, etc
*/
.phui-object-item-ficon {
width: 48px;
height: 26px;
margin-top: 12px;
position: absolute;
text-align: center;
font-size: 24px;
}
.phui-object-item-with-ficon .phui-object-item-content-box {
margin-left: 38px;
}
.phui-object-box .phui-object-list-states {
padding: 0;
}
.phui-object-list-states .phui-info-view {
margin: 0;
border: none;
}
/* - Badges ---------------------------------------------------------------- */ /* - Badges ---------------------------------------------------------------- */
.phui-object-item-col0.phui-object-item-badge { .phui-object-item-col0.phui-object-item-badge {