1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-22 23:02:42 +01:00

Add dates to notifications page

Summary: Fixes T3957, adds timestamps to the notifications page.

Test Plan: View my notifications page, see the new time stamps. Uncertain if I set $user correctly.

Reviewers: epriestley, btrahan

Reviewed By: btrahan

CC: Korvin, epriestley, aran

Maniphest Tasks: T3957

Differential Revision: https://secure.phabricator.com/D8039
This commit is contained in:
Chad Little 2014-01-22 20:09:32 -08:00
parent 36892cfe10
commit 57f1a83488
5 changed files with 32 additions and 7 deletions

View file

@ -7,7 +7,7 @@
return array(
'names' =>
array(
'core.pkg.css' => '2eafddad',
'core.pkg.css' => '6c70dd0e',
'core.pkg.js' => 'c907bd96',
'darkconsole.pkg.js' => 'ca8671ce',
'differential.pkg.css' => '5a65a762',
@ -40,7 +40,7 @@ return array(
'rsrc/css/aphront/typeahead.css' => '00c9a200',
'rsrc/css/application/auth/auth.css' => '1e655982',
'rsrc/css/application/base/main-menu-view.css' => 'aba0b7a6',
'rsrc/css/application/base/notification-menu.css' => '07433791',
'rsrc/css/application/base/notification-menu.css' => 'fc9a363c',
'rsrc/css/application/base/phabricator-application-launch-view.css' => '6f8453d9',
'rsrc/css/application/base/standard-page-view.css' => '517cdfb1',
'rsrc/css/application/chatlog/chatlog.css' => '0cd2bc78',
@ -693,7 +693,7 @@ return array(
'phabricator-nav-view-css' => 'd0d4a509',
'phabricator-notification' => '95944043',
'phabricator-notification-css' => '6901121e',
'phabricator-notification-menu-css' => '07433791',
'phabricator-notification-menu-css' => 'fc9a363c',
'phabricator-object-list-view-css' => '1a1ea560',
'phabricator-object-selector-css' => '029a133d',
'phabricator-phtize' => 'd254d646',

View file

@ -3,11 +3,17 @@
final class PhabricatorNotificationBuilder {
private $stories;
private $user = null;
public function __construct(array $stories) {
$this->stories = $stories;
}
public function setUser($user) {
$this->user = $user;
return $this;
}
public function buildView() {
$stories = $this->stories;
@ -124,8 +130,7 @@ final class PhabricatorNotificationBuilder {
foreach ($stories as $story) {
$view = $story->renderView();
$null_view->appendChild($view->renderNotification());
$null_view->appendChild($view->renderNotification($this->user));
}
return $null_view;

View file

@ -43,6 +43,7 @@ final class PhabricatorNotificationListController
if ($notifications) {
$builder = new PhabricatorNotificationBuilder($notifications);
$builder->setUser($user);
$view = $builder->buildView()->render();
} else {
$view = phutil_tag_div(

View file

@ -99,7 +99,7 @@ final class PHUIFeedStoryView extends AphrontView {
return $this->href;
}
public function renderNotification() {
public function renderNotification($user) {
$classes = array(
'phabricator-notification',
);
@ -107,6 +107,20 @@ final class PHUIFeedStoryView extends AphrontView {
if (!$this->viewed) {
$classes[] = 'phabricator-notification-unread';
}
if ($this->epoch) {
if ($user) {
$foot = phabricator_datetime($this->epoch, $user);
$foot = phutil_tag(
'span',
array(
'class' => 'phabricator-notification-date'),
$foot);
} else {
$foot = null;
}
} else {
$foot = pht('No time specified.');
}
return javelin_tag(
'div',
@ -117,7 +131,7 @@ final class PHUIFeedStoryView extends AphrontView {
'href' => $this->getHref(),
),
),
$this->title);
array($this->title, $foot));
}
public function render() {

View file

@ -13,6 +13,11 @@
border-radius: 3px;
}
.phabricator-notification .phabricator-notification-date {
margin-left: 8px;
color: {$lightgreytext};
}
.phabricator-notification-menu-loading {
text-align: center;
padding: 10px 0;