diff --git a/scripts/celerity_mapper.php b/scripts/celerity_mapper.php index 5327c49275..cb963ad033 100755 --- a/scripts/celerity_mapper.php +++ b/scripts/celerity_mapper.php @@ -90,6 +90,7 @@ $package_spec = array( 'differential-changeset-view-css', 'differential-results-table-css', 'differential-revision-history-css', + 'differential-revision-list-css', 'differential-table-of-contents-css', 'differential-revision-comment-css', 'differential-revision-add-comment-css', diff --git a/src/__celerity_resource_map__.php b/src/__celerity_resource_map__.php index e002f9db8f..6f514ff714 100644 --- a/src/__celerity_resource_map__.php +++ b/src/__celerity_resource_map__.php @@ -751,6 +751,15 @@ celerity_register_resource_map(array( ), 'disk' => '/rsrc/css/application/differential/revision-history.css', ), + 'differential-revision-list-css' => + array( + 'uri' => '/res/7659ad8d/rsrc/css/application/differential/revision-list.css', + 'type' => 'css', + 'requires' => + array( + ), + 'disk' => '/rsrc/css/application/differential/revision-list.css', + ), 'differential-table-of-contents-css' => array( 'uri' => '/res/0ac99a19/rsrc/css/application/differential/table-of-contents.css', @@ -2956,7 +2965,7 @@ celerity_register_resource_map(array( 'uri' => '/res/pkg/971b021e/core.pkg.js', 'type' => 'js', ), - '19ebcc79' => + '9a22cfb9' => array( 'name' => 'differential.pkg.css', 'symbols' => @@ -2965,17 +2974,18 @@ celerity_register_resource_map(array( 1 => 'differential-changeset-view-css', 2 => 'differential-results-table-css', 3 => 'differential-revision-history-css', - 4 => 'differential-table-of-contents-css', - 5 => 'differential-revision-comment-css', - 6 => 'differential-revision-add-comment-css', - 7 => 'differential-revision-comment-list-css', - 8 => 'phabricator-object-selector-css', - 9 => 'aphront-headsup-action-list-view-css', - 10 => 'phabricator-content-source-view-css', - 11 => 'differential-local-commits-view-css', - 12 => 'inline-comment-summary-css', + 4 => 'differential-revision-list-css', + 5 => 'differential-table-of-contents-css', + 6 => 'differential-revision-comment-css', + 7 => 'differential-revision-add-comment-css', + 8 => 'differential-revision-comment-list-css', + 9 => 'phabricator-object-selector-css', + 10 => 'aphront-headsup-action-list-view-css', + 11 => 'phabricator-content-source-view-css', + 12 => 'differential-local-commits-view-css', + 13 => 'inline-comment-summary-css', ), - 'uri' => '/res/pkg/19ebcc79/differential.pkg.css', + 'uri' => '/res/pkg/9a22cfb9/differential.pkg.css', 'type' => 'css', ), 'ffc69a16' => @@ -3098,7 +3108,7 @@ celerity_register_resource_map(array( 'aphront-dialog-view-css' => 'a740b991', 'aphront-error-view-css' => 'a740b991', 'aphront-form-view-css' => 'a740b991', - 'aphront-headsup-action-list-view-css' => '19ebcc79', + 'aphront-headsup-action-list-view-css' => '9a22cfb9', 'aphront-headsup-view-css' => 'a740b991', 'aphront-list-filter-view-css' => 'a740b991', 'aphront-pager-view-css' => 'a740b991', @@ -3108,19 +3118,20 @@ celerity_register_resource_map(array( 'aphront-tokenizer-control-css' => 'a740b991', 'aphront-tooltip-css' => 'a740b991', 'aphront-typeahead-control-css' => 'a740b991', - 'differential-changeset-view-css' => '19ebcc79', - 'differential-core-view-css' => '19ebcc79', + 'differential-changeset-view-css' => '9a22cfb9', + 'differential-core-view-css' => '9a22cfb9', 'differential-inline-comment-editor' => 'ffc69a16', - 'differential-local-commits-view-css' => '19ebcc79', - 'differential-results-table-css' => '19ebcc79', - 'differential-revision-add-comment-css' => '19ebcc79', - 'differential-revision-comment-css' => '19ebcc79', - 'differential-revision-comment-list-css' => '19ebcc79', - 'differential-revision-history-css' => '19ebcc79', - 'differential-table-of-contents-css' => '19ebcc79', + 'differential-local-commits-view-css' => '9a22cfb9', + 'differential-results-table-css' => '9a22cfb9', + 'differential-revision-add-comment-css' => '9a22cfb9', + 'differential-revision-comment-css' => '9a22cfb9', + 'differential-revision-comment-list-css' => '9a22cfb9', + 'differential-revision-history-css' => '9a22cfb9', + 'differential-revision-list-css' => '9a22cfb9', + 'differential-table-of-contents-css' => '9a22cfb9', 'diffusion-commit-view-css' => 'c8ce2d88', 'diffusion-icons-css' => 'c8ce2d88', - 'inline-comment-summary-css' => '19ebcc79', + 'inline-comment-summary-css' => '9a22cfb9', 'javelin-behavior' => '6fb20113', 'javelin-behavior-aphront-basic-tokenizer' => '97f65640', 'javelin-behavior-aphront-drag-and-drop' => 'ffc69a16', @@ -3174,7 +3185,7 @@ celerity_register_resource_map(array( 'maniphest-task-summary-css' => '7839ae2d', 'maniphest-transaction-detail-css' => '7839ae2d', 'phabricator-app-buttons-css' => 'a740b991', - 'phabricator-content-source-view-css' => '19ebcc79', + 'phabricator-content-source-view-css' => '9a22cfb9', 'phabricator-core-buttons-css' => 'a740b991', 'phabricator-core-css' => 'a740b991', 'phabricator-directory-css' => 'a740b991', @@ -3185,7 +3196,7 @@ celerity_register_resource_map(array( 'phabricator-keyboard-shortcut' => '971b021e', 'phabricator-keyboard-shortcut-manager' => '971b021e', 'phabricator-menu-item' => '971b021e', - 'phabricator-object-selector-css' => '19ebcc79', + 'phabricator-object-selector-css' => '9a22cfb9', 'phabricator-paste-file-upload' => '971b021e', 'phabricator-prefab' => '971b021e', 'phabricator-project-tag-css' => '7839ae2d', diff --git a/src/applications/differential/controller/DifferentialRevisionListController.php b/src/applications/differential/controller/DifferentialRevisionListController.php index e14c1ecaac..fdfbb2e599 100644 --- a/src/applications/differential/controller/DifferentialRevisionListController.php +++ b/src/applications/differential/controller/DifferentialRevisionListController.php @@ -438,6 +438,7 @@ final class DifferentialRevisionListController extends DifferentialController { $user_phid); $view = id(clone $template) + ->setHighlightAge(true) ->setRevisions($active); $views[] = array( 'title' => 'Action Required', diff --git a/src/applications/differential/view/DifferentialRevisionListView.php b/src/applications/differential/view/DifferentialRevisionListView.php index 36cb15f2f8..360950a52d 100644 --- a/src/applications/differential/view/DifferentialRevisionListView.php +++ b/src/applications/differential/view/DifferentialRevisionListView.php @@ -25,8 +25,12 @@ final class DifferentialRevisionListView extends AphrontView { private $handles; private $user; private $fields; + private $highlightAge; const NO_DATA_STRING = 'No revisions found.'; + const DAYS_FRESH = 1; + const DAYS_STALE = 3; + public function setFields(array $fields) { assert_instances_of($fields, 'DifferentialFieldSpecification'); $this->fields = $fields; @@ -39,6 +43,11 @@ final class DifferentialRevisionListView extends AphrontView { return $this; } + public function setHighlightAge($bool) { + $this->highlightAge = $bool; + return $this; + } + public function getRequiredHandlePHIDs() { $phids = array(); foreach ($this->fields as $field) { @@ -67,6 +76,15 @@ final class DifferentialRevisionListView extends AphrontView { throw new Exception("Call setUser() before render()!"); } + if ($this->highlightAge) { + $fresh = PhabricatorCalendarHoliday::getNthBusinessDay( + time(), + -self::DAYS_FRESH); + $stale = PhabricatorCalendarHoliday::getNthBusinessDay( + time(), + -self::DAYS_STALE); + } + Javelin::initBehavior('phabricator-tooltips', array()); require_celerity_resource('aphront-tooltip-css'); @@ -81,6 +99,7 @@ final class DifferentialRevisionListView extends AphrontView { $field->setHandles($this->handles); } + $cell_classes = array(); $rows = array(); foreach ($this->revisions as $revision) { $phid = $revision->getPHID(); @@ -104,9 +123,25 @@ final class DifferentialRevisionListView extends AphrontView { ''); } $row = array($flag); + + $modified = $revision->getDateModified(); + foreach ($this->fields as $field) { + if ($this->highlightAge && + $field instanceof DifferentialDateModifiedFieldSpecification) { + if ($modified < $stale) { + $class = 'revision-age-old'; + } else if ($modified < $fresh) { + $class = 'revision-age-stale'; + } else { + $class = 'revision-age-fresh'; + } + $cell_classes[count($rows)][count($row)] = $class; + } + $row[] = $field->renderValueForRevisionList($revision); } + $rows[] = $row; } @@ -120,9 +155,12 @@ final class DifferentialRevisionListView extends AphrontView { $table = new AphrontTableView($rows); $table->setHeaders($headers); $table->setColumnClasses($classes); + $table->setCellClasses($cell_classes); $table->setNoDataString(DifferentialRevisionListView::NO_DATA_STRING); + require_celerity_resource('differential-revision-history-css'); + return $table->render(); } diff --git a/src/applications/directory/controller/PhabricatorDirectoryMainController.php b/src/applications/directory/controller/PhabricatorDirectoryMainController.php index 327fee88c7..0b0228251f 100644 --- a/src/applications/directory/controller/PhabricatorDirectoryMainController.php +++ b/src/applications/directory/controller/PhabricatorDirectoryMainController.php @@ -323,6 +323,7 @@ final class PhabricatorDirectoryMainController "View Active Revisions \xC2\xBB")); $revision_view = id(new DifferentialRevisionListView()) + ->setHighlightAge(true) ->setRevisions($active) ->setFields(DifferentialRevisionListView::getDefaultFields()) ->setUser($user); diff --git a/src/view/control/AphrontTableView.php b/src/view/control/AphrontTableView.php index dbda7bd6d3..78cbfdebe7 100644 --- a/src/view/control/AphrontTableView.php +++ b/src/view/control/AphrontTableView.php @@ -22,6 +22,7 @@ final class AphrontTableView extends AphrontView { protected $headers; protected $rowClasses = array(); protected $columnClasses = array(); + protected $cellClasses = array(); protected $zebraStripes = true; protected $noDataString; protected $className; @@ -52,6 +53,11 @@ final class AphrontTableView extends AphrontView { return $this; } + public function setCellClasses(array $cell_classes) { + $this->cellClasses = $cell_classes; + return $this; + } + public function setNoDataString($no_data_string) { $this->noDataString = $no_data_string; return $this; @@ -191,7 +197,7 @@ final class AphrontTableView extends AphrontView { } if ($value !== null) { - $col_classes[$key] = ' class="'.$value.'"'; + $col_classes[$key] = $value; } } @@ -226,8 +232,11 @@ final class AphrontTableView extends AphrontView { continue; } $class = $col_classes[$col_num]; + if (!empty($this->cellClasses[$row_num][$col_num])) { + $class = trim($class.' '.$this->cellClasses[$row_num][$col_num]); + } if ($class !== null) { - $table[] = '