Skip to content

Commit 6637acb

Browse files
committedMay 30, 2013
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
1 parent d82e135 commit 6637acb

File tree

6 files changed

+71
-3
lines changed

6 files changed

+71
-3
lines changed
 

‎src/__celerity_resource_map__.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -927,7 +927,7 @@
927927
),
928928
'conpherence-message-pane-css' =>
929929
array(
930-
'uri' => '/res/cbd704df/rsrc/css/application/conpherence/message-pane.css',
930+
'uri' => '/res/3a94564a/rsrc/css/application/conpherence/message-pane.css',
931931
'type' => 'css',
932932
'requires' =>
933933
array(
@@ -1294,7 +1294,7 @@
12941294
),
12951295
'javelin-behavior-conpherence-menu' =>
12961296
array(
1297-
'uri' => '/res/567585ab/rsrc/js/application/conpherence/behavior-menu.js',
1297+
'uri' => '/res/f27205d4/rsrc/js/application/conpherence/behavior-menu.js',
12981298
'type' => 'js',
12991299
'requires' =>
13001300
array(

‎src/applications/conpherence/constants/ConpherenceTransactionType.php

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ final class ConpherenceTransactionType extends ConpherenceConstants {
88
const TYPE_FILES = 'files';
99
const TYPE_TITLE = 'title';
1010
const TYPE_PARTICIPANTS = 'participants';
11+
const TYPE_DATE_MARKER = 'date-marker';
1112

1213
/* these two are deprecated but keep them around for legacy installs */
1314
const TYPE_PICTURE = 'picture';

‎src/applications/conpherence/controller/ConpherenceController.php

+28
Original file line numberDiff line numberDiff line change
@@ -108,13 +108,41 @@ protected function renderConpherenceTransactions(
108108
}
109109
}
110110
$engine->process();
111+
// we're going to insert a dummy date marker transaction for breaks
112+
// between days. some setup required!
113+
$previous_transaction = null;
114+
$date_marker_transaction = id(new ConpherenceTransaction())
115+
->setTransactionType(ConpherenceTransactionType::TYPE_DATE_MARKER)
116+
->makeEphemeral();
117+
$date_marker_transaction_view = id(new ConpherenceTransactionView())
118+
->setUser($user)
119+
->setConpherenceTransaction($date_marker_transaction)
120+
->setHandles($handles)
121+
->setMarkupEngine($engine);
111122
foreach ($transactions as $transaction) {
123+
if ($previous_transaction) {
124+
$previous_day = phabricator_format_local_time(
125+
$previous_transaction->getDateCreated(),
126+
$user,
127+
'Ymd');
128+
$current_day = phabricator_format_local_time(
129+
$transaction->getDateCreated(),
130+
$user,
131+
'Ymd');
132+
// date marker transaction time!
133+
if ($previous_day != $current_day) {
134+
$date_marker_transaction->setDateCreated(
135+
$transaction->getDateCreated());
136+
$rendered_transactions[] = $date_marker_transaction_view->render();
137+
}
138+
}
112139
$rendered_transactions[] = id(new ConpherenceTransactionView())
113140
->setUser($user)
114141
->setConpherenceTransaction($transaction)
115142
->setHandles($handles)
116143
->setMarkupEngine($engine)
117144
->render();
145+
$previous_transaction = $transaction;
118146
}
119147
$latest_transaction_id = $transaction->getID();
120148

‎src/applications/conpherence/storage/ConpherenceTransaction.php

+2
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ public function shouldHide() {
3939
case ConpherenceTransactionType::TYPE_PARTICIPANTS:
4040
return ($old === null);
4141
case ConpherenceTransactionType::TYPE_TITLE:
42+
case ConpherenceTransactionType::TYPE_DATE_MARKER:
4243
return false;
4344
case ConpherenceTransactionType::TYPE_FILES:
4445
return true;
@@ -142,6 +143,7 @@ public function getRequiredHandlePHIDs() {
142143
switch ($this->getTransactionType()) {
143144
case ConpherenceTransactionType::TYPE_TITLE:
144145
case ConpherenceTransactionType::TYPE_FILES:
146+
case ConpherenceTransactionType::TYPE_DATE_MARKER:
145147
break;
146148
case ConpherenceTransactionType::TYPE_PARTICIPANTS:
147149
$phids = array_merge($phids, $this->getOldValue());

‎src/applications/conpherence/view/ConpherenceTransactionView.php

+22-1
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,33 @@ private function getConpherenceTransaction() {
3232
}
3333

3434
public function render() {
35+
$user = $this->getUser();
3536
$transaction = $this->getConpherenceTransaction();
37+
switch ($transaction->getTransactionType()) {
38+
case ConpherenceTransactionType::TYPE_DATE_MARKER:
39+
return phutil_tag(
40+
'div',
41+
array(
42+
'class' => 'date-marker'
43+
),
44+
array(
45+
phutil_tag(
46+
'span',
47+
array(
48+
'class' => 'date',
49+
),
50+
phabricator_format_local_time(
51+
$transaction->getDateCreated(),
52+
$user,
53+
'M jS, Y'))));
54+
break;
55+
}
56+
3657
$handles = $this->getHandles();
3758
$transaction->setHandles($handles);
3859
$author = $handles[$transaction->getAuthorPHID()];
3960
$transaction_view = id(new PhabricatorTransactionView())
40-
->setUser($this->getUser())
61+
->setUser($user)
4162
->setEpoch($transaction->getDateCreated())
4263
->setContentSource($transaction->getContentSource());
4364

‎webroot/rsrc/css/application/conpherence/message-pane.css

+16
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,22 @@
133133
margin-left: 45px;
134134
}
135135

136+
.conpherence-message-pane .date-marker {
137+
border-top: 1px solid #bfbfbf;
138+
margin: 5px 15px;
139+
min-height: auto;
140+
}
141+
.conpherence-message-pane .date-marker .date {
142+
position: relative;
143+
top: -8px;
144+
left: 45px;
145+
background-color: #FFF;
146+
width: auto;
147+
color: #BFBFBF;
148+
font-size: 11px;
149+
padding: 0px 5px;
150+
}
151+
136152
.device-phone .conpherence-message-pane .phabricator-transaction-detail {
137153
min-height: auto;
138154
}

0 commit comments

Comments
 (0)
Failed to load comments.