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:
parent
9966af50dd
commit
c812d7d686
2 changed files with 47 additions and 0 deletions
|
@ -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',
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
<?php
|
||||
|
||||
final class PhabricatorButtonsExample extends PhabricatorUIExample {
|
||||
|
||||
public function getName() {
|
||||
return 'Buttons';
|
||||
}
|
||||
|
||||
public function getDescription() {
|
||||
return 'Use <tt><button></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>';
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue