diff --git a/src/applications/diviner/controller/DivinerBookController.php b/src/applications/diviner/controller/DivinerBookController.php --- a/src/applications/diviner/controller/DivinerBookController.php +++ b/src/applications/diviner/controller/DivinerBookController.php @@ -35,16 +35,14 @@ $header = id(new PHUIHeaderView()) ->setHeader($book->getTitle()) ->setUser($viewer) - ->setPolicyObject($book); + ->setPolicyObject($book) + ->setEpoch($book->getDateModified()); $document = new PHUIDocumentView(); $document->setHeader($header); $document->addClass('diviner-view'); - $document->setFontKit(PHUIDocumentView::FONT_SOURCE_SANS); - $properties = $this->buildPropertyList($book); - $atoms = id(new DivinerAtomQuery()) ->setViewer($viewer) ->withBookPHIDs(array($book->getPHID())) @@ -87,7 +85,6 @@ $viewer); } - $document->appendChild($properties); $document->appendChild($preface_view); $document->appendChild($out); @@ -101,20 +98,4 @@ )); } - private function buildPropertyList(DivinerLiveBook $book) { - $viewer = $this->getRequest()->getUser(); - $view = id(new PHUIPropertyListView()) - ->setUser($viewer); - - $policies = PhabricatorPolicyQuery::renderPolicyDescriptions( - $viewer, - $book); - - $view->addProperty( - pht('Updated'), - phabricator_datetime($book->getDateModified(), $viewer)); - - return $view; - } - } diff --git a/src/applications/legalpad/controller/LegalpadDocumentSignController.php b/src/applications/legalpad/controller/LegalpadDocumentSignController.php --- a/src/applications/legalpad/controller/LegalpadDocumentSignController.php +++ b/src/applications/legalpad/controller/LegalpadDocumentSignController.php @@ -232,6 +232,9 @@ $header = id(new PHUIHeaderView()) ->setHeader($title) + ->setUser($viewer) + ->setPolicyObject($document) + ->setEpoch($document->getDateModified()) ->addActionLink( id(new PHUIButtonView()) ->setTag('a') diff --git a/src/applications/phriction/controller/PhrictionDocumentController.php b/src/applications/phriction/controller/PhrictionDocumentController.php --- a/src/applications/phriction/controller/PhrictionDocumentController.php +++ b/src/applications/phriction/controller/PhrictionDocumentController.php @@ -194,7 +194,8 @@ $header = id(new PHUIHeaderView()) ->setUser($user) ->setPolicyObject($document) - ->setHeader($page_title); + ->setHeader($page_title) + ->setEpoch($content->getDateCreated()); $prop_list = null; if ($properties) { @@ -244,17 +245,6 @@ pht('Last Author'), $viewer->renderHandle($content->getAuthorPHID())); - $age = time() - $content->getDateCreated(); - $age = floor($age / (60 * 60 * 24)); - if ($age < 1) { - $when = pht('Today'); - } else if ($age == 1) { - $when = pht('Yesterday'); - } else { - $when = pht('%d Days Ago', $age); - } - $view->addProperty(pht('Last Updated'), $when); - return $view; } diff --git a/src/view/phui/PHUIHeaderView.php b/src/view/phui/PHUIHeaderView.php --- a/src/view/phui/PHUIHeaderView.php +++ b/src/view/phui/PHUIHeaderView.php @@ -17,6 +17,7 @@ private $actionLinks = array(); private $buttonBar = null; private $policyObject; + private $epoch; public function setHeader($header) { $this->header = $header; @@ -107,6 +108,21 @@ return $this->addProperty(self::PROPERTY_STATUS, $tag); } + public function setEpoch($epoch) { + $age = time() - $epoch; + $age = floor($age / (60 * 60 * 24)); + if ($age < 1) { + $when = pht('Today'); + } else if ($age == 1) { + $when = pht('Yesterday'); + } else { + $when = pht('%d Days Ago', $age); + } + + $this->setStatus('fa-clock-o bluegrey', null, pht('Updated %s', $when)); + return $this; + } + public function render() { require_celerity_resource('phui-header-view-css');