Skip to content

Commit 0bcc761

Browse files
committedMar 30, 2013
Workboards
Summary: Adds Workboards and workpanels. This is a preliminary diff, I'm still working on mobile and tablet and a few missing features (header actions) Test Plan: FF, Chrome, iOS, iPad, iPhone, IE Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Differential Revision: https://secure.phabricator.com/D5455
1 parent c3c88fd commit 0bcc761

8 files changed

+470
-0
lines changed
 

‎src/__celerity_resource_map__.php

+25
Original file line numberDiff line numberDiff line change
@@ -595,6 +595,13 @@
595595
'disk' => '/rsrc/image/texture/grip.png',
596596
'type' => 'png',
597597
),
598+
'/rsrc/image/texture/panel-header-gradient.png' =>
599+
array(
600+
'hash' => 'ad9204dd3ef5b12b645d80677d8ccead',
601+
'uri' => '/res/ad9204dd/rsrc/image/texture/panel-header-gradient.png',
602+
'disk' => '/rsrc/image/texture/panel-header-gradient.png',
603+
'type' => 'png',
604+
),
598605
'/rsrc/image/texture/pholio-background.gif' =>
599606
array(
600607
'hash' => 'cf4561af116edf393dc583e5119fb412',
@@ -3378,6 +3385,24 @@
33783385
),
33793386
'disk' => '/rsrc/js/application/uiexample/ReactorSendPropertiesExample.js',
33803387
),
3388+
'phabricator-workboard-view-css' =>
3389+
array(
3390+
'uri' => '/res/98971c26/rsrc/css/layout/phabricator-workboard-view.css',
3391+
'type' => 'css',
3392+
'requires' =>
3393+
array(
3394+
),
3395+
'disk' => '/rsrc/css/layout/phabricator-workboard-view.css',
3396+
),
3397+
'phabricator-workpanel-view-css' =>
3398+
array(
3399+
'uri' => '/res/96a4b5cd/rsrc/css/layout/phabricator-workpanel-view.css',
3400+
'type' => 'css',
3401+
'requires' =>
3402+
array(
3403+
),
3404+
'disk' => '/rsrc/css/layout/phabricator-workpanel-view.css',
3405+
),
33813406
'phabricator-zindex-css' =>
33823407
array(
33833408
'uri' => '/res/fcbf82ad/rsrc/css/core/z-index.css',

‎src/__phutil_library_map__.php

+6
Original file line numberDiff line numberDiff line change
@@ -1433,6 +1433,8 @@
14331433
'PhabricatorUserStatusInvalidEpochException' => 'applications/people/exception/PhabricatorUserStatusInvalidEpochException.php',
14341434
'PhabricatorUserStatusOverlapException' => 'applications/people/exception/PhabricatorUserStatusOverlapException.php',
14351435
'PhabricatorUserTestCase' => 'applications/people/storage/__tests__/PhabricatorUserTestCase.php',
1436+
'PhabricatorWorkboardExample' => 'applications/uiexample/examples/PhabricatorWorkboardExample.php',
1437+
'PhabricatorWorkboardView' => 'view/layout/PhabricatorWorkboardView.php',
14361438
'PhabricatorWorker' => 'infrastructure/daemon/workers/PhabricatorWorker.php',
14371439
'PhabricatorWorkerActiveTask' => 'infrastructure/daemon/workers/storage/PhabricatorWorkerActiveTask.php',
14381440
'PhabricatorWorkerArchiveTask' => 'infrastructure/daemon/workers/storage/PhabricatorWorkerArchiveTask.php',
@@ -1444,6 +1446,7 @@
14441446
'PhabricatorWorkerTaskDetailController' => 'applications/daemon/controller/PhabricatorWorkerTaskDetailController.php',
14451447
'PhabricatorWorkerTaskUpdateController' => 'applications/daemon/controller/PhabricatorWorkerTaskUpdateController.php',
14461448
'PhabricatorWorkerTestCase' => 'infrastructure/daemon/workers/__tests__/PhabricatorWorkerTestCase.php',
1449+
'PhabricatorWorkpanelView' => 'view/layout/PhabricatorWorkpanelView.php',
14471450
'PhabricatorXHPASTViewController' => 'applications/phpast/controller/PhabricatorXHPASTViewController.php',
14481451
'PhabricatorXHPASTViewDAO' => 'applications/phpast/storage/PhabricatorXHPASTViewDAO.php',
14491452
'PhabricatorXHPASTViewFrameController' => 'applications/phpast/controller/PhabricatorXHPASTViewFrameController.php',
@@ -3077,6 +3080,8 @@
30773080
'PhabricatorUserStatusInvalidEpochException' => 'Exception',
30783081
'PhabricatorUserStatusOverlapException' => 'Exception',
30793082
'PhabricatorUserTestCase' => 'PhabricatorTestCase',
3083+
'PhabricatorWorkboardExample' => 'PhabricatorUIExample',
3084+
'PhabricatorWorkboardView' => 'AphrontView',
30803085
'PhabricatorWorkerActiveTask' => 'PhabricatorWorkerTask',
30813086
'PhabricatorWorkerArchiveTask' => 'PhabricatorWorkerTask',
30823087
'PhabricatorWorkerDAO' => 'PhabricatorLiskDAO',
@@ -3087,6 +3092,7 @@
30873092
'PhabricatorWorkerTaskDetailController' => 'PhabricatorDaemonController',
30883093
'PhabricatorWorkerTaskUpdateController' => 'PhabricatorDaemonController',
30893094
'PhabricatorWorkerTestCase' => 'PhabricatorTestCase',
3095+
'PhabricatorWorkpanelView' => 'AphrontView',
30903096
'PhabricatorXHPASTViewController' => 'PhabricatorController',
30913097
'PhabricatorXHPASTViewDAO' => 'PhabricatorLiskDAO',
30923098
'PhabricatorXHPASTViewFrameController' => 'PhabricatorXHPASTViewController',
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
1+
<?php
2+
3+
final class PhabricatorWorkboardExample extends PhabricatorUIExample {
4+
5+
public function getName() {
6+
return 'Workboard';
7+
}
8+
9+
public function getDescription() {
10+
return 'A board for visualizing work. Fixed and Fluid layouts.';
11+
}
12+
13+
public function renderExample() {
14+
15+
/* List 1 */
16+
17+
$list = new PhabricatorObjectItemListView();
18+
$list->setCards(true);
19+
$list->setFlush(true);
20+
21+
$list->addItem(
22+
id(new PhabricatorObjectItemView())
23+
->setHeader(pht('Business Card'))
24+
->setBarColor('red'));
25+
$list->addItem(
26+
id(new PhabricatorObjectItemView())
27+
->setHeader(pht('Playing Card'))
28+
->setBarColor('orange'));
29+
$list->addItem(
30+
id(new PhabricatorObjectItemView())
31+
->setHeader(pht('House of Cards'))
32+
->setBarColor('yellow'));
33+
$list->addItem(
34+
id(new PhabricatorObjectItemView())
35+
->setHeader(pht('Cardigan'))
36+
->setBarColor('green'));
37+
$list->addItem(
38+
id(new PhabricatorObjectItemView())
39+
->setHeader(pht('Cardamom'))
40+
->addFootIcon('highlight-white', 'Spice')
41+
->setBarColor('blue'));
42+
43+
/* List 2 */
44+
45+
$list2 = new PhabricatorObjectItemListView();
46+
$list2->setCards(true);
47+
$list2->setFlush(true);
48+
49+
$list2->addItem(
50+
id(new PhabricatorObjectItemView())
51+
->setHeader(pht('Business Card'))
52+
->setBarColor('red'));
53+
$list2->addItem(
54+
id(new PhabricatorObjectItemView())
55+
->setHeader(pht('Playing Card'))
56+
->setBarColor('orange'));
57+
58+
/* List 3 */
59+
60+
$list3 = new PhabricatorObjectItemListView();
61+
$list3->setCards(true);
62+
$list3->setFlush(true);
63+
64+
$list3->addItem(
65+
id(new PhabricatorObjectItemView())
66+
->setHeader(pht('Business Card'))
67+
->setBarColor('red'));
68+
$list3->addItem(
69+
id(new PhabricatorObjectItemView())
70+
->setHeader(pht('Playing Card'))
71+
->setBarColor('orange'));
72+
$list3->addItem(
73+
id(new PhabricatorObjectItemView())
74+
->setHeader(pht('House of Cards'))
75+
->setBarColor('yellow'));
76+
$list3->addItem(
77+
id(new PhabricatorObjectItemView())
78+
->setHeader(pht('Cardigan'))
79+
->setBarColor('green'));
80+
$list3->addItem(
81+
id(new PhabricatorObjectItemView())
82+
->setHeader(pht('Cardamom'))
83+
->addFootIcon('highlight-white', 'Spice')
84+
->setBarColor('blue'));
85+
$list3->addItem(
86+
id(new PhabricatorObjectItemView())
87+
->setHeader(pht('Business Card'))
88+
->setBarColor('red'));
89+
$list3->addItem(
90+
id(new PhabricatorObjectItemView())
91+
->setHeader(pht('Playing Card'))
92+
->setBarColor('orange'));
93+
$list3->addItem(
94+
id(new PhabricatorObjectItemView())
95+
->setHeader(pht('Business Card'))
96+
->setBarColor('red'));
97+
$list3->addItem(
98+
id(new PhabricatorObjectItemView())
99+
->setHeader(pht('Playing Card'))
100+
->setBarColor('orange'));
101+
102+
$panel = id(new PhabricatorWorkpanelView)
103+
->setCards($list)
104+
->setHeader('Business Stuff');
105+
106+
$panel2 = id(new PhabricatorWorkpanelView)
107+
->setCards($list2)
108+
->setHeader('Under Duress');
109+
110+
$panel3 = id(new PhabricatorWorkpanelView)
111+
->setCards($list3)
112+
->setHeader('Spicy Thai Chicken');
113+
114+
$board = id(new PhabricatorWorkboardView)
115+
->addPanel($panel)
116+
->addPanel($panel2)
117+
->addPanel($panel2)
118+
->addPanel($panel3);
119+
120+
$board2 = id(new PhabricatorWorkboardView)
121+
->setFlexLayout(true)
122+
->addPanel($panel)
123+
->addPanel($panel2)
124+
->addPanel($panel2)
125+
->addPanel($panel2)
126+
->addPanel($panel2)
127+
->addPanel($panel3);
128+
129+
$head1 = id(new PhabricatorHeaderView())
130+
->setHeader(pht('Fixed Panel'));
131+
132+
$head2 = id(new PhabricatorHeaderView())
133+
->setHeader(pht('Fluid Panel'));
134+
135+
136+
$wrap1 = phutil_tag(
137+
'div',
138+
array(
139+
'class' => 'ml'
140+
),
141+
$board);
142+
143+
$wrap2 = phutil_tag(
144+
'div',
145+
array(
146+
'class' => 'ml'
147+
),
148+
$board2);
149+
150+
return phutil_tag(
151+
'div',
152+
array(),
153+
array(
154+
$head1,
155+
$wrap1,
156+
$head2,
157+
$wrap2
158+
));
159+
}
160+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<?php
2+
3+
final class PhabricatorWorkboardView extends AphrontView {
4+
5+
private $panels = array();
6+
private $flexLayout = false;
7+
8+
public function addPanel(PhabricatorWorkpanelView $panel) {
9+
$this->panels[] = $panel;
10+
return $this;
11+
}
12+
13+
public function setFlexLayout($layout) {
14+
$this->flexLayout = $layout;
15+
return $this;
16+
}
17+
18+
public function render() {
19+
require_celerity_resource('phabricator-workboard-view-css');
20+
21+
$classes = array();
22+
$classes[] = 'phabricator-workboard-view-inner';
23+
24+
if (count($this->panels) > 6) {
25+
throw new Exception("No more than 6 panels per workboard.");
26+
}
27+
28+
$classes[] = 'workboard-'.count($this->panels).'-up';
29+
30+
$view = phutil_tag(
31+
'div',
32+
array(
33+
'class' => implode(' ', $classes),
34+
),
35+
array(
36+
$this->panels,
37+
));
38+
39+
$classes = array();
40+
$classes[] = 'phabricator-workboard-view-outer';
41+
if ($this->flexLayout) {
42+
$classes[] = 'phabricator-workboard-flex';
43+
} else {
44+
$classes[] = 'phabricator-workboard-fixed';
45+
}
46+
47+
return phutil_tag(
48+
'div',
49+
array(
50+
'class' => implode(' ', $classes)
51+
),
52+
$view);
53+
}
54+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
<?php
2+
3+
final class PhabricatorWorkpanelView extends AphrontView {
4+
5+
private $cards = array();
6+
private $header;
7+
private $headerAction;
8+
private $footerAction;
9+
10+
public function setCards(PhabricatorObjectItemListView $cards) {
11+
$this->cards[] = $cards;
12+
return $this;
13+
}
14+
15+
public function setHeader($header) {
16+
$this->header = $header;
17+
return $this;
18+
}
19+
20+
public function setHeaderAction($header_action) {
21+
$this->headerAction = $header_action;
22+
return $this;
23+
}
24+
25+
public function setFooterAction($footer_action) {
26+
$this->footerAction = $footer_action;
27+
return $this;
28+
}
29+
30+
public function render() {
31+
require_celerity_resource('phabricator-workpanel-view-css');
32+
33+
$footer = '';
34+
if ($this->footerAction) {
35+
$action = $this->footerAction;
36+
$footer = javelin_tag(
37+
'a',
38+
array(
39+
'href' => $action->getHref(),
40+
'class' => 'phabricator-workpanel-footer-action',
41+
'sigil' => $action->getWorkflow() ? 'workflow' : null,
42+
),
43+
$action->getName());
44+
}
45+
46+
$header = phutil_tag(
47+
'div',
48+
array(
49+
'class' => 'phabricator-workpanel-header'
50+
),
51+
$this->header);
52+
53+
$body = phutil_tag(
54+
'div',
55+
array(
56+
'class' => 'phabricator-workpanel-body'
57+
),
58+
$this->cards);
59+
60+
$view = phutil_tag(
61+
'div',
62+
array(
63+
'class' => 'phabricator-workpanel-view-inner',
64+
),
65+
array(
66+
$header,
67+
$body,
68+
$footer,
69+
));
70+
71+
return phutil_tag(
72+
'div',
73+
array(
74+
'class' => 'phabricator-workpanel-view'
75+
),
76+
$view);
77+
}
78+
}

0 commit comments

Comments
 (0)
Failed to load comments.