From d90496a7192d36860e2d7dd6602ccf421ae67605 Mon Sep 17 00:00:00 2001 From: Bob Trahan Date: Tue, 14 Apr 2015 11:28:33 -0700 Subject: [PATCH] Conpherence - make timestamps in durable column link to full message in conpherence Summary: Ref T7757. This diff made me realize that `PhabricatorTransactionView` is only used in Conpherence, as well as that `ConpherenceTransactionView` is more like a rendering class with a few static methods. Going to take a diff after this to clean all that up. Test Plan: opened up durable column, clicked on timestamp, voila! Reviewers: chad, epriestley Reviewed By: epriestley Subscribers: Korvin, epriestley Maniphest Tasks: T7757 Differential Revision: https://secure.phabricator.com/D12409 --- resources/celerity/map.php | 4 ++-- .../view/ConpherenceTransactionView.php | 18 +++++++++++++++++- src/view/layout/PhabricatorTransactionView.php | 18 +++++++++++++++--- .../application/conpherence/durable-column.css | 4 ++-- 4 files changed, 36 insertions(+), 8 deletions(-) diff --git a/resources/celerity/map.php b/resources/celerity/map.php index b3d30dbabd..ad4b786e55 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -44,7 +44,7 @@ return array( 'rsrc/css/application/config/config-welcome.css' => '6abd79be', 'rsrc/css/application/config/setup-issue.css' => '22270af2', 'rsrc/css/application/config/unhandled-exception.css' => '37d4f9a2', - 'rsrc/css/application/conpherence/durable-column.css' => '16051a19', + 'rsrc/css/application/conpherence/durable-column.css' => '9d3af55b', 'rsrc/css/application/conpherence/menu.css' => 'f389e048', 'rsrc/css/application/conpherence/message-pane.css' => 'e978e4ae', 'rsrc/css/application/conpherence/notification.css' => '72178795', @@ -515,7 +515,7 @@ return array( 'changeset-view-manager' => '58562350', 'config-options-css' => '7fedf08b', 'config-welcome-css' => '6abd79be', - 'conpherence-durable-column-view' => '16051a19', + 'conpherence-durable-column-view' => '9d3af55b', 'conpherence-menu-css' => 'f389e048', 'conpherence-message-pane-css' => 'e978e4ae', 'conpherence-notification-css' => '72178795', diff --git a/src/applications/conpherence/view/ConpherenceTransactionView.php b/src/applications/conpherence/view/ConpherenceTransactionView.php index a9d77c2ef0..a93eb15826 100644 --- a/src/applications/conpherence/view/ConpherenceTransactionView.php +++ b/src/applications/conpherence/view/ConpherenceTransactionView.php @@ -2,6 +2,7 @@ final class ConpherenceTransactionView extends AphrontView { + private $conpherenceThread; private $conpherenceTransaction; private $handles; private $markupEngine; @@ -24,6 +25,15 @@ final class ConpherenceTransactionView extends AphrontView { return $this->handles; } + public function setConpherenceThread(ConpherenceThread $t) { + $this->conpherenceThread = $t; + return $this; + } + + private function getConpherenceThread() { + return $this->conpherenceThread; + } + public function setConpherenceTransaction(ConpherenceTransaction $tx) { $this->conpherenceTransaction = $tx; return $this; @@ -62,6 +72,7 @@ final class ConpherenceTransactionView extends AphrontView { public function render() { $user = $this->getUser(); + $transaction = $this->getConpherenceTransaction(); switch ($transaction->getTransactionType()) { case ConpherenceTransactionType::TYPE_DATE_MARKER: @@ -84,6 +95,7 @@ final class ConpherenceTransactionView extends AphrontView { break; } + $conpherence = $this->getConpherenceThread(); $handles = $this->getHandles(); $transaction->setHandles($handles); $author = $handles[$transaction->getAuthorPHID()]; @@ -96,7 +108,9 @@ final class ConpherenceTransactionView extends AphrontView { phabricator_time($transaction->getDateCreated(), $user)); } else { $transaction_view - ->setEpoch($transaction->getDateCreated()) + ->setEpoch( + $transaction->getDateCreated(), + '/'.$conpherence->getMonogram().'#'.$transaction->getID()) ->setTimeOnly(true); } if ($this->getShowContentSource()) { @@ -185,6 +199,7 @@ final class ConpherenceTransactionView extends AphrontView { $date_marker_transaction_view = id(new ConpherenceTransactionView()) ->setUser($user) ->setConpherenceTransaction($date_marker_transaction) + ->setConpherenceThread($conpherence) ->setHandles($handles) ->setShowImages($full_display) ->setShowContentSource($full_display) @@ -210,6 +225,7 @@ final class ConpherenceTransactionView extends AphrontView { $rendered_transactions[] = id(new ConpherenceTransactionView()) ->setUser($user) ->setConpherenceTransaction($transaction) + ->setConpherenceThread($conpherence) ->setHandles($handles) ->setMarkupEngine($engine) ->setRenderAnchors($full_display) diff --git a/src/view/layout/PhabricatorTransactionView.php b/src/view/layout/PhabricatorTransactionView.php index 398cafe215..043096a6c2 100644 --- a/src/view/layout/PhabricatorTransactionView.php +++ b/src/view/layout/PhabricatorTransactionView.php @@ -5,6 +5,7 @@ final class PhabricatorTransactionView extends AphrontView { private $imageURI; private $actions = array(); private $epoch; + private $epochHref; private $contentSource; private $anchorName; private $anchorText; @@ -22,8 +23,9 @@ final class PhabricatorTransactionView extends AphrontView { return $this; } - public function setEpoch($epoch) { + public function setEpoch($epoch, $epoch_href = null) { $this->epoch = $epoch; + $this->epochHref = $epoch_href; return $this; } @@ -103,10 +105,20 @@ final class PhabricatorTransactionView extends AphrontView { $info[] = pht('PREVIEW'); } else if ($this->epoch) { if ($this->timeOnly) { - $info[] = phabricator_time($this->epoch, $this->user); + $epoch = phabricator_time($this->epoch, $this->user); } else { - $info[] = phabricator_datetime($this->epoch, $this->user); + $epoch = phabricator_datetime($this->epoch, $this->user); } + if ($this->epochHref) { + $epoch = phutil_tag( + 'a', + array( + 'href' => $this->epochHref, + 'class' => 'epoch-link', + ), + $epoch); + } + $info[] = $epoch; } if ($this->anchorName) { diff --git a/webroot/rsrc/css/application/conpherence/durable-column.css b/webroot/rsrc/css/application/conpherence/durable-column.css index 9f36076b89..822d78f41f 100644 --- a/webroot/rsrc/css/application/conpherence/durable-column.css +++ b/webroot/rsrc/css/application/conpherence/durable-column.css @@ -199,13 +199,13 @@ .conpherence-durable-column-transactions .phabricator-transaction-detail .phabricator-transaction-header .phabricator-transaction-info, -.phabricator-transaction-header .anchor-link { +.phabricator-transaction-header .epoch-link { color: {$lightbluetext}; float: none; font-size: 12px; } -.phabricator-transaction-header .anchor-link { +.phabricator-transaction-header .epoch-link { font-weight: normal; }