mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-27 01:02:42 +01:00
Conpherence - tweak calendar widget
Summary: this does a few things. Fixes T3253. Including the Sunday -> Saturday list view part. Cleans up the display when there are no events, getting rid of this spacer thing. Also fixes Calendar CSS for device-tablet where we had a 2px gap on the calendar from the header. Test Plan: played with calendar widget a bunch Reviewers: epriestley, chad Reviewed By: chad CC: aran, Korvin Maniphest Tasks: T3253 Differential Revision: https://secure.phabricator.com/D6102
This commit is contained in:
parent
f4bd214f14
commit
11961cdebb
3 changed files with 115 additions and 113 deletions
|
@ -204,33 +204,42 @@ final class ConpherenceWidgetController extends
|
||||||
$today = $timestamps['today'];
|
$today = $timestamps['today'];
|
||||||
$epoch_stamps = $timestamps['epoch_stamps'];
|
$epoch_stamps = $timestamps['epoch_stamps'];
|
||||||
$one_day = 24 * 60 * 60;
|
$one_day = 24 * 60 * 60;
|
||||||
foreach ($epoch_stamps as $time => $day) {
|
$is_today = false;
|
||||||
|
$calendar_columns = 0;
|
||||||
|
$list_days = 0;
|
||||||
|
foreach ($epoch_stamps as $day) {
|
||||||
// build a header for the new day
|
// build a header for the new day
|
||||||
if ($day->format('w') == $today->format('w')) {
|
if ($day->format('Ymd') == $today->format('Ymd')) {
|
||||||
$active_class = 'today';
|
$active_class = 'today';
|
||||||
|
$is_today = true;
|
||||||
} else {
|
} else {
|
||||||
$active_class = '';
|
$active_class = '';
|
||||||
|
$is_today = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$content[] = phutil_tag(
|
$should_draw_list = $list_days < 7;
|
||||||
'div',
|
$list_days++;
|
||||||
array(
|
|
||||||
'class' => 'day-header '.$active_class
|
if ($should_draw_list) {
|
||||||
),
|
$content[] = phutil_tag(
|
||||||
array(
|
'div',
|
||||||
phutil_tag(
|
array(
|
||||||
'div',
|
'class' => 'day-header '.$active_class
|
||||||
array(
|
),
|
||||||
'class' => 'day-name'
|
array(
|
||||||
),
|
phutil_tag(
|
||||||
$day->format('l')),
|
'div',
|
||||||
phutil_tag(
|
array(
|
||||||
'div',
|
'class' => 'day-name'
|
||||||
array(
|
),
|
||||||
'class' => 'day-date'
|
$day->format('l')),
|
||||||
),
|
phutil_tag(
|
||||||
$day->format('m/d/y'))
|
'div',
|
||||||
));
|
array(
|
||||||
|
'class' => 'day-date'
|
||||||
|
),
|
||||||
|
$day->format('m/d/y'))));
|
||||||
|
}
|
||||||
|
|
||||||
$week_day_number = $day->format('w');
|
$week_day_number = $day->format('w');
|
||||||
|
|
||||||
|
@ -251,81 +260,73 @@ final class ConpherenceWidgetController extends
|
||||||
|
|
||||||
if ($status->getDateFrom() < $epoch_end &&
|
if ($status->getDateFrom() < $epoch_end &&
|
||||||
$status->getDateTo() > $epoch_start) {
|
$status->getDateTo() > $epoch_start) {
|
||||||
if (!$first_status_of_the_day) {
|
$statuses_of_the_day[$status->getUserPHID()] = $status;
|
||||||
|
if ($should_draw_list) {
|
||||||
|
$top_border = '';
|
||||||
|
if (!$first_status_of_the_day) {
|
||||||
|
$top_border = ' top-border';
|
||||||
|
}
|
||||||
|
$timespan = $status->getDateTo() - $status->getDateFrom();
|
||||||
|
if ($timespan > $one_day) {
|
||||||
|
$time_str = 'm/d';
|
||||||
|
} else {
|
||||||
|
$time_str = 'h:i A';
|
||||||
|
}
|
||||||
|
$epoch_range =
|
||||||
|
phabricator_format_local_time(
|
||||||
|
$status->getDateFrom(),
|
||||||
|
$user,
|
||||||
|
$time_str) .
|
||||||
|
' - ' .
|
||||||
|
phabricator_format_local_time(
|
||||||
|
$status->getDateTo(),
|
||||||
|
$user,
|
||||||
|
$time_str);
|
||||||
|
|
||||||
|
$secondary_info = pht('%s, %s',
|
||||||
|
$handles[$status->getUserPHID()]->getName(), $epoch_range);
|
||||||
|
|
||||||
$content[] = phutil_tag(
|
$content[] = phutil_tag(
|
||||||
'div',
|
'div',
|
||||||
array(
|
array(
|
||||||
'class' => 'divider'
|
'class' => 'user-status '.$status->getTextStatus().$top_border,
|
||||||
),
|
),
|
||||||
'');
|
array(
|
||||||
|
phutil_tag(
|
||||||
|
'div',
|
||||||
|
array(
|
||||||
|
'class' => 'icon',
|
||||||
|
),
|
||||||
|
''),
|
||||||
|
phutil_tag(
|
||||||
|
'div',
|
||||||
|
array(
|
||||||
|
'class' => 'description'
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
$status->getTerseSummary($user),
|
||||||
|
phutil_tag(
|
||||||
|
'div',
|
||||||
|
array(
|
||||||
|
'class' => 'participant'
|
||||||
|
),
|
||||||
|
$secondary_info)))));
|
||||||
}
|
}
|
||||||
$statuses_of_the_day[$status->getUserPHID()] = $status;
|
|
||||||
$timespan = $status->getDateTo() - $status->getDateFrom();
|
|
||||||
if ($timespan > $one_day) {
|
|
||||||
$time_str = 'm/d';
|
|
||||||
} else {
|
|
||||||
$time_str = 'h:i A';
|
|
||||||
}
|
|
||||||
$epoch_range = phabricator_format_local_time(
|
|
||||||
$status->getDateFrom(),
|
|
||||||
$user,
|
|
||||||
$time_str) . ' - ' . phabricator_format_local_time(
|
|
||||||
$status->getDateTo(),
|
|
||||||
$user,
|
|
||||||
$time_str);
|
|
||||||
|
|
||||||
$secondary_info = pht('%s, %s',
|
|
||||||
$handles[$status->getUserPHID()]->getName(), $epoch_range);
|
|
||||||
|
|
||||||
$content[] = phutil_tag(
|
|
||||||
'div',
|
|
||||||
array(
|
|
||||||
'class' => 'pm user-status '.$status->getTextStatus(),
|
|
||||||
),
|
|
||||||
array(
|
|
||||||
phutil_tag(
|
|
||||||
'div',
|
|
||||||
array(
|
|
||||||
'class' => 'icon',
|
|
||||||
),
|
|
||||||
''),
|
|
||||||
phutil_tag(
|
|
||||||
'div',
|
|
||||||
array(
|
|
||||||
'class' => 'description'
|
|
||||||
),
|
|
||||||
array(
|
|
||||||
$status->getTerseSummary($user),
|
|
||||||
phutil_tag(
|
|
||||||
'div',
|
|
||||||
array(
|
|
||||||
'class' => 'participant'
|
|
||||||
),
|
|
||||||
$secondary_info)))
|
|
||||||
));
|
|
||||||
$first_status_of_the_day = false;
|
$first_status_of_the_day = false;
|
||||||
} else {
|
|
||||||
$content[] = phutil_tag(
|
|
||||||
'div',
|
|
||||||
array('class' => 'no-events pmt pml'),
|
|
||||||
pht('No Events Scheduled.'));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// we didn't get a status on this day so add a spacer
|
// we didn't get a status on this day so add a spacer
|
||||||
if ($first_status_of_the_day) {
|
if ($first_status_of_the_day && $should_draw_list) {
|
||||||
$content[] = phutil_tag(
|
$content[] = phutil_tag(
|
||||||
'div',
|
'div',
|
||||||
array(
|
array('class' => 'no-events pm'),
|
||||||
'class' => 'spacer'
|
pht('No Events Scheduled.'));
|
||||||
),
|
|
||||||
'');
|
|
||||||
}
|
}
|
||||||
if ($week_day_number > 0 && $week_day_number < 6) {
|
if ($is_today || ($calendar_columns && $calendar_columns < 3)) {
|
||||||
if ($week_day_number == $today->format('w')) {
|
$active_class = '';
|
||||||
|
if ($day->format('Ymd') == $today->format('Ymd')) {
|
||||||
$active_class = '-active';
|
$active_class = '-active';
|
||||||
} else {
|
|
||||||
$active_class = '';
|
|
||||||
}
|
}
|
||||||
$inner_layout = array();
|
$inner_layout = array();
|
||||||
foreach ($participants as $phid => $participant) {
|
foreach ($participants as $phid => $participant) {
|
||||||
|
@ -366,7 +367,8 @@ final class ConpherenceWidgetController extends
|
||||||
),
|
),
|
||||||
$day->format('j')),
|
$day->format('j')),
|
||||||
$inner_layout
|
$inner_layout
|
||||||
)));
|
)));
|
||||||
|
$calendar_columns++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -381,15 +383,14 @@ final class ConpherenceWidgetController extends
|
||||||
$user = $this->getRequest()->getUser();
|
$user = $this->getRequest()->getUser();
|
||||||
$timezone = new DateTimeZone($user->getTimezoneIdentifier());
|
$timezone = new DateTimeZone($user->getTimezoneIdentifier());
|
||||||
|
|
||||||
$today = id(new DateTime('today', $timezone));
|
$first_day = new DateTime('last sunday', $timezone);
|
||||||
$timestamps = array();
|
$timestamps = array();
|
||||||
for ($day = 0; $day < 3; $day++) {
|
for ($day = 0; $day < 8; $day++) {
|
||||||
$timestamp = clone $today;
|
$timestamp = clone $first_day;
|
||||||
$timestamps[] = $timestamp->modify(sprintf('+%d days', $day));
|
$timestamps[] = $timestamp->modify(sprintf('+%d days', $day));
|
||||||
}
|
}
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
'today' => $today,
|
'today' => new DateTime('today', $timezone),
|
||||||
'epoch_stamps' => $timestamps
|
'epoch_stamps' => $timestamps
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -399,4 +400,4 @@ final class ConpherenceWidgetController extends
|
||||||
return $this->getApplicationURI('update/'.$conpherence->getID().'/');
|
return $this->getApplicationURI('update/'.$conpherence->getID().'/');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -217,13 +217,15 @@ final class ConpherenceThreadQuery
|
||||||
$file_phids = array_mergev($file_phids);
|
$file_phids = array_mergev($file_phids);
|
||||||
|
|
||||||
// statuses of everyone currently in the conpherence
|
// statuses of everyone currently in the conpherence
|
||||||
// for a rolling three day window
|
// we show sunday -> saturday in a list *AND* a window
|
||||||
|
// of today -> +2 days. If its saturday we need
|
||||||
|
// +2 days.
|
||||||
$start_epoch = phabricator_format_local_time(
|
$start_epoch = phabricator_format_local_time(
|
||||||
strtotime('today', strtotime('tomorrow')),
|
strtotime('last sunday', strtotime('tomorrow')),
|
||||||
$this->getViewer(),
|
$this->getViewer(),
|
||||||
'U');
|
'U');
|
||||||
$end_epoch = phabricator_format_local_time(
|
$end_epoch = phabricator_format_local_time(
|
||||||
strtotime('+3 days', strtotime('tomorrow')),
|
strtotime('last sunday +8 days', strtotime('tomorrow')),
|
||||||
$this->getViewer(),
|
$this->getViewer(),
|
||||||
'U');
|
'U');
|
||||||
$statuses = id(new PhabricatorUserStatus())
|
$statuses = id(new PhabricatorUserStatus())
|
||||||
|
|
|
@ -140,8 +140,12 @@
|
||||||
.conpherence-widget-pane #widgets-calendar .aphront-multi-column-view {
|
.conpherence-widget-pane #widgets-calendar .aphront-multi-column-view {
|
||||||
width: 240px;
|
width: 240px;
|
||||||
}
|
}
|
||||||
.device .conpherence-widget-pane #widgets-calendar .aphront-multi-column-view {
|
.device-phone .conpherence-widget-pane #widgets-calendar
|
||||||
margin: 2px 0px 0px 0px;
|
.aphront-multi-column-view {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.device-tablet .conpherence-widget-pane #widgets-calendar
|
||||||
|
.aphront-multi-column-view {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
.conpherence-widget-pane #widgets-calendar .aphront-multi-column-view
|
.conpherence-widget-pane #widgets-calendar .aphront-multi-column-view
|
||||||
|
@ -150,6 +154,11 @@
|
||||||
border-right: 1px solid #bfbfbf;
|
border-right: 1px solid #bfbfbf;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
.device-phone .conpherence-widget-pane #widgets-calendar
|
||||||
|
.aphront-multi-column-view .aphront-multi-column-column {
|
||||||
|
border-right: 0;
|
||||||
|
}
|
||||||
|
|
||||||
.device-phone .conpherence-widget-pane #widgets-calendar
|
.device-phone .conpherence-widget-pane #widgets-calendar
|
||||||
.aphront-multi-column-fluid .aphront-multi-column-5-up
|
.aphront-multi-column-fluid .aphront-multi-column-5-up
|
||||||
.aphront-multi-column-column-outer {
|
.aphront-multi-column-column-outer {
|
||||||
|
@ -248,22 +257,13 @@
|
||||||
font-size: 11px;
|
font-size: 11px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.conpherence-widget-pane #widgets-calendar .divider {
|
.conpherence-widget-pane #widgets-calendar .top-border {
|
||||||
float: left;
|
border-top: 1px solid #E7E7E7;
|
||||||
clear: both;
|
}
|
||||||
width: 220px;
|
|
||||||
|
.conpherence-widget-pane #widgets-calendar .user-status {
|
||||||
|
padding: 10px 0px 10px 0px;
|
||||||
margin: 0px 0px 0px 10px;
|
margin: 0px 0px 0px 10px;
|
||||||
border: 1px dashed #bfbfbf;
|
|
||||||
}
|
|
||||||
.conpherence-widget-pane #widgets-calendar .divider {
|
|
||||||
width: 96%;
|
|
||||||
margin: 0px 0px 0px 2%;
|
|
||||||
}
|
|
||||||
.conpherence-widget-pane #widgets-calendar .spacer {
|
|
||||||
float: left;
|
|
||||||
clear: both;
|
|
||||||
height: 10px;
|
|
||||||
width: 100%;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.conpherence-widget-pane #widgets-calendar .user-status .icon {
|
.conpherence-widget-pane #widgets-calendar .user-status .icon {
|
||||||
|
@ -284,9 +284,8 @@
|
||||||
|
|
||||||
.conpherence-widget-pane #widgets-calendar .user-status .description {
|
.conpherence-widget-pane #widgets-calendar .user-status .description {
|
||||||
width: 195px;
|
width: 195px;
|
||||||
float: left;
|
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
margin: 0 0 10px 10px;
|
margin: 0 0 0px 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.conpherence-widget-pane #widgets-calendar .user-status .participant {
|
.conpherence-widget-pane #widgets-calendar .user-status .participant {
|
||||||
|
|
Loading…
Reference in a new issue