mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-10 08:52:39 +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,14 +204,23 @@ final class ConpherenceWidgetController extends
|
|||
$today = $timestamps['today'];
|
||||
$epoch_stamps = $timestamps['epoch_stamps'];
|
||||
$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
|
||||
if ($day->format('w') == $today->format('w')) {
|
||||
if ($day->format('Ymd') == $today->format('Ymd')) {
|
||||
$active_class = 'today';
|
||||
$is_today = true;
|
||||
} else {
|
||||
$active_class = '';
|
||||
$is_today = false;
|
||||
}
|
||||
|
||||
$should_draw_list = $list_days < 7;
|
||||
$list_days++;
|
||||
|
||||
if ($should_draw_list) {
|
||||
$content[] = phutil_tag(
|
||||
'div',
|
||||
array(
|
||||
|
@ -229,8 +238,8 @@ final class ConpherenceWidgetController extends
|
|||
array(
|
||||
'class' => 'day-date'
|
||||
),
|
||||
$day->format('m/d/y'))
|
||||
));
|
||||
$day->format('m/d/y'))));
|
||||
}
|
||||
|
||||
$week_day_number = $day->format('w');
|
||||
|
||||
|
@ -251,25 +260,25 @@ final class ConpherenceWidgetController extends
|
|||
|
||||
if ($status->getDateFrom() < $epoch_end &&
|
||||
$status->getDateTo() > $epoch_start) {
|
||||
if (!$first_status_of_the_day) {
|
||||
$content[] = phutil_tag(
|
||||
'div',
|
||||
array(
|
||||
'class' => 'divider'
|
||||
),
|
||||
'');
|
||||
}
|
||||
$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(
|
||||
$epoch_range =
|
||||
phabricator_format_local_time(
|
||||
$status->getDateFrom(),
|
||||
$user,
|
||||
$time_str) . ' - ' . phabricator_format_local_time(
|
||||
$time_str) .
|
||||
' - ' .
|
||||
phabricator_format_local_time(
|
||||
$status->getDateTo(),
|
||||
$user,
|
||||
$time_str);
|
||||
|
@ -280,7 +289,7 @@ final class ConpherenceWidgetController extends
|
|||
$content[] = phutil_tag(
|
||||
'div',
|
||||
array(
|
||||
'class' => 'pm user-status '.$status->getTextStatus(),
|
||||
'class' => 'user-status '.$status->getTextStatus().$top_border,
|
||||
),
|
||||
array(
|
||||
phutil_tag(
|
||||
|
@ -301,31 +310,23 @@ final class ConpherenceWidgetController extends
|
|||
array(
|
||||
'class' => 'participant'
|
||||
),
|
||||
$secondary_info)))
|
||||
));
|
||||
$secondary_info)))));
|
||||
}
|
||||
$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
|
||||
if ($first_status_of_the_day) {
|
||||
if ($first_status_of_the_day && $should_draw_list) {
|
||||
$content[] = phutil_tag(
|
||||
'div',
|
||||
array(
|
||||
'class' => 'spacer'
|
||||
),
|
||||
'');
|
||||
array('class' => 'no-events pm'),
|
||||
pht('No Events Scheduled.'));
|
||||
}
|
||||
if ($week_day_number > 0 && $week_day_number < 6) {
|
||||
if ($week_day_number == $today->format('w')) {
|
||||
$active_class = '-active';
|
||||
} else {
|
||||
if ($is_today || ($calendar_columns && $calendar_columns < 3)) {
|
||||
$active_class = '';
|
||||
if ($day->format('Ymd') == $today->format('Ymd')) {
|
||||
$active_class = '-active';
|
||||
}
|
||||
$inner_layout = array();
|
||||
foreach ($participants as $phid => $participant) {
|
||||
|
@ -367,6 +368,7 @@ final class ConpherenceWidgetController extends
|
|||
$day->format('j')),
|
||||
$inner_layout
|
||||
)));
|
||||
$calendar_columns++;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -381,15 +383,14 @@ final class ConpherenceWidgetController extends
|
|||
$user = $this->getRequest()->getUser();
|
||||
$timezone = new DateTimeZone($user->getTimezoneIdentifier());
|
||||
|
||||
$today = id(new DateTime('today', $timezone));
|
||||
$first_day = new DateTime('last sunday', $timezone);
|
||||
$timestamps = array();
|
||||
for ($day = 0; $day < 3; $day++) {
|
||||
$timestamp = clone $today;
|
||||
for ($day = 0; $day < 8; $day++) {
|
||||
$timestamp = clone $first_day;
|
||||
$timestamps[] = $timestamp->modify(sprintf('+%d days', $day));
|
||||
}
|
||||
|
||||
return array(
|
||||
'today' => $today,
|
||||
'today' => new DateTime('today', $timezone),
|
||||
'epoch_stamps' => $timestamps
|
||||
);
|
||||
}
|
||||
|
@ -399,4 +400,4 @@ final class ConpherenceWidgetController extends
|
|||
return $this->getApplicationURI('update/'.$conpherence->getID().'/');
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -217,13 +217,15 @@ final class ConpherenceThreadQuery
|
|||
$file_phids = array_mergev($file_phids);
|
||||
|
||||
// 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(
|
||||
strtotime('today', strtotime('tomorrow')),
|
||||
strtotime('last sunday', strtotime('tomorrow')),
|
||||
$this->getViewer(),
|
||||
'U');
|
||||
$end_epoch = phabricator_format_local_time(
|
||||
strtotime('+3 days', strtotime('tomorrow')),
|
||||
strtotime('last sunday +8 days', strtotime('tomorrow')),
|
||||
$this->getViewer(),
|
||||
'U');
|
||||
$statuses = id(new PhabricatorUserStatus())
|
||||
|
|
|
@ -140,8 +140,12 @@
|
|||
.conpherence-widget-pane #widgets-calendar .aphront-multi-column-view {
|
||||
width: 240px;
|
||||
}
|
||||
.device .conpherence-widget-pane #widgets-calendar .aphront-multi-column-view {
|
||||
margin: 2px 0px 0px 0px;
|
||||
.device-phone .conpherence-widget-pane #widgets-calendar
|
||||
.aphront-multi-column-view {
|
||||
display: none;
|
||||
}
|
||||
.device-tablet .conpherence-widget-pane #widgets-calendar
|
||||
.aphront-multi-column-view {
|
||||
width: 100%;
|
||||
}
|
||||
.conpherence-widget-pane #widgets-calendar .aphront-multi-column-view
|
||||
|
@ -150,6 +154,11 @@
|
|||
border-right: 1px solid #bfbfbf;
|
||||
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
|
||||
.aphront-multi-column-fluid .aphront-multi-column-5-up
|
||||
.aphront-multi-column-column-outer {
|
||||
|
@ -248,22 +257,13 @@
|
|||
font-size: 11px;
|
||||
}
|
||||
|
||||
.conpherence-widget-pane #widgets-calendar .divider {
|
||||
float: left;
|
||||
clear: both;
|
||||
width: 220px;
|
||||
.conpherence-widget-pane #widgets-calendar .top-border {
|
||||
border-top: 1px solid #E7E7E7;
|
||||
}
|
||||
|
||||
.conpherence-widget-pane #widgets-calendar .user-status {
|
||||
padding: 10px 0px 10px 0px;
|
||||
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 {
|
||||
|
@ -284,9 +284,8 @@
|
|||
|
||||
.conpherence-widget-pane #widgets-calendar .user-status .description {
|
||||
width: 195px;
|
||||
float: left;
|
||||
text-overflow: ellipsis;
|
||||
margin: 0 0 10px 10px;
|
||||
margin: 0 0 0px 20px;
|
||||
}
|
||||
|
||||
.conpherence-widget-pane #widgets-calendar .user-status .participant {
|
||||
|
|
Loading…
Reference in a new issue