2013-04-18 11:34:02 -07:00
|
|
|
<?php
|
|
|
|
|
|
|
|
final class PHUIBoxExample extends PhabricatorUIExample {
|
|
|
|
|
|
|
|
public function getName() {
|
|
|
|
return 'Box';
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getDescription() {
|
|
|
|
return 'It\'s a fancy or non-fancy box. Put stuff in it.';
|
|
|
|
}
|
|
|
|
|
|
|
|
public function renderExample() {
|
|
|
|
|
|
|
|
$content1 = 'Asmund and Signy';
|
|
|
|
$content2 = 'The Cottager and his Cat';
|
|
|
|
$content3 = 'Geirlug The King\'s Daughter';
|
|
|
|
|
|
|
|
$layout1 =
|
|
|
|
array(
|
|
|
|
id(new PHUIBoxView())
|
|
|
|
->appendChild($content1),
|
|
|
|
id(new PHUIBoxView())
|
|
|
|
->appendChild($content2),
|
|
|
|
id(new PHUIBoxView())
|
2014-10-08 00:01:04 +11:00
|
|
|
->appendChild($content3),
|
|
|
|
);
|
2013-04-18 11:34:02 -07:00
|
|
|
|
|
|
|
|
|
|
|
$layout2 =
|
|
|
|
array(
|
|
|
|
id(new PHUIBoxView())
|
|
|
|
->appendChild($content1)
|
|
|
|
->addMargin(PHUI::MARGIN_SMALL_LEFT),
|
|
|
|
id(new PHUIBoxView())
|
|
|
|
->appendChild($content2)
|
|
|
|
->addMargin(PHUI::MARGIN_MEDIUM_LEFT)
|
|
|
|
->addMargin(PHUI::MARGIN_MEDIUM_TOP),
|
|
|
|
id(new PHUIBoxView())
|
|
|
|
->appendChild($content3)
|
|
|
|
->addMargin(PHUI::MARGIN_LARGE_LEFT)
|
2014-10-08 00:01:04 +11:00
|
|
|
->addMargin(PHUI::MARGIN_LARGE_TOP),
|
|
|
|
);
|
2013-04-18 11:34:02 -07:00
|
|
|
|
|
|
|
$layout3 =
|
|
|
|
array(
|
|
|
|
id(new PHUIBoxView())
|
|
|
|
->appendChild($content1)
|
2014-02-10 16:04:42 -08:00
|
|
|
->setBorder(true)
|
2013-04-18 11:34:02 -07:00
|
|
|
->addPadding(PHUI::PADDING_SMALL)
|
|
|
|
->addMargin(PHUI::MARGIN_LARGE_BOTTOM),
|
|
|
|
id(new PHUIBoxView())
|
|
|
|
->appendChild($content2)
|
2014-02-10 16:04:42 -08:00
|
|
|
->setBorder(true)
|
2013-04-18 11:34:02 -07:00
|
|
|
->addPadding(PHUI::PADDING_MEDIUM)
|
|
|
|
->addMargin(PHUI::MARGIN_LARGE_BOTTOM),
|
|
|
|
id(new PHUIBoxView())
|
|
|
|
->appendChild($content3)
|
2014-02-10 16:04:42 -08:00
|
|
|
->setBorder(true)
|
2013-04-18 11:34:02 -07:00
|
|
|
->addPadding(PHUI::PADDING_LARGE)
|
2014-10-08 00:01:04 +11:00
|
|
|
->addMargin(PHUI::MARGIN_LARGE_BOTTOM),
|
|
|
|
);
|
2013-04-18 11:34:02 -07:00
|
|
|
|
2013-12-03 08:34:04 -08:00
|
|
|
$image = id(new PHUIIconView())
|
2014-05-12 10:08:32 -07:00
|
|
|
->setIconFont('fa-heart');
|
2013-12-03 08:34:04 -08:00
|
|
|
$button = id(new PHUIButtonView())
|
|
|
|
->setTag('a')
|
|
|
|
->setColor(PHUIButtonView::SIMPLE)
|
|
|
|
->setIcon($image)
|
|
|
|
->setText('Such Wow')
|
|
|
|
->addClass(PHUI::MARGIN_SMALL_RIGHT);
|
|
|
|
|
|
|
|
$header = id(new PHUIHeaderView())
|
|
|
|
->setHeader('Fancy Box')
|
|
|
|
->addActionLink($button);
|
|
|
|
|
|
|
|
$obj4 = id(new PHUIObjectBoxView())
|
|
|
|
->setHeader($header)
|
|
|
|
->appendChild(id(new PHUIBoxView())
|
|
|
|
->addPadding(PHUI::PADDING_MEDIUM)
|
|
|
|
->appendChild('Such Fancy, Nice Box, Many Corners.'));
|
|
|
|
|
2013-09-17 09:12:37 -07:00
|
|
|
$head1 = id(new PHUIHeaderView())
|
2013-04-18 11:34:02 -07:00
|
|
|
->setHeader(pht('Plain Box'));
|
|
|
|
|
2013-09-17 09:12:37 -07:00
|
|
|
$head2 = id(new PHUIHeaderView())
|
2013-04-18 11:34:02 -07:00
|
|
|
->setHeader(pht('Plain Box with space'));
|
|
|
|
|
2013-09-17 09:12:37 -07:00
|
|
|
$head3 = id(new PHUIHeaderView())
|
2014-02-10 16:04:42 -08:00
|
|
|
->setHeader(pht('Border Box with space'));
|
2013-04-18 11:34:02 -07:00
|
|
|
|
2013-12-03 08:34:04 -08:00
|
|
|
$head4 = id(new PHUIHeaderView())
|
|
|
|
->setHeader(pht('PHUIObjectBoxView'));
|
|
|
|
|
2013-04-18 11:34:02 -07:00
|
|
|
$wrap1 = id(new PHUIBoxView())
|
|
|
|
->appendChild($layout1)
|
|
|
|
->addMargin(PHUI::MARGIN_LARGE);
|
|
|
|
|
|
|
|
$wrap2 = id(new PHUIBoxView())
|
|
|
|
->appendChild($layout2)
|
|
|
|
->addMargin(PHUI::MARGIN_LARGE);
|
|
|
|
|
|
|
|
$wrap3 = id(new PHUIBoxView())
|
|
|
|
->appendChild($layout3)
|
|
|
|
->addMargin(PHUI::MARGIN_LARGE);
|
|
|
|
|
|
|
|
return phutil_tag(
|
|
|
|
'div',
|
|
|
|
array(),
|
|
|
|
array(
|
|
|
|
$head1,
|
|
|
|
$wrap1,
|
|
|
|
$head2,
|
|
|
|
$wrap2,
|
|
|
|
$head3,
|
2013-12-03 08:34:04 -08:00
|
|
|
$wrap3,
|
|
|
|
$head4,
|
|
|
|
$obj4,
|
2013-04-18 11:34:02 -07:00
|
|
|
));
|
2014-06-18 14:09:37 -07:00
|
|
|
}
|
2013-04-18 11:34:02 -07:00
|
|
|
}
|