2012-07-31 01:08:10 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
final class JavelinUIExample extends PhabricatorUIExample {
|
|
|
|
|
|
|
|
public function getName() {
|
2015-05-22 09:27:56 +02:00
|
|
|
return pht('Javelin UI');
|
2012-07-31 01:08:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public function getDescription() {
|
2015-05-22 09:27:56 +02:00
|
|
|
return pht('Here are some Javelin UI elements that you could use.');
|
2012-07-31 01:08:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public function renderExample() {
|
|
|
|
$request = $this->getRequest();
|
|
|
|
$user = $request->getUser();
|
|
|
|
|
2012-07-31 01:08:42 +02:00
|
|
|
// toggle-class
|
|
|
|
|
|
|
|
$container_id = celerity_generate_unique_node_id();
|
|
|
|
$button_red_id = celerity_generate_unique_node_id();
|
|
|
|
$button_blue_id = celerity_generate_unique_node_id();
|
|
|
|
|
2013-01-25 21:57:17 +01:00
|
|
|
$button_red = javelin_tag(
|
2012-07-31 01:08:42 +02:00
|
|
|
'a',
|
|
|
|
array(
|
|
|
|
'class' => 'button',
|
|
|
|
'sigil' => 'jx-toggle-class',
|
|
|
|
'href' => '#',
|
|
|
|
'id' => $button_red_id,
|
|
|
|
'meta' => array(
|
|
|
|
'map' => array(
|
|
|
|
$container_id => 'jxui-red-border',
|
|
|
|
$button_red_id => 'jxui-active',
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
2015-05-22 09:27:56 +02:00
|
|
|
pht('Toggle Red Border'));
|
2012-07-31 01:08:42 +02:00
|
|
|
|
2013-01-25 21:57:17 +01:00
|
|
|
$button_blue = javelin_tag(
|
2012-07-31 01:08:42 +02:00
|
|
|
'a',
|
|
|
|
array(
|
|
|
|
'class' => 'button jxui-active',
|
|
|
|
'sigil' => 'jx-toggle-class',
|
|
|
|
'href' => '#',
|
|
|
|
'id' => $button_blue_id,
|
|
|
|
'meta' => array(
|
|
|
|
'state' => true,
|
|
|
|
'map' => array(
|
|
|
|
$container_id => 'jxui-blue-background',
|
|
|
|
$button_blue_id => 'jxui-active',
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
2015-05-22 09:27:56 +02:00
|
|
|
pht('Toggle Blue Background'));
|
2012-07-31 01:08:42 +02:00
|
|
|
|
2013-01-18 09:32:58 +01:00
|
|
|
$div = phutil_tag(
|
2012-07-31 01:08:42 +02:00
|
|
|
'div',
|
|
|
|
array(
|
|
|
|
'id' => $container_id,
|
|
|
|
'class' => 'jxui-example-container jxui-blue-background',
|
|
|
|
),
|
2013-01-18 09:32:58 +01:00
|
|
|
array($button_red, $button_blue));
|
2012-07-31 01:08:42 +02:00
|
|
|
|
2012-08-01 03:28:08 +02:00
|
|
|
return array($div);
|
2012-07-31 01:08:10 +02:00
|
|
|
}
|
|
|
|
}
|