1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-28 16:30:59 +01:00

Build LauncherButton for PHUIObjectItemView

Summary: There are a handful of places I've been wanting to use a button here. Adds that ability and uses in app launcher.

Test Plan:
Test Applicatons->Launcher at desktop, mobile, tablet breakpoints

{F780453}

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin

Differential Revision: https://secure.phabricator.com/D14059
This commit is contained in:
Chad Little 2015-09-04 10:34:25 -07:00
parent cd2f9786bf
commit 7641c9c7bc
4 changed files with 58 additions and 30 deletions

View file

@ -7,7 +7,7 @@
*/ */
return array( return array(
'names' => array( 'names' => array(
'core.pkg.css' => '994de4ed', 'core.pkg.css' => 'a40c0b28',
'core.pkg.js' => '47dc9ebb', 'core.pkg.js' => '47dc9ebb',
'darkconsole.pkg.js' => 'e7393ebb', 'darkconsole.pkg.js' => 'e7393ebb',
'differential.pkg.css' => '2de124c9', 'differential.pkg.css' => '2de124c9',
@ -93,7 +93,7 @@ return array(
'rsrc/css/application/policy/policy-edit.css' => '815c66f7', 'rsrc/css/application/policy/policy-edit.css' => '815c66f7',
'rsrc/css/application/policy/policy-transaction-detail.css' => '82100a43', 'rsrc/css/application/policy/policy-transaction-detail.css' => '82100a43',
'rsrc/css/application/policy/policy.css' => '957ea14c', 'rsrc/css/application/policy/policy.css' => '957ea14c',
'rsrc/css/application/ponder/ponder-view.css' => 'bef48f86', 'rsrc/css/application/ponder/ponder-view.css' => '7b0df4da',
'rsrc/css/application/projects/project-icon.css' => '4e3eaa5a', 'rsrc/css/application/projects/project-icon.css' => '4e3eaa5a',
'rsrc/css/application/releeph/releeph-core.css' => '9b3c5733', 'rsrc/css/application/releeph/releeph-core.css' => '9b3c5733',
'rsrc/css/application/releeph/releeph-preview-branch.css' => 'b7a6f4a5', 'rsrc/css/application/releeph/releeph-preview-branch.css' => 'b7a6f4a5',
@ -104,7 +104,7 @@ return array(
'rsrc/css/application/tokens/tokens.css' => '3d0f239e', 'rsrc/css/application/tokens/tokens.css' => '3d0f239e',
'rsrc/css/application/uiexample/example.css' => '528b19de', 'rsrc/css/application/uiexample/example.css' => '528b19de',
'rsrc/css/core/core.css' => 'a76cefc9', 'rsrc/css/core/core.css' => 'a76cefc9',
'rsrc/css/core/remarkup.css' => '73fc4395', 'rsrc/css/core/remarkup.css' => 'ef286a6e',
'rsrc/css/core/syntax.css' => '9fd11da8', 'rsrc/css/core/syntax.css' => '9fd11da8',
'rsrc/css/core/z-index.css' => '57ddcaa2', 'rsrc/css/core/z-index.css' => '57ddcaa2',
'rsrc/css/diviner/diviner-shared.css' => '5a337049', 'rsrc/css/diviner/diviner-shared.css' => '5a337049',
@ -138,10 +138,10 @@ return array(
'rsrc/css/phui/phui-info-view.css' => '5b16bac6', 'rsrc/css/phui/phui-info-view.css' => '5b16bac6',
'rsrc/css/phui/phui-list.css' => '125599df', 'rsrc/css/phui/phui-list.css' => '125599df',
'rsrc/css/phui/phui-object-box.css' => '407eaf5a', 'rsrc/css/phui/phui-object-box.css' => '407eaf5a',
'rsrc/css/phui/phui-object-item-list-view.css' => 'ab1bf393', 'rsrc/css/phui/phui-object-item-list-view.css' => '26c30d3f',
'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-property-list-view.css' => '318d4dea', 'rsrc/css/phui/phui-property-list-view.css' => '03904f6b',
'rsrc/css/phui/phui-remarkup-preview.css' => '867f85b3', 'rsrc/css/phui/phui-remarkup-preview.css' => '867f85b3',
'rsrc/css/phui/phui-spacing.css' => '042804d6', 'rsrc/css/phui/phui-spacing.css' => '042804d6',
'rsrc/css/phui/phui-status.css' => '888cedb8', 'rsrc/css/phui/phui-status.css' => '888cedb8',
@ -737,7 +737,7 @@ return array(
'phabricator-object-selector-css' => '85ee8ce6', 'phabricator-object-selector-css' => '85ee8ce6',
'phabricator-phtize' => 'd254d646', 'phabricator-phtize' => 'd254d646',
'phabricator-prefab' => '6920d200', 'phabricator-prefab' => '6920d200',
'phabricator-remarkup-css' => '73fc4395', 'phabricator-remarkup-css' => 'ef286a6e',
'phabricator-search-results-css' => '7dea472c', 'phabricator-search-results-css' => '7dea472c',
'phabricator-shaped-request' => '7cbe244b', 'phabricator-shaped-request' => '7cbe244b',
'phabricator-side-menu-view-css' => 'bec2458e', 'phabricator-side-menu-view-css' => 'bec2458e',
@ -791,10 +791,10 @@ return array(
'phui-inline-comment-view-css' => '0fdb3667', 'phui-inline-comment-view-css' => '0fdb3667',
'phui-list-view-css' => '125599df', 'phui-list-view-css' => '125599df',
'phui-object-box-css' => '407eaf5a', 'phui-object-box-css' => '407eaf5a',
'phui-object-item-list-view-css' => 'ab1bf393', 'phui-object-item-list-view-css' => '26c30d3f',
'phui-pager-css' => 'bea33d23', 'phui-pager-css' => 'bea33d23',
'phui-pinboard-view-css' => '2495140e', 'phui-pinboard-view-css' => '2495140e',
'phui-property-list-view-css' => '318d4dea', 'phui-property-list-view-css' => '03904f6b',
'phui-remarkup-preview-css' => '867f85b3', 'phui-remarkup-preview-css' => '867f85b3',
'phui-spacing-css' => '042804d6', 'phui-spacing-css' => '042804d6',
'phui-status-list-view-css' => '888cedb8', 'phui-status-list-view-css' => '888cedb8',
@ -811,7 +811,7 @@ return array(
'policy-css' => '957ea14c', 'policy-css' => '957ea14c',
'policy-edit-css' => '815c66f7', 'policy-edit-css' => '815c66f7',
'policy-transaction-detail-css' => '82100a43', 'policy-transaction-detail-css' => '82100a43',
'ponder-view-css' => 'bef48f86', 'ponder-view-css' => '7b0df4da',
'project-icon-css' => '4e3eaa5a', 'project-icon-css' => '4e3eaa5a',
'raphael-core' => '51ee6b43', 'raphael-core' => '51ee6b43',
'raphael-g' => '40dde778', 'raphael-g' => '40dde778',

View file

@ -226,39 +226,36 @@ final class PhabricatorAppSearchEngine
), ),
''); '');
$description = phutil_tag( $description = $application->getShortDescription();
'div',
array( $configure = id(new PHUIButtonView())
'style' => 'white-space: nowrap; '. ->setTag('a')
'overflow: hidden; '. ->setHref('/applications/view/'.get_class($application).'/')
'text-overflow: ellipsis;', ->setText(pht('Configure'))
), ->setColor(PHUIButtonView::GREY);
$application->getShortDescription());
$name = $application->getName();
if ($application->isPrototype()) {
$name = $name.' '.pht('(Prototype)');
}
$item = id(new PHUIObjectItemView()) $item = id(new PHUIObjectItemView())
->setHeader($application->getName()) ->setHeader($name)
->setImageIcon($icon_view) ->setImageIcon($icon_view)
->addAttribute($description) ->setSubhead($description)
->addAction( ->setLaunchButton($configure);
id(new PHUIListItemView())
->setName(pht('Help/Options'))
->setIcon('fa-cog')
->setHref('/applications/view/'.get_class($application).'/'));
if ($application->getBaseURI() && $application->isInstalled()) { if ($application->getBaseURI() && $application->isInstalled()) {
$item->setHref($application->getBaseURI()); $item->setHref($application->getBaseURI());
} }
if (!$application->isInstalled()) { if (!$application->isInstalled()) {
$item->addIcon('fa-times', pht('Uninstalled')); $item->addAttribute(pht('Uninstalled'));
} $item->setDisabled(true);
if ($application->isPrototype()) {
$item->addIcon('fa-bomb grey', pht('Prototype'));
} }
if (!$application->isFirstParty()) { if (!$application->isFirstParty()) {
$item->addIcon('fa-puzzle-piece', pht('Extension')); $item->addAttribute(pht('Extension'));
} }
$list->addItem($item); $list->addItem($item);

View file

@ -26,6 +26,7 @@ final class PHUIObjectItemView extends AphrontTagView {
private $badge; private $badge;
private $countdownNum; private $countdownNum;
private $countdownNoun; private $countdownNoun;
private $launchButton;
const AGE_FRESH = 'fresh'; const AGE_FRESH = 'fresh';
const AGE_STALE = 'stale'; const AGE_STALE = 'stale';
@ -260,6 +261,12 @@ final class PHUIObjectItemView extends AphrontTagView {
return $this; return $this;
} }
public function setLaunchButton(PHUIButtonView $button) {
$button->setSize(PHUIButtonView::SMALL);
$this->launchButton = $button;
return $this;
}
protected function getTagName() { protected function getTagName() {
return 'li'; return 'li';
} }
@ -652,6 +659,17 @@ final class PHUIObjectItemView extends AphrontTagView {
)); ));
} }
if ($this->launchButton) {
$column2 = phutil_tag(
'div',
array(
'class' => 'phui-object-item-col2 phui-object-item-launch-button',
),
array(
$this->launchButton,
));
}
$table = phutil_tag( $table = phutil_tag(
'div', 'div',
array( array(

View file

@ -747,3 +747,16 @@ ul.phui-object-item-list-view .phui-object-item-selected
.phui-object-item-with-image .phui-object-item-content-box { .phui-object-item-with-image .phui-object-item-content-box {
margin-left: 46px; margin-left: 46px;
} }
/* - Launcher Button -------------------------------------------------------- */
.phui-object-item-col2.phui-object-item-launch-button {
text-align: right;
vertical-align: middle;
padding-right: 4px;
}
.device-phone .phui-object-item-col2.phui-object-item-launch-button {
padding: 0 8px 8px;
text-align: left;
}