1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-01-27 15:08:20 +01:00

Conpherence - add daily date dividers

Summary: nice title. Fixes T3203. If its been N days and now its Tuesday, it just shows a single marker for Tuesday.

Test Plan: Viewed a conpherence and there were date dividers!

Reviewers: epriestley, chad

Reviewed By: epriestley

CC: aran, Korvin

Maniphest Tasks: T3203

Differential Revision: https://secure.phabricator.com/D6081
This commit is contained in:
Bob Trahan 2013-05-30 14:24:50 -07:00
parent d82e135cde
commit 6637acb3e4
6 changed files with 71 additions and 3 deletions

View file

@ -927,7 +927,7 @@ celerity_register_resource_map(array(
),
'conpherence-message-pane-css' =>
array(
'uri' => '/res/cbd704df/rsrc/css/application/conpherence/message-pane.css',
'uri' => '/res/3a94564a/rsrc/css/application/conpherence/message-pane.css',
'type' => 'css',
'requires' =>
array(
@ -1294,7 +1294,7 @@ celerity_register_resource_map(array(
),
'javelin-behavior-conpherence-menu' =>
array(
'uri' => '/res/567585ab/rsrc/js/application/conpherence/behavior-menu.js',
'uri' => '/res/f27205d4/rsrc/js/application/conpherence/behavior-menu.js',
'type' => 'js',
'requires' =>
array(

View file

@ -8,6 +8,7 @@ final class ConpherenceTransactionType extends ConpherenceConstants {
const TYPE_FILES = 'files';
const TYPE_TITLE = 'title';
const TYPE_PARTICIPANTS = 'participants';
const TYPE_DATE_MARKER = 'date-marker';
/* these two are deprecated but keep them around for legacy installs */
const TYPE_PICTURE = 'picture';

View file

@ -108,13 +108,41 @@ abstract class ConpherenceController extends PhabricatorController {
}
}
$engine->process();
// we're going to insert a dummy date marker transaction for breaks
// between days. some setup required!
$previous_transaction = null;
$date_marker_transaction = id(new ConpherenceTransaction())
->setTransactionType(ConpherenceTransactionType::TYPE_DATE_MARKER)
->makeEphemeral();
$date_marker_transaction_view = id(new ConpherenceTransactionView())
->setUser($user)
->setConpherenceTransaction($date_marker_transaction)
->setHandles($handles)
->setMarkupEngine($engine);
foreach ($transactions as $transaction) {
if ($previous_transaction) {
$previous_day = phabricator_format_local_time(
$previous_transaction->getDateCreated(),
$user,
'Ymd');
$current_day = phabricator_format_local_time(
$transaction->getDateCreated(),
$user,
'Ymd');
// date marker transaction time!
if ($previous_day != $current_day) {
$date_marker_transaction->setDateCreated(
$transaction->getDateCreated());
$rendered_transactions[] = $date_marker_transaction_view->render();
}
}
$rendered_transactions[] = id(new ConpherenceTransactionView())
->setUser($user)
->setConpherenceTransaction($transaction)
->setHandles($handles)
->setMarkupEngine($engine)
->render();
$previous_transaction = $transaction;
}
$latest_transaction_id = $transaction->getID();

View file

@ -39,6 +39,7 @@ final class ConpherenceTransaction extends PhabricatorApplicationTransaction {
case ConpherenceTransactionType::TYPE_PARTICIPANTS:
return ($old === null);
case ConpherenceTransactionType::TYPE_TITLE:
case ConpherenceTransactionType::TYPE_DATE_MARKER:
return false;
case ConpherenceTransactionType::TYPE_FILES:
return true;
@ -142,6 +143,7 @@ final class ConpherenceTransaction extends PhabricatorApplicationTransaction {
switch ($this->getTransactionType()) {
case ConpherenceTransactionType::TYPE_TITLE:
case ConpherenceTransactionType::TYPE_FILES:
case ConpherenceTransactionType::TYPE_DATE_MARKER:
break;
case ConpherenceTransactionType::TYPE_PARTICIPANTS:
$phids = array_merge($phids, $this->getOldValue());

View file

@ -32,12 +32,33 @@ final class ConpherenceTransactionView extends AphrontView {
}
public function render() {
$user = $this->getUser();
$transaction = $this->getConpherenceTransaction();
switch ($transaction->getTransactionType()) {
case ConpherenceTransactionType::TYPE_DATE_MARKER:
return phutil_tag(
'div',
array(
'class' => 'date-marker'
),
array(
phutil_tag(
'span',
array(
'class' => 'date',
),
phabricator_format_local_time(
$transaction->getDateCreated(),
$user,
'M jS, Y'))));
break;
}
$handles = $this->getHandles();
$transaction->setHandles($handles);
$author = $handles[$transaction->getAuthorPHID()];
$transaction_view = id(new PhabricatorTransactionView())
->setUser($this->getUser())
->setUser($user)
->setEpoch($transaction->getDateCreated())
->setContentSource($transaction->getContentSource());

View file

@ -133,6 +133,22 @@
margin-left: 45px;
}
.conpherence-message-pane .date-marker {
border-top: 1px solid #bfbfbf;
margin: 5px 15px;
min-height: auto;
}
.conpherence-message-pane .date-marker .date {
position: relative;
top: -8px;
left: 45px;
background-color: #FFF;
width: auto;
color: #BFBFBF;
font-size: 11px;
padding: 0px 5px;
}
.device-phone .conpherence-message-pane .phabricator-transaction-detail {
min-height: auto;
}