Page MenuHomePhorge

No OneTemporary

diff --git a/src/applications/uiexample/examples/JavelinReactorUIExample.php b/src/applications/uiexample/examples/JavelinReactorUIExample.php
index 2ecb69bf3d..9104c84c27 100644
--- a/src/applications/uiexample/examples/JavelinReactorUIExample.php
+++ b/src/applications/uiexample/examples/JavelinReactorUIExample.php
@@ -1,90 +1,91 @@
<?php
final class JavelinReactorUIExample extends PhabricatorUIExample {
public function getName() {
return 'Javelin Reactor';
}
public function getDescription() {
return 'Lots of code';
}
public function renderExample() {
$rows = array();
$examples = array(
array(
'Reactive button only generates a stream of events',
'ReactorButtonExample',
'phabricator-uiexample-reactor-button',
array(),
),
array(
'Reactive checkbox generates a boolean dynamic value',
'ReactorCheckboxExample',
'phabricator-uiexample-reactor-checkbox',
array('checked' => true),
),
array(
'Reactive focus detector generates a boolean dynamic value',
'ReactorFocusExample',
'phabricator-uiexample-reactor-focus',
array(),
),
array(
'Reactive input box, with normal and calmed output',
'ReactorInputExample',
'phabricator-uiexample-reactor-input',
array('init' => 'Initial value'),
),
array(
'Reactive mouseover detector generates a boolean dynamic value',
'ReactorMouseoverExample',
'phabricator-uiexample-reactor-mouseover',
array(),
),
array(
'Reactive radio buttons generate a string dynamic value',
'ReactorRadioExample',
'phabricator-uiexample-reactor-radio',
array(),
),
array(
'Reactive select box generates a string dynamic value',
'ReactorSelectExample',
'phabricator-uiexample-reactor-select',
array(),
),
array(
'sendclass makes the class of an element a string dynamic value',
'ReactorSendClassExample',
'phabricator-uiexample-reactor-sendclass',
array(),
),
array(
'sendproperties makes some properties of an object into dynamic values',
'ReactorSendPropertiesExample',
'phabricator-uiexample-reactor-sendproperties',
array(),
),
);
foreach ($examples as $example) {
list($desc, $name, $resource, $params) = $example;
$template = new AphrontJavelinView();
$template
->setName($name)
->setParameters($params)
->setCelerityResource($resource);
$rows[] = array($desc, $template->render());
}
$table = new AphrontTableView($rows);
- $panel = new AphrontPanelView();
+ $panel = new PHUIObjectBoxView();
+ $panel->setHeaderText(pht('Example'));
$panel->appendChild($table);
return $panel;
}
}
diff --git a/src/applications/uiexample/examples/JavelinViewUIExample.php b/src/applications/uiexample/examples/JavelinViewUIExample.php
index 0928722c2c..73389475a7 100644
--- a/src/applications/uiexample/examples/JavelinViewUIExample.php
+++ b/src/applications/uiexample/examples/JavelinViewUIExample.php
@@ -1,43 +1,45 @@
<?php
final class JavelinViewUIExample extends PhabricatorUIExample {
public function getName() {
return 'Javelin Views';
}
public function getDescription() {
return 'Mix and match client and server views.';
}
public function renderExample() {
$request = $this->getRequest();
$init = $request->getStr('init');
$parent_server_template = new JavelinViewExampleServerView();
$parent_client_template = new AphrontJavelinView();
$parent_client_template
->setName('JavelinViewExample')
->setCelerityResource('phabricator-uiexample-javelin-view');
$child_server_template = new JavelinViewExampleServerView();
$child_client_template = new AphrontJavelinView();
$child_client_template
->setName('JavelinViewExample')
->setCelerityResource('phabricator-uiexample-javelin-view');
$parent_server_template->appendChild($parent_client_template);
$parent_client_template->appendChild($child_server_template);
$child_server_template->appendChild($child_client_template);
$child_client_template->appendChild('Hey, it worked.');
- $panel = new AphrontPanelView();
- $panel->appendChild($parent_server_template);
+ $panel = new PHUIObjectBoxView();
+ $panel->setHeaderText(pht('Example'));
+ $panel->appendChild(
+ phutil_tag_div('ml', $parent_server_template));
return $panel;
}
}
diff --git a/src/applications/uiexample/examples/PhabricatorAphrontBarUIExample.php b/src/applications/uiexample/examples/PhabricatorAphrontBarUIExample.php
index 1a8b323da6..6520aab0cf 100644
--- a/src/applications/uiexample/examples/PhabricatorAphrontBarUIExample.php
+++ b/src/applications/uiexample/examples/PhabricatorAphrontBarUIExample.php
@@ -1,75 +1,72 @@
<?php
final class PhabricatorAphrontBarUIExample extends PhabricatorUIExample {
public function getName() {
return 'Bars';
}
public function getDescription() {
return 'Like fractions, but more horizontal.';
}
public function renderExample() {
- $out = '';
- $out .= $this->renderTestThings('AphrontProgressBarView', 13, 10);
- $out .= $this->renderTestThings('AphrontGlyphBarView', 13, 10);
- $out .= $this->renderWeirdOrderGlyphBars();
- $out .= $this->renderAsciiStarBar();
- return phutil_safe_html($out);
+ $out = array();
+ $out[] = $this->renderTestThings('AphrontProgressBarView', 13, 10);
+ $out[] = $this->renderTestThings('AphrontGlyphBarView', 13, 10);
+ $out[] = $this->renderWeirdOrderGlyphBars();
+ $out[] = $this->renderAsciiStarBar();
+ return $out;
}
private function wrap($title, $thing) {
- return id(new AphrontPanelView())
- ->setHeader($title)
- ->appendChild($thing)
- ->render();
+ $thing = phutil_tag_div('ml grouped', $thing);
+ return id(new PHUIObjectBoxView())
+ ->setHeaderText($title)
+ ->appendChild($thing);
}
private function renderTestThings($class, $max, $incr) {
$bars = array();
for ($ii = 0; $ii <= $max; $ii++) {
$bars[] = newv($class, array())
->setValue($ii * $incr)
->setMax($max * $incr)
->setCaption("{$ii} outta {$max} ain't bad!");
}
- return $this->wrap(
- "Test {$class}",
- phutil_implode_html('', mpull($bars, 'render')));
+ return $this->wrap("Test {$class}", $bars);
}
private function renderWeirdOrderGlyphBars() {
$views = array();
$indices = array(1, 3, 7, 4, 2, 8, 9, 5, 10, 6);
$max = count($indices);
foreach ($indices as $index) {
$views[] = id(new AphrontGlyphBarView())
->setValue($index)
->setMax($max)
->setNumGlyphs(5)
->setCaption("Lol score is {$index}/{$max}")
->setGlyph(hsprintf('%s', 'LOL!'))
- ->setBackgroundGlyph(hsprintf('%s', '____'))
- ->render();
+ ->setBackgroundGlyph(hsprintf('%s', '____'));
$views[] = hsprintf('<div style="clear:both;"></div>');
}
return $this->wrap(
'Glyph bars in weird order',
- phutil_implode_html('', $views));
+ $views);
}
private function renderAsciiStarBar() {
- return $this->wrap(
- 'Ascii star glyph bar',
- id(new AphrontGlyphBarView())
+ $bar = id(new AphrontGlyphBarView())
->setValue(50)
->setMax(100)
->setCaption('Glyphs!')
->setNumGlyphs(10)
- ->setGlyph(hsprintf('%s', '*'))
- ->render());
+ ->setGlyph(hsprintf('%s', '*'));
+
+ return $this->wrap(
+ 'Ascii star glyph bar', $bar);
}
}
diff --git a/src/applications/uiexample/examples/PhabricatorPagerUIExample.php b/src/applications/uiexample/examples/PhabricatorPagerUIExample.php
index b79eae5e7a..cb5212d046 100644
--- a/src/applications/uiexample/examples/PhabricatorPagerUIExample.php
+++ b/src/applications/uiexample/examples/PhabricatorPagerUIExample.php
@@ -1,79 +1,80 @@
<?php
final class PhabricatorPagerUIExample extends PhabricatorUIExample {
public function getName() {
return 'Pager';
}
public function getDescription() {
return hsprintf(
'Use <tt>AphrontPagerView</tt> to create a control which allows '.
'users to paginate through large amounts of content.');
}
public function renderExample() {
$request = $this->getRequest();
$offset = (int)$request->getInt('offset');
$page_size = 20;
$item_count = 173;
$rows = array();
for ($ii = $offset; $ii < min($item_count, $offset + $page_size); $ii++) {
$rows[] = array(
'Item #'.($ii + 1),
);
}
$table = new AphrontTableView($rows);
$table->setHeaders(
array(
'Item',
));
- $panel = new AphrontPanelView();
+ $panel = new PHUIObjectBoxView();
+ $panel->setHeaderText(pht('Example'));
$panel->appendChild($table);
$panel->appendChild(hsprintf(
'<p class="phabricator-ui-example-note">'.
'Use <tt>AphrontPagerView</tt> to render a pager element.'.
'</p>'));
$pager = new AphrontPagerView();
$pager->setPageSize($page_size);
$pager->setOffset($offset);
$pager->setCount($item_count);
$pager->setURI($request->getRequestURI(), 'offset');
$panel->appendChild($pager);
$panel->appendChild(hsprintf(
'<p class="phabricator-ui-example-note">'.
'You can show more or fewer pages of surrounding context.'.
'</p>'));
$many_pages_pager = new AphrontPagerView();
$many_pages_pager->setPageSize($page_size);
$many_pages_pager->setOffset($offset);
$many_pages_pager->setCount($item_count);
$many_pages_pager->setURI($request->getRequestURI(), 'offset');
$many_pages_pager->setSurroundingPages(7);
$panel->appendChild($many_pages_pager);
$panel->appendChild(hsprintf(
'<p class="phabricator-ui-example-note">'.
'When it is prohibitively expensive or complex to attain a complete '.
'count of the items, you can select one extra item and set '.
'<tt>hasMorePages(true)</tt> if it exists, creating an inexact pager.'.
'</p>'));
$inexact_pager = new AphrontPagerView();
$inexact_pager->setPageSize($page_size);
$inexact_pager->setOffset($offset);
$inexact_pager->setHasMorePages($offset < ($item_count - $page_size));
$inexact_pager->setURI($request->getRequestURI(), 'offset');
$panel->appendChild($inexact_pager);
return $panel;
}
}

File Metadata

Mime Type
text/x-diff
Expires
Sun, Jan 19, 13:08 (3 w, 3 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1124917
Default Alt Text
(10 KB)

Event Timeline