1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-10 08:52:39 +01:00

Add a simple button UIExample

Summary: For visualizing D3919.

Test Plan: {F22921}

Reviewers: chad, btrahan

Reviewed By: chad

CC: aran

Differential Revision: https://secure.phabricator.com/D3922
This commit is contained in:
epriestley 2012-11-08 08:22:08 -08:00
parent 9966af50dd
commit c812d7d686
2 changed files with 47 additions and 0 deletions

View file

@ -608,6 +608,7 @@ phutil_register_library_map(array(
'PhabricatorBarePageView' => 'view/page/PhabricatorBarePageView.php',
'PhabricatorBaseEnglishTranslation' => 'infrastructure/internationalization/PhabricatorBaseEnglishTranslation.php',
'PhabricatorBuiltinPatchList' => 'infrastructure/storage/patch/PhabricatorBuiltinPatchList.php',
'PhabricatorButtonsExample' => 'applications/uiexample/examples/PhabricatorButtonsExample.php',
'PhabricatorCacheDAO' => 'applications/cache/storage/PhabricatorCacheDAO.php',
'PhabricatorCalendarBrowseController' => 'applications/calendar/controller/PhabricatorCalendarBrowseController.php',
'PhabricatorCalendarController' => 'applications/calendar/controller/PhabricatorCalendarController.php',
@ -1821,6 +1822,7 @@ phutil_register_library_map(array(
'PhabricatorBarePageView' => 'AphrontPageView',
'PhabricatorBaseEnglishTranslation' => 'PhabricatorTranslation',
'PhabricatorBuiltinPatchList' => 'PhabricatorSQLPatchList',
'PhabricatorButtonsExample' => 'PhabricatorUIExample',
'PhabricatorCacheDAO' => 'PhabricatorLiskDAO',
'PhabricatorCalendarBrowseController' => 'PhabricatorCalendarController',
'PhabricatorCalendarController' => 'PhabricatorController',

View file

@ -0,0 +1,45 @@
<?php
final class PhabricatorButtonsExample extends PhabricatorUIExample {
public function getName() {
return 'Buttons';
}
public function getDescription() {
return 'Use <tt>&lt;button&gt;</tt> to render buttons.';
}
public function renderExample() {
$request = $this->getRequest();
$user = $request->getUser();
$colors = array('', 'green', 'grey', 'disabled');
$sizes = array('', 'small');
$tags = array('a', 'button');
$view = array();
foreach ($tags as $tag) {
foreach ($colors as $color) {
foreach ($sizes as $size) {
$class = implode(' ', array($color, $size));
if ($tag == 'a') {
$class .= ' button';
}
$view[] = phutil_render_tag(
$tag,
array(
'class' => $class,
),
phutil_escape_html(ucwords($size.' '.$color.' '.$tag)));
$view[] = '<br /><br />';
}
}
}
return '<div style="margin: 1em 2em;">'.implode('', $view).'</div>';
}
}