mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-18 11:30:55 +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:
parent
aba4366020
commit
1cca7fbcce
6 changed files with 8 additions and 219 deletions
|
@ -7,7 +7,7 @@
|
|||
*/
|
||||
return array(
|
||||
'names' => array(
|
||||
'core.pkg.css' => '3cea8606',
|
||||
'core.pkg.css' => 'ba6d7e7a',
|
||||
'core.pkg.js' => 'b562c3db',
|
||||
'darkconsole.pkg.js' => 'e7393ebb',
|
||||
'differential.pkg.css' => '3fb7f532',
|
||||
|
@ -147,7 +147,7 @@ return array(
|
|||
'rsrc/css/phui/phui-info-view.css' => '28efab79',
|
||||
'rsrc/css/phui/phui-list.css' => '9da2aa00',
|
||||
'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-pinboard-view.css' => '2495140e',
|
||||
'rsrc/css/phui/phui-profile-menu.css' => '8a3fc181',
|
||||
|
@ -856,7 +856,7 @@ return array(
|
|||
'phui-inline-comment-view-css' => '5953c28e',
|
||||
'phui-list-view-css' => '9da2aa00',
|
||||
'phui-object-box-css' => '6b487c57',
|
||||
'phui-object-item-list-view-css' => '8d99e42b',
|
||||
'phui-object-item-list-view-css' => 'aefe157c',
|
||||
'phui-pager-css' => 'bea33d23',
|
||||
'phui-pinboard-view-css' => '2495140e',
|
||||
'phui-profile-menu-css' => '8a3fc181',
|
||||
|
|
|
@ -53,7 +53,7 @@ final class PhabricatorAuthListController
|
|||
}
|
||||
|
||||
if ($config->getIsEnabled()) {
|
||||
$item->setState(PHUIObjectItemView::STATE_SUCCESS);
|
||||
$item->setStatusIcon('fa-check-circle green');
|
||||
$item->addAction(
|
||||
id(new PHUIListItemView())
|
||||
->setIcon('fa-times')
|
||||
|
@ -61,8 +61,8 @@ final class PhabricatorAuthListController
|
|||
->setDisabled(!$can_manage)
|
||||
->addSigil('workflow'));
|
||||
} else {
|
||||
$item->setState(PHUIObjectItemView::STATE_FAIL);
|
||||
$item->addIcon('fa-times grey', pht('Disabled'));
|
||||
$item->setStatusIcon('fa-ban red');
|
||||
$item->addIcon('fa-ban grey', pht('Disabled'));
|
||||
$item->addAction(
|
||||
id(new PHUIListItemView())
|
||||
->setIcon('fa-plus')
|
||||
|
|
|
@ -340,55 +340,6 @@ final class PHUIObjectItemListExample extends PhabricatorUIExample {
|
|||
|
||||
$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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,7 +9,6 @@ final class PHUIObjectItemListView extends AphrontTagView {
|
|||
private $flush;
|
||||
private $simple;
|
||||
private $allowEmptyList;
|
||||
private $states;
|
||||
private $itemClass = 'phui-object-item-standard';
|
||||
|
||||
public function setAllowEmptyList($allow_empty_list) {
|
||||
|
@ -51,11 +50,6 @@ final class PHUIObjectItemListView extends AphrontTagView {
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function setStates($states) {
|
||||
$this->states = $states;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setItemClass($item_class) {
|
||||
$this->itemClass = $item_class;
|
||||
return $this;
|
||||
|
@ -69,9 +63,6 @@ final class PHUIObjectItemListView extends AphrontTagView {
|
|||
$classes = array();
|
||||
|
||||
$classes[] = 'phui-object-item-list-view';
|
||||
if ($this->states) {
|
||||
$classes[] = 'phui-object-list-states';
|
||||
}
|
||||
if ($this->flush) {
|
||||
$classes[] = 'phui-object-list-flush';
|
||||
}
|
||||
|
|
|
@ -19,8 +19,6 @@ final class PHUIObjectItemView extends AphrontTagView {
|
|||
private $headIcons = array();
|
||||
private $disabled;
|
||||
private $imageURI;
|
||||
private $state;
|
||||
private $fontIcon;
|
||||
private $imageIcon;
|
||||
private $titleText;
|
||||
private $badge;
|
||||
|
@ -29,16 +27,6 @@ final class PHUIObjectItemView extends AphrontTagView {
|
|||
private $launchButton;
|
||||
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) {
|
||||
$this->disabled = $disabled;
|
||||
return $this;
|
||||
|
@ -156,63 +144,9 @@ final class PHUIObjectItemView extends AphrontTagView {
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function setState($state) {
|
||||
$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) {
|
||||
public function setEpoch($epoch) {
|
||||
$date = phabricator_datetime($epoch, $this->getUser());
|
||||
|
||||
$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));
|
||||
}
|
||||
|
||||
$this->addIcon('none', $date);
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
@ -309,10 +243,6 @@ final class PHUIObjectItemView extends AphrontTagView {
|
|||
$item_classes[] = 'phui-object-item-disabled';
|
||||
}
|
||||
|
||||
if ($this->state) {
|
||||
$item_classes[] = 'phui-object-item-state-'.$this->state;
|
||||
}
|
||||
|
||||
switch ($this->effect) {
|
||||
case 'highlighted':
|
||||
$item_classes[] = 'phui-object-item-highlighted';
|
||||
|
@ -338,10 +268,6 @@ final class PHUIObjectItemView extends AphrontTagView {
|
|||
$item_classes[] = 'phui-object-item-with-image-icon';
|
||||
}
|
||||
|
||||
if ($this->fontIcon) {
|
||||
$item_classes[] = 'phui-object-item-with-ficon';
|
||||
}
|
||||
|
||||
return array(
|
||||
'class' => $item_classes,
|
||||
);
|
||||
|
@ -596,16 +522,6 @@ final class PHUIObjectItemView extends AphrontTagView {
|
|||
$this->getImageIcon());
|
||||
}
|
||||
|
||||
$ficon = null;
|
||||
if ($this->fontIcon) {
|
||||
$image = phutil_tag(
|
||||
'div',
|
||||
array(
|
||||
'class' => 'phui-object-item-ficon',
|
||||
),
|
||||
$this->fontIcon);
|
||||
}
|
||||
|
||||
if ($image && $this->href) {
|
||||
$image = phutil_tag(
|
||||
'a',
|
||||
|
|
|
@ -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 --------------------------------------------------------------
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
/* - 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 ---------------------------------------------------------------- */
|
||||
|
||||
.phui-object-item-col0.phui-object-item-badge {
|
||||
|
|
Loading…
Reference in a new issue