@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.

Add basic countdown timer to object list

Summary: Allows a rough setting of a number and noun for object item list view.

Test Plan:
Use in countdown, set various times.

{F670267}

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: epriestley, Korvin

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

+50 -8
+3 -3
resources/celerity/map.php
··· 7 7 */ 8 8 return array( 9 9 'names' => array( 10 - 'core.pkg.css' => 'b7d43de8', 10 + 'core.pkg.css' => 'af140e11', 11 11 'core.pkg.js' => 'a590b451', 12 12 'darkconsole.pkg.js' => 'e7393ebb', 13 13 'differential.pkg.css' => '9451634c', ··· 142 142 'rsrc/css/phui/phui-info-view.css' => '5b16bac6', 143 143 'rsrc/css/phui/phui-list.css' => '125599df', 144 144 'rsrc/css/phui/phui-object-box.css' => '407eaf5a', 145 - 'rsrc/css/phui/phui-object-item-list-view.css' => 'a1b990b7', 145 + 'rsrc/css/phui/phui-object-item-list-view.css' => '36ce366c', 146 146 'rsrc/css/phui/phui-pager.css' => 'bea33d23', 147 147 'rsrc/css/phui/phui-pinboard-view.css' => '2495140e', 148 148 'rsrc/css/phui/phui-property-list-view.css' => 'aeb09581', ··· 797 797 'phui-inline-comment-view-css' => '9fadd6b8', 798 798 'phui-list-view-css' => '125599df', 799 799 'phui-object-box-css' => '407eaf5a', 800 - 'phui-object-item-list-view-css' => 'a1b990b7', 800 + 'phui-object-item-list-view-css' => '36ce366c', 801 801 'phui-pager-css' => 'bea33d23', 802 802 'phui-pinboard-view-css' => '2495140e', 803 803 'phui-property-list-view-css' => 'aeb09581',
+8 -5
src/applications/countdown/query/PhabricatorCountdownSearchEngine.php
··· 102 102 foreach ($countdowns as $countdown) { 103 103 $id = $countdown->getID(); 104 104 $ended = false; 105 - $icon = 'fa-clock-o'; 106 - $color = 'green'; 107 105 $epoch = $countdown->getEpoch(); 108 106 if ($epoch <= PhabricatorTime::getNow()) { 109 107 $ended = true; 110 - $icon = 'fa-check-square-o'; 111 - $color = 'grey'; 112 108 } 113 109 114 110 $item = id(new PHUIObjectItemView()) ··· 116 112 ->setObject($countdown) 117 113 ->setObjectName("C{$id}") 118 114 ->setHeader($countdown->getTitle()) 119 - ->setStatusIcon($icon.' '.$color) 120 115 ->setHref($this->getApplicationURI("{$id}/")) 121 116 ->addByline( 122 117 pht( ··· 128 123 pht('Launched on %s', phabricator_datetime($epoch, $viewer))); 129 124 $item->setDisabled(true); 130 125 } else { 126 + $time_left = ($epoch - PhabricatorTime::getNow()); 127 + $num = round($time_left / (60 * 60 * 24)); 128 + $noun = pht('Days'); 129 + if ($num < 1) { 130 + $num = round($time_left / (60 * 60), 1); 131 + $noun = pht('Hours'); 132 + } 133 + $item->setCountdown($num, $noun); 131 134 $item->addAttribute( 132 135 phabricator_datetime($epoch, $viewer)); 133 136 }
+26
src/view/phui/PHUIObjectItemView.php
··· 24 24 private $imageIcon; 25 25 private $titleText; 26 26 private $badge; 27 + private $countdownNum; 28 + private $countdownNoun; 27 29 28 30 const AGE_FRESH = 'fresh'; 29 31 const AGE_STALE = 'stale'; ··· 102 104 103 105 public function setBadge(PHUIBadgeMiniView $badge) { 104 106 $this->badge = $badge; 107 + return $this; 108 + } 109 + 110 + public function setCountdown($num, $noun) { 111 + $this->countdownNum = $num; 112 + $this->countdownNoun = $noun; 105 113 return $this; 106 114 } 107 115 ··· 601 609 'class' => 'phui-object-item-col0 phui-object-item-badge', 602 610 ), 603 611 $this->badge); 612 + } 613 + 614 + if ($this->countdownNum) { 615 + $countdown = phutil_tag( 616 + 'div', 617 + array( 618 + 'class' => 'phui-object-item-countdown-number', 619 + ), 620 + array( 621 + phutil_tag_div('', $this->countdownNum), 622 + phutil_tag_div('', $this->countdownNoun), 623 + )); 624 + $column0 = phutil_tag( 625 + 'div', 626 + array( 627 + 'class' => 'phui-object-item-col0 phui-object-item-countdown', 628 + ), 629 + $countdown); 604 630 } 605 631 606 632 $column1 = phutil_tag(
+13
webroot/rsrc/css/phui/phui-object-item-list-view.css
··· 627 627 left: 0; 628 628 } 629 629 630 + /* - Countdowns ------------------------------------------------------------ */ 631 + 632 + .phui-object-item-col0.phui-object-item-countdown { 633 + width: 52px; 634 + padding: 0; 635 + } 636 + 637 + .phui-object-item-countdown .phui-object-item-countdown-number { 638 + border-right: 1px solid {$thinblueborder}; 639 + text-align: center; 640 + color: {$bluetext}; 641 + } 642 + 630 643 631 644 /* - Dashboards ------------------------------------------------------------ */ 632 645