mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-22 13:30: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
|
||||
(name, description, href, categoryID, sequence, dateCreated, dateModified)
|
||||
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());
|
||||
|
|
|
@ -28,12 +28,13 @@ abstract class PhabricatorCountdownController extends PhabricatorController {
|
|||
$page->setGlyph("\xE2\x9A\xB2");
|
||||
$page->setTabs(
|
||||
array(
|
||||
'create' => array(
|
||||
'list' => array(
|
||||
'href' => '/countdown/',
|
||||
'name' => 'List',
|
||||
'name' => 'Countdown List',
|
||||
),
|
||||
),
|
||||
idx($data, 'tab'));
|
||||
$page->setShowChrome(idx($data, 'chrome', true));
|
||||
|
||||
$page->appendChild($view);
|
||||
|
||||
|
|
|
@ -47,7 +47,9 @@ class PhabricatorCountdownDeleteController
|
|||
$dialog = new AphrontDialogView();
|
||||
$dialog->setUser($request->getUser());
|
||||
$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->addCancelButton('/countdown/');
|
||||
$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', 'view/dialog');
|
||||
|
||||
phutil_require_module('phutil', 'markup');
|
||||
phutil_require_module('phutil', 'utils');
|
||||
|
||||
|
||||
|
|
|
@ -45,6 +45,7 @@ class PhabricatorCountdownEditController
|
|||
$action_label = 'Update Timer';
|
||||
} else {
|
||||
$timer = new PhabricatorTimer();
|
||||
$timer->setDatePoint(time());
|
||||
}
|
||||
|
||||
$error_view = null;
|
||||
|
@ -75,7 +76,7 @@ class PhabricatorCountdownEditController
|
|||
$timer->setAuthorPHID($user->getPHID());
|
||||
$timer->save();
|
||||
return id(new AphrontRedirectResponse())
|
||||
->setURI('/countdown/'.$timer->getID());
|
||||
->setURI('/countdown/'.$timer->getID().'/');
|
||||
}
|
||||
else {
|
||||
$error_view = id(new AphrontErrorView())
|
||||
|
@ -109,13 +110,13 @@ class PhabricatorCountdownEditController
|
|||
->setHeader($action_label)
|
||||
->appendChild($form);
|
||||
|
||||
return $this->buildStandardPageResponse(array(
|
||||
return $this->buildStandardPageResponse(
|
||||
array(
|
||||
$error_view,
|
||||
$panel
|
||||
$panel,
|
||||
),
|
||||
array(
|
||||
'title' => 'Countdown management',
|
||||
'tab' => 'management',
|
||||
'title' => 'Edit Countdown',
|
||||
));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,22 +35,16 @@ class PhabricatorCountdownListController
|
|||
|
||||
$timers = $pager->sliceResults($timers);
|
||||
|
||||
$phids = mpull($timers, 'getAuthorPHID');
|
||||
$handles = id(new PhabricatorObjectHandleData($phids))->loadHandles();
|
||||
|
||||
$rows = array();
|
||||
foreach ($timers as $timer) {
|
||||
|
||||
$control_buttons = array();
|
||||
$control_buttons[] = phutil_render_tag(
|
||||
'a',
|
||||
array(
|
||||
'class' => 'small button grey',
|
||||
'href' => '/countdown/'.$timer->getID().'/',
|
||||
),
|
||||
'View');
|
||||
|
||||
$edit_button = null;
|
||||
$delete_button = null;
|
||||
if ($user->getIsAdmin() ||
|
||||
($user->getPHID() == $timer->getAuthorPHID())) {
|
||||
|
||||
$control_buttons[] = phutil_render_tag(
|
||||
$edit_button = phutil_render_tag(
|
||||
'a',
|
||||
array(
|
||||
'class' => 'small button grey',
|
||||
|
@ -58,7 +52,7 @@ class PhabricatorCountdownListController
|
|||
),
|
||||
'Edit');
|
||||
|
||||
$control_buttons[] = javelin_render_tag(
|
||||
$delete_button = javelin_render_tag(
|
||||
'a',
|
||||
array(
|
||||
'class' => 'small button grey',
|
||||
|
@ -66,14 +60,19 @@ class PhabricatorCountdownListController
|
|||
'sigil' => 'workflow'
|
||||
),
|
||||
'Delete');
|
||||
|
||||
}
|
||||
|
||||
$rows[] = array(
|
||||
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()),
|
||||
implode('', $control_buttons)
|
||||
$edit_button,
|
||||
$delete_button,
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -81,17 +80,21 @@ class PhabricatorCountdownListController
|
|||
$table->setHeaders(
|
||||
array(
|
||||
'ID',
|
||||
'Author',
|
||||
'Title',
|
||||
'End Date',
|
||||
'Action'
|
||||
'',
|
||||
''
|
||||
));
|
||||
|
||||
$table->setColumnClasses(
|
||||
array(
|
||||
null,
|
||||
null,
|
||||
'wide pri',
|
||||
null,
|
||||
'action'
|
||||
'action',
|
||||
'action',
|
||||
));
|
||||
|
||||
$panel = id(new AphrontPanelView())
|
||||
|
@ -103,7 +106,7 @@ class PhabricatorCountdownListController
|
|||
return $this->buildStandardPageResponse($panel,
|
||||
array(
|
||||
'title' => 'Countdown',
|
||||
'tab' => 'countdown',
|
||||
'tab' => 'list',
|
||||
));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
phutil_require_module('phabricator', 'applications/countdown/controller/base');
|
||||
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', 'view/control/pager');
|
||||
phutil_require_module('phabricator', 'view/control/table');
|
||||
|
|
|
@ -37,6 +37,15 @@ class PhabricatorCountdownViewController
|
|||
|
||||
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 =
|
||||
'<div class="phabricator-timer">
|
||||
<h1 class="phabricator-timer-header">'.
|
||||
|
@ -56,8 +65,9 @@ class PhabricatorCountdownViewController
|
|||
<td id="phabricator-timer-minutes"></td>
|
||||
<td id="phabricator-timer-seconds"></td>
|
||||
</table>
|
||||
</div>
|
||||
</div>';
|
||||
</div>'.
|
||||
$chrome_link.
|
||||
'</div>';
|
||||
|
||||
Javelin::initBehavior('countdown-timer', array(
|
||||
'timestamp' => $timer->getDatepoint()
|
||||
|
@ -65,10 +75,12 @@ class PhabricatorCountdownViewController
|
|||
|
||||
$panel = $content;
|
||||
|
||||
return $this->buildStandardPageResponse($panel,
|
||||
return $this->buildStandardPageResponse(
|
||||
$panel,
|
||||
array(
|
||||
'title' => 'T-minus..',
|
||||
'title' => 'Countdown: '.$timer->getTitle(),
|
||||
'tab' => 'view',
|
||||
'chrome' => $chrome_visible
|
||||
));
|
||||
}
|
||||
|
||||
|
|
|
@ -49,6 +49,10 @@ class AphrontPageView extends AphrontView {
|
|||
return $response;
|
||||
}
|
||||
|
||||
protected function getBodyClasses() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public function render() {
|
||||
|
||||
$this->willRenderPage();
|
||||
|
@ -58,6 +62,8 @@ class AphrontPageView extends AphrontView {
|
|||
$body = $this->getBody();
|
||||
$tail = $this->getTail();
|
||||
|
||||
$body_classes = $this->getBodyClasses();
|
||||
|
||||
$response = <<<EOHTML
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
@ -65,7 +71,7 @@ class AphrontPageView extends AphrontView {
|
|||
<title>{$title}</title>
|
||||
{$head}
|
||||
</head>
|
||||
<body>
|
||||
<body class="{$body_classes}">
|
||||
{$body}
|
||||
</body>
|
||||
{$tail}
|
||||
|
|
|
@ -26,6 +26,7 @@ class PhabricatorStandardPageView extends AphrontPageView {
|
|||
private $bodyContent;
|
||||
private $request;
|
||||
private $isAdminInterface;
|
||||
private $showChrome = true;
|
||||
|
||||
public function setIsAdminInterface($is_admin_interface) {
|
||||
$this->isAdminInterface = $is_admin_interface;
|
||||
|
@ -69,6 +70,15 @@ class PhabricatorStandardPageView extends AphrontPageView {
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function setShowChrome($show_chrome) {
|
||||
$this->showChrome = $show_chrome;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getShowChrome() {
|
||||
return $this->showChrome;
|
||||
}
|
||||
|
||||
public function getTitle() {
|
||||
$use_glyph = true;
|
||||
$request = $this->getRequest();
|
||||
|
@ -274,9 +284,10 @@ class PhabricatorStandardPageView extends AphrontPageView {
|
|||
$admin_class = 'phabricator-admin-page-view';
|
||||
}
|
||||
|
||||
return
|
||||
($console ? '<darkconsole />' : null).
|
||||
'<div class="phabricator-standard-page '.$admin_class.'">'.
|
||||
$header_chrome = null;
|
||||
$footer_chrome = null;
|
||||
if ($this->getShowChrome()) {
|
||||
$header_chrome =
|
||||
'<table class="phabricator-standard-header">'.
|
||||
'<tr>'.
|
||||
'<td class="phabricator-logo"><a href="/"> </a></td>'.
|
||||
|
@ -300,13 +311,21 @@ class PhabricatorStandardPageView extends AphrontPageView {
|
|||
$login_stuff.
|
||||
'</td>'.
|
||||
'</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.
|
||||
'<div style="clear: both;"></div>'.
|
||||
'</div>'.
|
||||
'<div class="phabricator-page-foot">'.
|
||||
$foot_links.
|
||||
'</div>';
|
||||
$footer_chrome;
|
||||
}
|
||||
|
||||
protected function getTail() {
|
||||
|
@ -316,4 +335,14 @@ class PhabricatorStandardPageView extends AphrontPageView {
|
|||
$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;
|
||||
}
|
||||
|
||||
.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 {
|
||||
background: #005588;
|
||||
color: white;
|
||||
|
|
|
@ -38,3 +38,8 @@
|
|||
font-size: 4em;
|
||||
}
|
||||
|
||||
.phabricator-timer-chrome-link {
|
||||
float: right;
|
||||
padding: 3px 6px;
|
||||
font-size: 11px;
|
||||
}
|
||||
|
|
|
@ -60,6 +60,10 @@ body {
|
|||
*font-size: small;
|
||||
}
|
||||
|
||||
body.phabricator-chromeless-page {
|
||||
background: #ffffff;
|
||||
}
|
||||
|
||||
select, input, button, textarea, button {
|
||||
font: 99% 'lucida grande', tahoma, verdana, arial, clean, sans-serif;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue