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

Add setImage to PHUIActionPanelView

Summary: Additonal option to use newly made images in these views.

Test Plan:
Built an example in UIExamples.

{F5071682}

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin

Differential Revision: https://secure.phabricator.com/D18299
This commit is contained in:
Chad Little 2017-07-30 12:21:36 -07:00
parent 1ad369b306
commit ddd7cbb698
4 changed files with 35 additions and 3 deletions

View file

@ -139,7 +139,7 @@ return array(
'rsrc/css/phui/object-item/phui-oi-list-view.css' => 'bf094950',
'rsrc/css/phui/object-item/phui-oi-simple-ui.css' => 'a8beebea',
'rsrc/css/phui/phui-action-list.css' => '6ee16164',
'rsrc/css/phui/phui-action-panel.css' => '91c7b835',
'rsrc/css/phui/phui-action-panel.css' => 'b4798122',
'rsrc/css/phui/phui-badge.css' => '22c0cf4f',
'rsrc/css/phui/phui-basic-nav-view.css' => 'a0705f53',
'rsrc/css/phui/phui-big-info-view.css' => 'd13afcde',
@ -818,7 +818,7 @@ return array(
'phortune-invoice-css' => '476055e2',
'phrequent-css' => 'ffc185ad',
'phriction-document-css' => '4282e4ad',
'phui-action-panel-css' => '91c7b835',
'phui-action-panel-css' => 'b4798122',
'phui-badge-view-css' => '22c0cf4f',
'phui-basic-nav-view-css' => 'a0705f53',
'phui-big-info-view-css' => 'd13afcde',

View file

@ -11,10 +11,15 @@ final class PHUIActionPanelExample extends PhabricatorUIExample {
}
public function renderExample() {
$viewer = $this->getRequest()->getUser();
$view = id(new AphrontMultiColumnView())
->setFluidLayout(true);
$credit = PhabricatorFile::loadBuiltin(
$viewer, 'projects/v3/creditcard.png');
$image = $credit->getBestURI();
/* Action Panels */
$panel1 = id(new PHUIActionPanelView())
->setIcon('fa-book')
@ -53,7 +58,7 @@ final class PHUIActionPanelExample extends PhabricatorUIExample {
/* Action Panels */
$panel1 = id(new PHUIActionPanelView())
->setIcon('fa-credit-card')
->setImage($image)
->setHeader(pht('Account Balance'))
->setHref('#')
->setSubHeader(pht('You were last billed $2,245.12 on Dec 12, 2014.'))

View file

@ -4,6 +4,7 @@ final class PHUIActionPanelView extends AphrontTagView {
private $href;
private $fontIcon;
private $image;
private $header;
private $subHeader;
private $bigText;
@ -29,6 +30,11 @@ final class PHUIActionPanelView extends AphrontTagView {
return $this;
}
public function setImage($image) {
$this->image = $image;
return $this;
}
public function setBigText($text) {
$this->bigText = $text;
return $this;
@ -89,6 +95,21 @@ final class PHUIActionPanelView extends AphrontTagView {
$fonticon);
}
if ($this->image) {
$image = phutil_tag(
'img',
array(
'class' => 'phui-action-panel-image',
'src' => $this->image,
));
$icon = phutil_tag(
'span',
array(
'class' => 'phui-action-panel-icon',
),
$image);
}
$header = null;
if ($this->header) {
$header = phutil_tag(

View file

@ -47,6 +47,12 @@
display: table-cell;
}
.phui-action-panel-image {
width: 48px;
height: 48px;
margin: 0 auto;
}
.phui-action-panel-icon a {
display: block;
}