mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-22 21:40:55 +01:00
Countdown tweaks
Summary: A few tweaks to hsb's Countdown implementation: - Allow the page to be rendered "chromeless", suitable for display on one of the dozens of monitors everyone has laying around. - Show title of countdown in deletion dialog. - When creating a new countdown default to time(), not Dec 31, 1969. - Add extra "/" after editing to avoid needless redirect. - Tweak some page titles. - Show countdown author in list view. - Highlight tab in list view. - Tweak menu copy. - Link countdown title in list view, separate buttons into different columns so they pick up padding. Test Plan: Created, edited and deleted a timer. Viewed a timer and toggled chrome mode. Viewed timer list. Reviewed By: hsb Reviewers: hsb, aran, jungejason, tuomaspelkonen CC: aran, hsb, epriestley Differential Revision: 454
This commit is contained in:
parent
8f63873d57
commit
aa86cf0ed8
13 changed files with 115 additions and 41 deletions
|
@ -12,5 +12,5 @@ CREATE TABLE phabricator_countdown.countdown_timer (
|
||||||
INSERT INTO phabricator_directory.directory_item
|
INSERT INTO phabricator_directory.directory_item
|
||||||
(name, description, href, categoryID, sequence, dateCreated, dateModified)
|
(name, description, href, categoryID, sequence, dateCreated, dateModified)
|
||||||
VALUES
|
VALUES
|
||||||
("Counterdown", "T-minus X to Y", "/countdown/", 5, 350,
|
("Countdown", "Utilize the full capabilities of your ALU.", "/countdown/", 5, 350,
|
||||||
UNIX_TIMESTAMP(), UNIX_TIMESTAMP());
|
UNIX_TIMESTAMP(), UNIX_TIMESTAMP());
|
||||||
|
|
|
@ -28,12 +28,13 @@ abstract class PhabricatorCountdownController extends PhabricatorController {
|
||||||
$page->setGlyph("\xE2\x9A\xB2");
|
$page->setGlyph("\xE2\x9A\xB2");
|
||||||
$page->setTabs(
|
$page->setTabs(
|
||||||
array(
|
array(
|
||||||
'create' => array(
|
'list' => array(
|
||||||
'href' => '/countdown/',
|
'href' => '/countdown/',
|
||||||
'name' => 'List',
|
'name' => 'Countdown List',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
idx($data, 'tab'));
|
idx($data, 'tab'));
|
||||||
|
$page->setShowChrome(idx($data, 'chrome', true));
|
||||||
|
|
||||||
$page->appendChild($view);
|
$page->appendChild($view);
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,9 @@ class PhabricatorCountdownDeleteController
|
||||||
$dialog = new AphrontDialogView();
|
$dialog = new AphrontDialogView();
|
||||||
$dialog->setUser($request->getUser());
|
$dialog->setUser($request->getUser());
|
||||||
$dialog->setTitle('Really delete this countdown?');
|
$dialog->setTitle('Really delete this countdown?');
|
||||||
$dialog->appendChild("Are you sure you want to delete this countdown?");
|
$dialog->appendChild(
|
||||||
|
'<p>Are you sure you want to delete the countdown "'.
|
||||||
|
phutil_escape_html($timer->getTitle()).'"?</p>');
|
||||||
$dialog->addSubmitButton('Delete');
|
$dialog->addSubmitButton('Delete');
|
||||||
$dialog->addCancelButton('/countdown/');
|
$dialog->addCancelButton('/countdown/');
|
||||||
$dialog->setSubmitURI($request->getPath());
|
$dialog->setSubmitURI($request->getPath());
|
||||||
|
|
|
@ -13,6 +13,7 @@ phutil_require_module('phabricator', 'applications/countdown/controller/base');
|
||||||
phutil_require_module('phabricator', 'applications/countdown/storage/timer');
|
phutil_require_module('phabricator', 'applications/countdown/storage/timer');
|
||||||
phutil_require_module('phabricator', 'view/dialog');
|
phutil_require_module('phabricator', 'view/dialog');
|
||||||
|
|
||||||
|
phutil_require_module('phutil', 'markup');
|
||||||
phutil_require_module('phutil', 'utils');
|
phutil_require_module('phutil', 'utils');
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -45,6 +45,7 @@ class PhabricatorCountdownEditController
|
||||||
$action_label = 'Update Timer';
|
$action_label = 'Update Timer';
|
||||||
} else {
|
} else {
|
||||||
$timer = new PhabricatorTimer();
|
$timer = new PhabricatorTimer();
|
||||||
|
$timer->setDatePoint(time());
|
||||||
}
|
}
|
||||||
|
|
||||||
$error_view = null;
|
$error_view = null;
|
||||||
|
@ -75,7 +76,7 @@ class PhabricatorCountdownEditController
|
||||||
$timer->setAuthorPHID($user->getPHID());
|
$timer->setAuthorPHID($user->getPHID());
|
||||||
$timer->save();
|
$timer->save();
|
||||||
return id(new AphrontRedirectResponse())
|
return id(new AphrontRedirectResponse())
|
||||||
->setURI('/countdown/'.$timer->getID());
|
->setURI('/countdown/'.$timer->getID().'/');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$error_view = id(new AphrontErrorView())
|
$error_view = id(new AphrontErrorView())
|
||||||
|
@ -109,13 +110,13 @@ class PhabricatorCountdownEditController
|
||||||
->setHeader($action_label)
|
->setHeader($action_label)
|
||||||
->appendChild($form);
|
->appendChild($form);
|
||||||
|
|
||||||
return $this->buildStandardPageResponse(array(
|
return $this->buildStandardPageResponse(
|
||||||
|
array(
|
||||||
$error_view,
|
$error_view,
|
||||||
$panel
|
$panel,
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'title' => 'Countdown management',
|
'title' => 'Edit Countdown',
|
||||||
'tab' => 'management',
|
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,22 +35,16 @@ class PhabricatorCountdownListController
|
||||||
|
|
||||||
$timers = $pager->sliceResults($timers);
|
$timers = $pager->sliceResults($timers);
|
||||||
|
|
||||||
|
$phids = mpull($timers, 'getAuthorPHID');
|
||||||
|
$handles = id(new PhabricatorObjectHandleData($phids))->loadHandles();
|
||||||
|
|
||||||
$rows = array();
|
$rows = array();
|
||||||
foreach ($timers as $timer) {
|
foreach ($timers as $timer) {
|
||||||
|
$edit_button = null;
|
||||||
$control_buttons = array();
|
$delete_button = null;
|
||||||
$control_buttons[] = phutil_render_tag(
|
|
||||||
'a',
|
|
||||||
array(
|
|
||||||
'class' => 'small button grey',
|
|
||||||
'href' => '/countdown/'.$timer->getID().'/',
|
|
||||||
),
|
|
||||||
'View');
|
|
||||||
|
|
||||||
if ($user->getIsAdmin() ||
|
if ($user->getIsAdmin() ||
|
||||||
($user->getPHID() == $timer->getAuthorPHID())) {
|
($user->getPHID() == $timer->getAuthorPHID())) {
|
||||||
|
$edit_button = phutil_render_tag(
|
||||||
$control_buttons[] = phutil_render_tag(
|
|
||||||
'a',
|
'a',
|
||||||
array(
|
array(
|
||||||
'class' => 'small button grey',
|
'class' => 'small button grey',
|
||||||
|
@ -58,7 +52,7 @@ class PhabricatorCountdownListController
|
||||||
),
|
),
|
||||||
'Edit');
|
'Edit');
|
||||||
|
|
||||||
$control_buttons[] = javelin_render_tag(
|
$delete_button = javelin_render_tag(
|
||||||
'a',
|
'a',
|
||||||
array(
|
array(
|
||||||
'class' => 'small button grey',
|
'class' => 'small button grey',
|
||||||
|
@ -66,14 +60,19 @@ class PhabricatorCountdownListController
|
||||||
'sigil' => 'workflow'
|
'sigil' => 'workflow'
|
||||||
),
|
),
|
||||||
'Delete');
|
'Delete');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$rows[] = array(
|
$rows[] = array(
|
||||||
phutil_escape_html($timer->getID()),
|
phutil_escape_html($timer->getID()),
|
||||||
phutil_escape_html($timer->getTitle()),
|
$handles[$timer->getAuthorPHID()]->renderLink(),
|
||||||
|
phutil_render_tag(
|
||||||
|
'a',
|
||||||
|
array(
|
||||||
|
'href' => '/countdown/'.$timer->getID().'/',
|
||||||
|
),
|
||||||
|
phutil_escape_html($timer->getTitle())),
|
||||||
phabricator_format_timestamp($timer->getDatepoint()),
|
phabricator_format_timestamp($timer->getDatepoint()),
|
||||||
implode('', $control_buttons)
|
$edit_button,
|
||||||
|
$delete_button,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,17 +80,21 @@ class PhabricatorCountdownListController
|
||||||
$table->setHeaders(
|
$table->setHeaders(
|
||||||
array(
|
array(
|
||||||
'ID',
|
'ID',
|
||||||
|
'Author',
|
||||||
'Title',
|
'Title',
|
||||||
'End Date',
|
'End Date',
|
||||||
'Action'
|
'',
|
||||||
|
''
|
||||||
));
|
));
|
||||||
|
|
||||||
$table->setColumnClasses(
|
$table->setColumnClasses(
|
||||||
array(
|
array(
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
|
'wide pri',
|
||||||
null,
|
null,
|
||||||
'action'
|
'action',
|
||||||
|
'action',
|
||||||
));
|
));
|
||||||
|
|
||||||
$panel = id(new AphrontPanelView())
|
$panel = id(new AphrontPanelView())
|
||||||
|
@ -103,7 +106,7 @@ class PhabricatorCountdownListController
|
||||||
return $this->buildStandardPageResponse($panel,
|
return $this->buildStandardPageResponse($panel,
|
||||||
array(
|
array(
|
||||||
'title' => 'Countdown',
|
'title' => 'Countdown',
|
||||||
'tab' => 'countdown',
|
'tab' => 'list',
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
|
|
||||||
phutil_require_module('phabricator', 'applications/countdown/controller/base');
|
phutil_require_module('phabricator', 'applications/countdown/controller/base');
|
||||||
phutil_require_module('phabricator', 'applications/countdown/storage/timer');
|
phutil_require_module('phabricator', 'applications/countdown/storage/timer');
|
||||||
|
phutil_require_module('phabricator', 'applications/phid/handle/data');
|
||||||
phutil_require_module('phabricator', 'infrastructure/javelin/markup');
|
phutil_require_module('phabricator', 'infrastructure/javelin/markup');
|
||||||
phutil_require_module('phabricator', 'view/control/pager');
|
phutil_require_module('phabricator', 'view/control/pager');
|
||||||
phutil_require_module('phabricator', 'view/control/table');
|
phutil_require_module('phabricator', 'view/control/table');
|
||||||
|
|
|
@ -37,6 +37,15 @@ class PhabricatorCountdownViewController
|
||||||
|
|
||||||
require_celerity_resource('phabricator-countdown-css');
|
require_celerity_resource('phabricator-countdown-css');
|
||||||
|
|
||||||
|
$chrome_visible = $request->getBool('chrome', true);
|
||||||
|
$chrome_link = phutil_render_tag(
|
||||||
|
'a',
|
||||||
|
array(
|
||||||
|
'href' => $request->getRequestURI()->alter('chrome', !$chrome_visible),
|
||||||
|
'class' => 'phabricator-timer-chrome-link',
|
||||||
|
),
|
||||||
|
$chrome_visible ? 'Disable Chrome' : 'Enable Chrome');
|
||||||
|
|
||||||
$content =
|
$content =
|
||||||
'<div class="phabricator-timer">
|
'<div class="phabricator-timer">
|
||||||
<h1 class="phabricator-timer-header">'.
|
<h1 class="phabricator-timer-header">'.
|
||||||
|
@ -56,8 +65,9 @@ class PhabricatorCountdownViewController
|
||||||
<td id="phabricator-timer-minutes"></td>
|
<td id="phabricator-timer-minutes"></td>
|
||||||
<td id="phabricator-timer-seconds"></td>
|
<td id="phabricator-timer-seconds"></td>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>'.
|
||||||
</div>';
|
$chrome_link.
|
||||||
|
'</div>';
|
||||||
|
|
||||||
Javelin::initBehavior('countdown-timer', array(
|
Javelin::initBehavior('countdown-timer', array(
|
||||||
'timestamp' => $timer->getDatepoint()
|
'timestamp' => $timer->getDatepoint()
|
||||||
|
@ -65,10 +75,12 @@ class PhabricatorCountdownViewController
|
||||||
|
|
||||||
$panel = $content;
|
$panel = $content;
|
||||||
|
|
||||||
return $this->buildStandardPageResponse($panel,
|
return $this->buildStandardPageResponse(
|
||||||
|
$panel,
|
||||||
array(
|
array(
|
||||||
'title' => 'T-minus..',
|
'title' => 'Countdown: '.$timer->getTitle(),
|
||||||
'tab' => 'view',
|
'tab' => 'view',
|
||||||
|
'chrome' => $chrome_visible
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,6 +49,10 @@ class AphrontPageView extends AphrontView {
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function getBodyClasses() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public function render() {
|
public function render() {
|
||||||
|
|
||||||
$this->willRenderPage();
|
$this->willRenderPage();
|
||||||
|
@ -58,6 +62,8 @@ class AphrontPageView extends AphrontView {
|
||||||
$body = $this->getBody();
|
$body = $this->getBody();
|
||||||
$tail = $this->getTail();
|
$tail = $this->getTail();
|
||||||
|
|
||||||
|
$body_classes = $this->getBodyClasses();
|
||||||
|
|
||||||
$response = <<<EOHTML
|
$response = <<<EOHTML
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
|
@ -65,7 +71,7 @@ class AphrontPageView extends AphrontView {
|
||||||
<title>{$title}</title>
|
<title>{$title}</title>
|
||||||
{$head}
|
{$head}
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body class="{$body_classes}">
|
||||||
{$body}
|
{$body}
|
||||||
</body>
|
</body>
|
||||||
{$tail}
|
{$tail}
|
||||||
|
|
|
@ -26,6 +26,7 @@ class PhabricatorStandardPageView extends AphrontPageView {
|
||||||
private $bodyContent;
|
private $bodyContent;
|
||||||
private $request;
|
private $request;
|
||||||
private $isAdminInterface;
|
private $isAdminInterface;
|
||||||
|
private $showChrome = true;
|
||||||
|
|
||||||
public function setIsAdminInterface($is_admin_interface) {
|
public function setIsAdminInterface($is_admin_interface) {
|
||||||
$this->isAdminInterface = $is_admin_interface;
|
$this->isAdminInterface = $is_admin_interface;
|
||||||
|
@ -69,6 +70,15 @@ class PhabricatorStandardPageView extends AphrontPageView {
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setShowChrome($show_chrome) {
|
||||||
|
$this->showChrome = $show_chrome;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getShowChrome() {
|
||||||
|
return $this->showChrome;
|
||||||
|
}
|
||||||
|
|
||||||
public function getTitle() {
|
public function getTitle() {
|
||||||
$use_glyph = true;
|
$use_glyph = true;
|
||||||
$request = $this->getRequest();
|
$request = $this->getRequest();
|
||||||
|
@ -274,9 +284,10 @@ class PhabricatorStandardPageView extends AphrontPageView {
|
||||||
$admin_class = 'phabricator-admin-page-view';
|
$admin_class = 'phabricator-admin-page-view';
|
||||||
}
|
}
|
||||||
|
|
||||||
return
|
$header_chrome = null;
|
||||||
($console ? '<darkconsole />' : null).
|
$footer_chrome = null;
|
||||||
'<div class="phabricator-standard-page '.$admin_class.'">'.
|
if ($this->getShowChrome()) {
|
||||||
|
$header_chrome =
|
||||||
'<table class="phabricator-standard-header">'.
|
'<table class="phabricator-standard-header">'.
|
||||||
'<tr>'.
|
'<tr>'.
|
||||||
'<td class="phabricator-logo"><a href="/"> </a></td>'.
|
'<td class="phabricator-logo"><a href="/"> </a></td>'.
|
||||||
|
@ -300,13 +311,21 @@ class PhabricatorStandardPageView extends AphrontPageView {
|
||||||
$login_stuff.
|
$login_stuff.
|
||||||
'</td>'.
|
'</td>'.
|
||||||
'</tr>'.
|
'</tr>'.
|
||||||
'</table>'.
|
'</table>';
|
||||||
|
$footer_chrome =
|
||||||
|
'<div class="phabricator-page-foot">'.
|
||||||
|
$foot_links.
|
||||||
|
'</div>';
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
($console ? '<darkconsole />' : null).
|
||||||
|
'<div class="phabricator-standard-page '.$admin_class.'">'.
|
||||||
|
$header_chrome.
|
||||||
$this->bodyContent.
|
$this->bodyContent.
|
||||||
'<div style="clear: both;"></div>'.
|
'<div style="clear: both;"></div>'.
|
||||||
'</div>'.
|
'</div>'.
|
||||||
'<div class="phabricator-page-foot">'.
|
$footer_chrome;
|
||||||
$foot_links.
|
|
||||||
'</div>';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getTail() {
|
protected function getTail() {
|
||||||
|
@ -316,4 +335,14 @@ class PhabricatorStandardPageView extends AphrontPageView {
|
||||||
$response->renderHTMLFooter();
|
$response->renderHTMLFooter();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function getBodyClasses() {
|
||||||
|
$classes = array();
|
||||||
|
|
||||||
|
if (!$this->getShowChrome()) {
|
||||||
|
$classes[] = 'phabricator-chromeless-page';
|
||||||
|
}
|
||||||
|
|
||||||
|
return implode(' ', $classes);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,15 @@
|
||||||
box-shadow: 0 0 6px #000;
|
box-shadow: 0 0 6px #000;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.phabricator-chromeless-page .phabricator-standard-page {
|
||||||
|
background: transparent;
|
||||||
|
border-width: 0px;
|
||||||
|
|
||||||
|
-webkit-box-shadow: none;
|
||||||
|
-mox-box-shadow: none;
|
||||||
|
box-shadow: none;
|
||||||
|
}
|
||||||
|
|
||||||
.phabricator-standard-header {
|
.phabricator-standard-header {
|
||||||
background: #005588;
|
background: #005588;
|
||||||
color: white;
|
color: white;
|
||||||
|
|
|
@ -38,3 +38,8 @@
|
||||||
font-size: 4em;
|
font-size: 4em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.phabricator-timer-chrome-link {
|
||||||
|
float: right;
|
||||||
|
padding: 3px 6px;
|
||||||
|
font-size: 11px;
|
||||||
|
}
|
||||||
|
|
|
@ -60,6 +60,10 @@ body {
|
||||||
*font-size: small;
|
*font-size: small;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
body.phabricator-chromeless-page {
|
||||||
|
background: #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
select, input, button, textarea, button {
|
select, input, button, textarea, button {
|
||||||
font: 99% 'lucida grande', tahoma, verdana, arial, clean, sans-serif;
|
font: 99% 'lucida grande', tahoma, verdana, arial, clean, sans-serif;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue