Skip to content

Commit a2ebfef

Browse files
committed
Footer actions for work panels.
Summary: Adds action items in the footer of workpanels. Test Plan: UIExamples on Chrome. Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Differential Revision: https://secure.phabricator.com/D5492
1 parent 4741b6c commit a2ebfef

File tree

5 files changed

+50
-15
lines changed

5 files changed

+50
-15
lines changed

src/__celerity_resource_map__.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3396,7 +3396,7 @@
33963396
),
33973397
'phabricator-workpanel-view-css' =>
33983398
array(
3399-
'uri' => '/res/96a4b5cd/rsrc/css/layout/phabricator-workpanel-view.css',
3399+
'uri' => '/res/db76713b/rsrc/css/layout/phabricator-workpanel-view.css',
34003400
'type' => 'css',
34013401
'requires' =>
34023402
array(

src/applications/uiexample/examples/PhabricatorWorkboardExample.php

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,15 +101,20 @@ public function renderExample() {
101101

102102
$panel = id(new PhabricatorWorkpanelView)
103103
->setCards($list)
104-
->setHeader('Business Stuff');
104+
->setHeader('Business Stuff')
105+
->setFooterAction(
106+
id(new PhabricatorMenuItemView())
107+
->setName(pht('Add Task'))
108+
->setIcon('new')
109+
->setHref('/maniphest/task/create/'));
105110

106111
$panel2 = id(new PhabricatorWorkpanelView)
107112
->setCards($list2)
108113
->setHeader('Under Duress');
109114

110115
$panel3 = id(new PhabricatorWorkpanelView)
111-
->setCards($list3)
112-
->setHeader('Spicy Thai Chicken');
116+
->setCards($list3)
117+
->setHeader('Spicy Thai Chicken');
113118

114119
$board = id(new PhabricatorWorkboardView)
115120
->addPanel($panel)
@@ -122,7 +127,7 @@ public function renderExample() {
122127
->addPanel($panel)
123128
->addPanel($panel2)
124129
->addPanel($panel2)
125-
->addPanel($panel2)
130+
->addPanel($panel)
126131
->addPanel($panel2)
127132
->addPanel($panel3);
128133

src/view/layout/PhabricatorMenuItemView.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,26 @@ protected function getTagAttributes() {
104104

105105
protected function getTagContent() {
106106
$name = null;
107+
$icon = null;
108+
107109
if ($this->name) {
110+
108111
$external = null;
109112
if ($this->isExternal) {
110113
$external = " \xE2\x86\x97";
111114
}
115+
116+
if ($this->icon) {
117+
require_celerity_resource('sprite-icon-css');
118+
$icon = phutil_tag(
119+
'span',
120+
array(
121+
'class' => 'phabricator-menu-item-icon sprite-icon '.
122+
'action-'.$this->icon,
123+
),
124+
'');
125+
}
126+
112127
$name = phutil_tag(
113128
'span',
114129
array(
@@ -121,6 +136,7 @@ protected function getTagContent() {
121136
}
122137

123138
return array(
139+
$icon,
124140
$this->renderChildren(),
125141
$name,
126142
);

src/view/layout/PhabricatorWorkpanelView.php

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public function setHeaderAction($header_action) {
2222
return $this;
2323
}
2424

25-
public function setFooterAction($footer_action) {
25+
public function setFooterAction(PhabricatorMenuItemView $footer_action) {
2626
$this->footerAction = $footer_action;
2727
return $this;
2828
}
@@ -32,15 +32,13 @@ public function render() {
3232

3333
$footer = '';
3434
if ($this->footerAction) {
35-
$action = $this->footerAction;
36-
$footer = javelin_tag(
37-
'a',
35+
$footer_tag = $this->footerAction;
36+
$footer = phutil_tag(
37+
'div',
3838
array(
39-
'href' => $action->getHref(),
40-
'class' => 'phabricator-workpanel-footer-action',
41-
'sigil' => $action->getWorkflow() ? 'workflow' : null,
39+
'class' => 'phabricator-workpanel-footer-action mst ps'
4240
),
43-
$action->getName());
41+
$footer_tag);
4442
}
4543

4644
$header = phutil_tag(

webroot/rsrc/css/layout/phabricator-workpanel-view.css

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,24 @@
6363
box-shadow: inset 0 0px 5px rgba(0,0,0,.4);
6464
}
6565

66-
.phabricator-workpanel-view .phabricator-workpanel-footer {
67-
padding: 8px 5px;
66+
.phabricator-workpanel-view .phabricator-workpanel-footer-action a {
67+
color: #333;
68+
font-weight: bold;
69+
}
70+
71+
.device-desktop .phabricator-workpanel-view .phabricator-workpanel-footer-action:hover {
72+
background-color: rgba(100,100,100,.1);
73+
}
74+
75+
.phabricator-workpanel-view .phabricator-menu-item-icon {
76+
height: 12px;
77+
width: 12px;
78+
display: inline-block;
79+
}
80+
81+
.phabricator-workpanel-view .phabricator-menu-item-name {
82+
padding-left: 5px;
83+
display: inline-block;
6884
}
6985

7086
/* fluid/flex styles */

0 commit comments

Comments
 (0)