1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-09-20 09:18:48 +02: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:
Bob Trahan 2013-05-31 14:58:15 -07:00
parent f4bd214f14
commit 11961cdebb
3 changed files with 115 additions and 113 deletions

View file

@ -204,14 +204,23 @@ 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;
} }
$should_draw_list = $list_days < 7;
$list_days++;
if ($should_draw_list) {
$content[] = phutil_tag( $content[] = phutil_tag(
'div', 'div',
array( array(
@ -229,8 +238,8 @@ final class ConpherenceWidgetController extends
array( array(
'class' => 'day-date' 'class' => 'day-date'
), ),
$day->format('m/d/y')) $day->format('m/d/y'))));
)); }
$week_day_number = $day->format('w'); $week_day_number = $day->format('w');
@ -251,25 +260,25 @@ 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) {
$content[] = phutil_tag(
'div',
array(
'class' => 'divider'
),
'');
}
$statuses_of_the_day[$status->getUserPHID()] = $status; $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(); $timespan = $status->getDateTo() - $status->getDateFrom();
if ($timespan > $one_day) { if ($timespan > $one_day) {
$time_str = 'm/d'; $time_str = 'm/d';
} else { } else {
$time_str = 'h:i A'; $time_str = 'h:i A';
} }
$epoch_range = phabricator_format_local_time( $epoch_range =
phabricator_format_local_time(
$status->getDateFrom(), $status->getDateFrom(),
$user, $user,
$time_str) . ' - ' . phabricator_format_local_time( $time_str) .
' - ' .
phabricator_format_local_time(
$status->getDateTo(), $status->getDateTo(),
$user, $user,
$time_str); $time_str);
@ -280,7 +289,7 @@ final class ConpherenceWidgetController extends
$content[] = phutil_tag( $content[] = phutil_tag(
'div', 'div',
array( array(
'class' => 'pm user-status '.$status->getTextStatus(), 'class' => 'user-status '.$status->getTextStatus().$top_border,
), ),
array( array(
phutil_tag( phutil_tag(
@ -301,31 +310,23 @@ final class ConpherenceWidgetController extends
array( array(
'class' => 'participant' 'class' => 'participant'
), ),
$secondary_info))) $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 = '-active';
} else {
$active_class = ''; $active_class = '';
if ($day->format('Ymd') == $today->format('Ymd')) {
$active_class = '-active';
} }
$inner_layout = array(); $inner_layout = array();
foreach ($participants as $phid => $participant) { foreach ($participants as $phid => $participant) {
@ -367,6 +368,7 @@ 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
); );
} }

View file

@ -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())

View file

@ -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 {