@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Modernize Countdown

Summary: Crumbs, phts, and mobile layouts for Countdown.

Test Plan: Tested new, edit and delete timer. Verified timer works. Unable to get 'remove chrome' to work, will investigate.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D5101

+103 -52
+2
src/applications/base/controller/PhabricatorController.php
··· 170 170 $page->setDeviceReady(true); 171 171 } 172 172 173 + $page->setShowChrome(idx($options, 'chrome', true)); 174 + 173 175 $application_menu = $this->buildApplicationMenu(); 174 176 if ($application_menu) { 175 177 $page->setApplicationMenu($application_menu);
+1 -1
src/applications/countdown/application/PhabricatorApplicationCountdown.php
··· 11 11 } 12 12 13 13 public function getShortDescription() { 14 - return 'Countdown Timers'; 14 + return pht('Countdown Timers'); 15 15 } 16 16 17 17 public function getTitleGlyph() {
+23 -10
src/applications/countdown/controller/PhabricatorCountdownController.php
··· 2 2 3 3 abstract class PhabricatorCountdownController extends PhabricatorController { 4 4 5 - public function buildStandardPageResponse($view, array $data) { 5 + public function buildSideNavView() { 6 + $user = $this->getRequest()->getUser(); 7 + 8 + $nav = new AphrontSideNavFilterView(); 9 + $nav->setBaseURI(new PhutilURI($this->getApplicationURI())); 10 + 11 + $nav->addFilter('', pht('All Timers'), 12 + $this->getApplicationURI('')); 13 + $nav->addFilter('', pht('Create Timer'), 14 + $this->getApplicationURI('edit/')); 6 15 7 - $page = $this->buildStandardPageView(); 16 + return $nav; 17 + } 8 18 9 - $page->setApplicationName('Countdown'); 10 - $page->setBaseURI('/countdown/'); 11 - $page->setTitle(idx($data, 'title')); 12 - $page->setGlyph("\xE2\x9A\xB2"); 13 - $page->setShowChrome(idx($data, 'chrome', true)); 19 + public function buildApplicationMenu() { 20 + return $this->buildSideNavView()->getMenu(); 21 + } 14 22 15 - $page->appendChild($view); 23 + public function buildApplicationCrumbs() { 24 + $crumbs = parent::buildApplicationCrumbs(); 16 25 17 - $response = new AphrontWebpageResponse(); 18 - return $response->setContent($page->render()); 26 + $crumbs->addAction( 27 + id(new PhabricatorMenuItemView()) 28 + ->setName(pht('Create Timer')) 29 + ->setHref($this->getApplicationURI('edit/')) 30 + ->setIcon('create')); 19 31 32 + return $crumbs; 20 33 } 21 34 }
+6 -5
src/applications/countdown/controller/PhabricatorCountdownDeleteController.php
··· 30 30 ->setURI('/countdown/'); 31 31 } 32 32 33 + $inst = pht('Are you sure you want to delete the countdown %s?', 34 + $timer->getTitle()); 35 + 33 36 $dialog = new AphrontDialogView(); 34 37 $dialog->setUser($request->getUser()); 35 - $dialog->setTitle('Really delete this countdown?'); 36 - $dialog->appendChild(hsprintf( 37 - '<p>Are you sure you want to delete the countdown "%s"?</p>', 38 - $timer->getTitle())); 39 - $dialog->addSubmitButton('Delete'); 38 + $dialog->setTitle(pht('Really delete this countdown?')); 39 + $dialog->appendChild(hsprintf('<p>%s</p>', $inst)); 40 + $dialog->addSubmitButton(pht('Delete')); 40 41 $dialog->addCancelButton('/countdown/'); 41 42 $dialog->setSubmitURI($request->getPath()); 42 43
+26 -18
src/applications/countdown/controller/PhabricatorCountdownEditController.php
··· 12 12 13 13 $request = $this->getRequest(); 14 14 $user = $request->getUser(); 15 - $action_label = 'Create Timer'; 15 + $action_label = pht('Create Timer'); 16 16 17 17 if ($this->id) { 18 18 $timer = id(new PhabricatorTimer())->load($this->id); ··· 26 26 return new Aphront403Response(); 27 27 } 28 28 29 - $action_label = 'Update Timer'; 29 + $action_label = pht('Update Timer'); 30 30 } else { 31 31 $timer = new PhabricatorTimer(); 32 32 $timer->setDatePoint(time()); ··· 42 42 43 43 $e_text = null; 44 44 if (!strlen($title)) { 45 - $e_text = 'Required'; 46 - $errors[] = 'You must give it a name.'; 45 + $e_text = pht('Required'); 46 + $errors[] = pht('You must give it a name.'); 47 47 } 48 48 49 49 // If the user types something like "5 PM", convert it to a timestamp ··· 54 54 $date = new DateTime($datepoint, $timezone); 55 55 $timestamp = $date->format('U'); 56 56 } catch (Exception $e) { 57 - $errors[] = 'You entered an incorrect date. You can enter date like'. 58 - ' \'2011-06-26 13:33:37\' to create an event at'. 59 - ' 13:33:37 on the 26th of June 2011.'; 57 + $errors[] = pht('You entered an incorrect date. You can enter date'. 58 + ' like \'2011-06-26 13:33:37\' to create an event at'. 59 + ' 13:33:37 on the 26th of June 2011.'); 60 60 $timestamp = null; 61 61 } 62 62 ··· 71 71 } else { 72 72 $error_view = id(new AphrontErrorView()) 73 73 ->setErrors($errors) 74 - ->setTitle('It\'s not The Final Countdown (du nu nuuu nun)' . 75 - ' until you fix these problem'); 74 + ->setTitle(pht('It\'s not The Final Countdown (du nu nuuu nun)' . 75 + ' until you fix these problem')); 76 76 } 77 77 } 78 78 ··· 89 89 ->setAction($request->getRequestURI()->getPath()) 90 90 ->appendChild( 91 91 id(new AphrontFormTextControl()) 92 - ->setLabel('Title') 92 + ->setLabel(pht('Title')) 93 93 ->setValue($timer->getTitle()) 94 94 ->setName('title')) 95 95 ->appendChild( 96 96 id(new AphrontFormTextControl()) 97 - ->setLabel('End date') 97 + ->setLabel(pht('End date')) 98 98 ->setValue($display_datepoint) 99 99 ->setName('datepoint') 100 - ->setCaption(hsprintf( 101 - 'Examples: '. 102 - '<tt>2011-12-25</tt> or '. 103 - '<tt>3 hours</tt> or '. 104 - '<tt>June 8 2011, 5 PM</tt>.'))) 100 + ->setCaption(pht('Examples: '. 101 + '2011-12-25 or 3 hours or '. 102 + 'June 8 2011, 5 PM.'))) 105 103 ->appendChild( 106 104 id(new AphrontFormSubmitControl()) 107 105 ->addCancelButton('/countdown/') ··· 110 108 $panel = id(new AphrontPanelView()) 111 109 ->setWidth(AphrontPanelView::WIDTH_FORM) 112 110 ->setHeader($action_label) 111 + ->setNoBackground() 113 112 ->appendChild($form); 114 113 115 - return $this->buildStandardPageResponse( 114 + $crumbs = $this 115 + ->buildApplicationCrumbs() 116 + ->addCrumb( 117 + id(new PhabricatorCrumbView()) 118 + ->setName($action_label) 119 + ->setHref($this->getApplicationURI('edit/'))); 120 + 121 + return $this->buildApplicationPage( 116 122 array( 123 + $crumbs, 117 124 $error_view, 118 125 $panel, 119 126 ), 120 127 array( 121 - 'title' => 'Edit Countdown', 128 + 'title' => pht('Edit Countdown'), 129 + 'device' => true, 122 130 )); 123 131 } 124 132 }
+22 -10
src/applications/countdown/controller/PhabricatorCountdownListController.php
··· 34 34 'class' => 'small button grey', 35 35 'href' => '/countdown/edit/'.$timer->getID().'/' 36 36 ), 37 - 'Edit'); 37 + pht('Edit')); 38 38 39 39 $delete_button = javelin_tag( 40 40 'a', ··· 43 43 'href' => '/countdown/delete/'.$timer->getID().'/', 44 44 'sigil' => 'workflow' 45 45 ), 46 - 'Delete'); 46 + pht('Delete')); 47 47 } 48 48 $rows[] = array( 49 49 $timer->getID(), ··· 63 63 $table = new AphrontTableView($rows); 64 64 $table->setHeaders( 65 65 array( 66 - 'ID', 67 - 'Author', 68 - 'Title', 69 - 'End Date', 66 + pht('ID'), 67 + pht('Author'), 68 + pht('Title'), 69 + pht('End Date'), 70 70 '', 71 71 '' 72 72 )); ··· 83 83 84 84 $panel = id(new AphrontPanelView()) 85 85 ->appendChild($table) 86 - ->setHeader('Timers') 87 - ->setCreateButton('Create Timer', '/countdown/edit/') 86 + ->setHeader(pht('Timers')) 87 + ->setNoBackground() 88 88 ->appendChild($pager); 89 89 90 - return $this->buildStandardPageResponse($panel, 90 + $crumbs = $this 91 + ->buildApplicationCrumbs() 92 + ->addCrumb( 93 + id(new PhabricatorCrumbView()) 94 + ->setName(pht('All Timers')) 95 + ->setHref($this->getApplicationURI())); 96 + 97 + return $this->buildApplicationPage( 91 98 array( 92 - 'title' => 'Countdown', 99 + $crumbs, 100 + $panel 101 + ), 102 + array( 103 + 'title' => pht('Countdown'), 104 + 'device' => true, 93 105 )); 94 106 } 95 107 }
+23 -8
src/applications/countdown/controller/PhabricatorCountdownViewController.php
··· 38 38 <div class="phabricator-timer-pane"> 39 39 <table class="phabricator-timer-table"> 40 40 <tr> 41 - <th>Days</th> 42 - <th>Hours</th> 43 - <th>Minutes</th> 44 - <th>Seconds</th> 41 + <th>%s</th> 42 + <th>%s</th> 43 + <th>%s</th> 44 + <th>%s</th> 45 45 </tr> 46 46 <tr>%s%s%s%s</tr> 47 47 </table> ··· 51 51 $container, 52 52 $timer->getTitle(), 53 53 phabricator_datetime($timer->getDatePoint(), $user), 54 + pht('Days'), 55 + pht('Hours'), 56 + pht('Minutes'), 57 + pht('Seconds'), 54 58 javelin_tag('td', array('sigil' => 'phabricator-timer-days'), ''), 55 59 javelin_tag('td', array('sigil' => 'phabricator-timer-hours'), ''), 56 60 javelin_tag('td', array('sigil' => 'phabricator-timer-minutes'), ''), ··· 64 68 65 69 $panel = $content; 66 70 67 - return $this->buildStandardPageResponse( 68 - $panel, 71 + $crumbs = $this 72 + ->buildApplicationCrumbs() 73 + ->addCrumb( 74 + id(new PhabricatorCrumbView()) 75 + ->setName($timer->getTitle()) 76 + ->setHref($this->getApplicationURI($this->id.'/'))); 77 + 78 + return $this->buildApplicationPage( 79 + array( 80 + ($chrome_visible ? $crumbs : ''), 81 + $panel, 82 + ), 69 83 array( 70 - 'title' => 'Countdown: '.$timer->getTitle(), 71 - 'chrome' => $chrome_visible 84 + 'title' => pht('Countdown: %s', $timer->getTitle()), 85 + 'chrome' => $chrome_visible, 86 + 'device' => true, 72 87 )); 73 88 } 74 89