1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-11 17:32:41 +01:00
phorge-phorge/src/applications/uiexample/examples/PhabricatorWorkboardExample.php
Chad Little f1bf27959f PHUIList, PHUIDocument updates
Summary:
This diff covers a bit of ground.

- PHUIDocumentExample has been added
- PHUIDocument has been extended with new features
- PhabricatorMenuView is now PHUIListView
- PhabricatorMenuItemView is now PHUIItemListView

Overall - I think I've gotten all the edges covered here. There is some derpi-ness that we can talk about, comments in the code. Responsive design is missing from the new features on PHUIDocument, will follow up later.

Test Plan: Tested mobile and desktop menus, old phriction layout, new document views, new lists, and object lists.

Reviewers: epriestley, btrahan

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D6130
2013-06-05 08:41:43 -07:00

197 lines
5.6 KiB
PHP

<?php
final class PhabricatorWorkboardExample extends PhabricatorUIExample {
public function getName() {
return 'Workboard';
}
public function getDescription() {
return 'A board for visualizing work. Fixed and Fluid layouts.';
}
public function renderExample() {
/* List 1 */
$list = new PhabricatorObjectItemListView();
$list->setCards(true);
$list->setFlush(true);
$list->addItem(
id(new PhabricatorObjectItemView())
->setHeader(pht('Business Card'))
->setBarColor('red'));
$list->addItem(
id(new PhabricatorObjectItemView())
->setHeader(pht('Playing Card'))
->setBarColor('orange'));
$list->addItem(
id(new PhabricatorObjectItemView())
->setHeader(pht('House of Cards'))
->setBarColor('yellow'));
$list->addItem(
id(new PhabricatorObjectItemView())
->setHeader(pht('Cardigan'))
->setBarColor('green'));
$list->addItem(
id(new PhabricatorObjectItemView())
->setHeader(pht('Cardamom'))
->addFootIcon('highlight-white', 'Spice')
->setBarColor('blue'));
/* List 2 */
$list2 = new PhabricatorObjectItemListView();
$list2->setCards(true);
$list2->setFlush(true);
$list2->addItem(
id(new PhabricatorObjectItemView())
->setHeader(pht('Business Card'))
->setBarColor('red'));
$list2->addItem(
id(new PhabricatorObjectItemView())
->setHeader(pht('Playing Card'))
->setBarColor('orange'));
/* List 3 */
$list3 = new PhabricatorObjectItemListView();
$list3->setCards(true);
$list3->setFlush(true);
$list3->addItem(
id(new PhabricatorObjectItemView())
->setHeader(pht('Business Card'))
->setBarColor('red'));
$list3->addItem(
id(new PhabricatorObjectItemView())
->setHeader(pht('Playing Card'))
->setBarColor('orange'));
$list3->addItem(
id(new PhabricatorObjectItemView())
->setHeader(pht('House of Cards'))
->setBarColor('yellow'));
$list3->addItem(
id(new PhabricatorObjectItemView())
->setHeader(pht('Cardigan'))
->setBarColor('green'));
$list3->addItem(
id(new PhabricatorObjectItemView())
->setHeader(pht('Cardamom'))
->addFootIcon('highlight-white', 'Spice')
->setBarColor('blue'));
$list3->addItem(
id(new PhabricatorObjectItemView())
->setHeader(pht('Business Card'))
->setBarColor('red'));
$list3->addItem(
id(new PhabricatorObjectItemView())
->setHeader(pht('Playing Card'))
->setBarColor('orange'));
$list3->addItem(
id(new PhabricatorObjectItemView())
->setHeader(pht('Business Card'))
->setBarColor('red'));
$list3->addItem(
id(new PhabricatorObjectItemView())
->setHeader(pht('Playing Card'))
->setBarColor('orange'));
$panel = id(new PhabricatorWorkpanelView())
->setCards($list)
->setHeader('Business Stuff')
->setFooterAction(
id(new PHUIListItemView())
->setName(pht('Add Task'))
->setIcon('new')
->setHref('/maniphest/task/create/'));
$panel2 = id(new PhabricatorWorkpanelView())
->setCards($list2)
->setHeader('Under Duress');
$panel3 = id(new PhabricatorWorkpanelView())
->setCards($list3)
->setHeader('Spicy Thai Chicken');
$board = id(new PhabricatorWorkboardView())
->addPanel($panel)
->addPanel($panel2)
->addPanel($panel2)
->addPanel($panel3);
$board2 = id(new PhabricatorWorkboardView())
->setFluidLayout(true)
->addPanel($panel)
->addPanel($panel2)
->addPanel($panel2)
->addPanel($panel)
->addPanel($panel2)
->addPanel($panel3);
$action = new PHUIIconView();
$action->setHref('/maniphest/task/create');
$action->setImage('/rsrc/image/actions/edit.png');
$person1 = new PHUIIconView();
$person1->setHref('http://en.wikipedia.org/wiki/George_Washington');
$person1->setImage(
celerity_get_resource_uri('/rsrc/image/people/washington.png'));
$person2 = new PHUIIconView();
$person2->setHref('http://en.wikipedia.org/wiki/Warren_G._Harding');
$person2->setImage(
celerity_get_resource_uri('/rsrc/image/people/harding.png'));
$person3 = new PHUIIconView();
$person3->setHref('http://en.wikipedia.org/wiki/William_Howard_Taft');
$person3->setImage(
celerity_get_resource_uri('/rsrc/image/people/taft.png'));
$board3 = id(new PhabricatorWorkboardView())
->setFluidLayout(true)
->addPanel($panel)
->addPanel($panel)
->addPanel($panel2)
->addPanel($panel3)
->addAction($action)
->addAction($person1)
->addAction($person2)
->addAction($person3);
$head1 = id(new PhabricatorHeaderView())
->setHeader(pht('Fixed Panel'));
$head2 = id(new PhabricatorHeaderView())
->setHeader(pht('Fluid Panel'));
$head3 = id(new PhabricatorHeaderView())
->setHeader(pht('Action Panel'));
$wrap1 = id(new PHUIBoxView())
->appendChild($board)
->addMargin(PHUI::MARGIN_LARGE);
$wrap2 = id(new PHUIBoxView())
->appendChild($board2)
->addMargin(PHUI::MARGIN_LARGE);
$wrap3 = id(new PHUIBoxView())
->appendChild($board3)
->addMargin(PHUI::MARGIN_LARGE);
return phutil_tag(
'div',
array(),
array(
$head1,
$wrap1,
$head2,
$wrap2,
$head3,
$wrap3
));
}
}