@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

+115 -113
+92 -91
src/applications/conpherence/controller/ConpherenceWidgetController.php
··· 204 204 $today = $timestamps['today']; 205 205 $epoch_stamps = $timestamps['epoch_stamps']; 206 206 $one_day = 24 * 60 * 60; 207 - foreach ($epoch_stamps as $time => $day) { 207 + $is_today = false; 208 + $calendar_columns = 0; 209 + $list_days = 0; 210 + foreach ($epoch_stamps as $day) { 208 211 // build a header for the new day 209 - if ($day->format('w') == $today->format('w')) { 210 - $active_class = 'today'; 212 + if ($day->format('Ymd') == $today->format('Ymd')) { 213 + $active_class = 'today'; 214 + $is_today = true; 211 215 } else { 212 - $active_class = ''; 216 + $active_class = ''; 217 + $is_today = false; 213 218 } 214 219 215 - $content[] = phutil_tag( 216 - 'div', 217 - array( 218 - 'class' => 'day-header '.$active_class 219 - ), 220 - array( 221 - phutil_tag( 222 - 'div', 223 - array( 224 - 'class' => 'day-name' 225 - ), 226 - $day->format('l')), 227 - phutil_tag( 228 - 'div', 229 - array( 230 - 'class' => 'day-date' 231 - ), 232 - $day->format('m/d/y')) 233 - )); 220 + $should_draw_list = $list_days < 7; 221 + $list_days++; 222 + 223 + if ($should_draw_list) { 224 + $content[] = phutil_tag( 225 + 'div', 226 + array( 227 + 'class' => 'day-header '.$active_class 228 + ), 229 + array( 230 + phutil_tag( 231 + 'div', 232 + array( 233 + 'class' => 'day-name' 234 + ), 235 + $day->format('l')), 236 + phutil_tag( 237 + 'div', 238 + array( 239 + 'class' => 'day-date' 240 + ), 241 + $day->format('m/d/y')))); 242 + } 234 243 235 244 $week_day_number = $day->format('w'); 236 245 ··· 251 260 252 261 if ($status->getDateFrom() < $epoch_end && 253 262 $status->getDateTo() > $epoch_start) { 254 - if (!$first_status_of_the_day) { 263 + $statuses_of_the_day[$status->getUserPHID()] = $status; 264 + if ($should_draw_list) { 265 + $top_border = ''; 266 + if (!$first_status_of_the_day) { 267 + $top_border = ' top-border'; 268 + } 269 + $timespan = $status->getDateTo() - $status->getDateFrom(); 270 + if ($timespan > $one_day) { 271 + $time_str = 'm/d'; 272 + } else { 273 + $time_str = 'h:i A'; 274 + } 275 + $epoch_range = 276 + phabricator_format_local_time( 277 + $status->getDateFrom(), 278 + $user, 279 + $time_str) . 280 + ' - ' . 281 + phabricator_format_local_time( 282 + $status->getDateTo(), 283 + $user, 284 + $time_str); 285 + 286 + $secondary_info = pht('%s, %s', 287 + $handles[$status->getUserPHID()]->getName(), $epoch_range); 288 + 255 289 $content[] = phutil_tag( 256 290 'div', 257 291 array( 258 - 'class' => 'divider' 292 + 'class' => 'user-status '.$status->getTextStatus().$top_border, 259 293 ), 260 - ''); 294 + array( 295 + phutil_tag( 296 + 'div', 297 + array( 298 + 'class' => 'icon', 299 + ), 300 + ''), 301 + phutil_tag( 302 + 'div', 303 + array( 304 + 'class' => 'description' 305 + ), 306 + array( 307 + $status->getTerseSummary($user), 308 + phutil_tag( 309 + 'div', 310 + array( 311 + 'class' => 'participant' 312 + ), 313 + $secondary_info))))); 261 314 } 262 - $statuses_of_the_day[$status->getUserPHID()] = $status; 263 - $timespan = $status->getDateTo() - $status->getDateFrom(); 264 - if ($timespan > $one_day) { 265 - $time_str = 'm/d'; 266 - } else { 267 - $time_str = 'h:i A'; 268 - } 269 - $epoch_range = phabricator_format_local_time( 270 - $status->getDateFrom(), 271 - $user, 272 - $time_str) . ' - ' . phabricator_format_local_time( 273 - $status->getDateTo(), 274 - $user, 275 - $time_str); 276 - 277 - $secondary_info = pht('%s, %s', 278 - $handles[$status->getUserPHID()]->getName(), $epoch_range); 279 - 280 - $content[] = phutil_tag( 281 - 'div', 282 - array( 283 - 'class' => 'pm user-status '.$status->getTextStatus(), 284 - ), 285 - array( 286 - phutil_tag( 287 - 'div', 288 - array( 289 - 'class' => 'icon', 290 - ), 291 - ''), 292 - phutil_tag( 293 - 'div', 294 - array( 295 - 'class' => 'description' 296 - ), 297 - array( 298 - $status->getTerseSummary($user), 299 - phutil_tag( 300 - 'div', 301 - array( 302 - 'class' => 'participant' 303 - ), 304 - $secondary_info))) 305 - )); 306 315 $first_status_of_the_day = false; 307 - } else { 308 - $content[] = phutil_tag( 309 - 'div', 310 - array('class' => 'no-events pmt pml'), 311 - pht('No Events Scheduled.')); 312 316 } 313 317 } 314 318 315 319 // we didn't get a status on this day so add a spacer 316 - if ($first_status_of_the_day) { 320 + if ($first_status_of_the_day && $should_draw_list) { 317 321 $content[] = phutil_tag( 318 322 'div', 319 - array( 320 - 'class' => 'spacer' 321 - ), 322 - ''); 323 + array('class' => 'no-events pm'), 324 + pht('No Events Scheduled.')); 323 325 } 324 - if ($week_day_number > 0 && $week_day_number < 6) { 325 - if ($week_day_number == $today->format('w')) { 326 + if ($is_today || ($calendar_columns && $calendar_columns < 3)) { 327 + $active_class = ''; 328 + if ($day->format('Ymd') == $today->format('Ymd')) { 326 329 $active_class = '-active'; 327 - } else { 328 - $active_class = ''; 329 330 } 330 331 $inner_layout = array(); 331 332 foreach ($participants as $phid => $participant) { ··· 366 367 ), 367 368 $day->format('j')), 368 369 $inner_layout 369 - ))); 370 + ))); 371 + $calendar_columns++; 370 372 } 371 373 } 372 374 ··· 381 383 $user = $this->getRequest()->getUser(); 382 384 $timezone = new DateTimeZone($user->getTimezoneIdentifier()); 383 385 384 - $today = id(new DateTime('today', $timezone)); 386 + $first_day = new DateTime('last sunday', $timezone); 385 387 $timestamps = array(); 386 - for ($day = 0; $day < 3; $day++) { 387 - $timestamp = clone $today; 388 + for ($day = 0; $day < 8; $day++) { 389 + $timestamp = clone $first_day; 388 390 $timestamps[] = $timestamp->modify(sprintf('+%d days', $day)); 389 391 } 390 - 391 392 return array( 392 - 'today' => $today, 393 + 'today' => new DateTime('today', $timezone), 393 394 'epoch_stamps' => $timestamps 394 395 ); 395 396 } ··· 399 400 return $this->getApplicationURI('update/'.$conpherence->getID().'/'); 400 401 } 401 402 402 - } 403 + }
+5 -3
src/applications/conpherence/query/ConpherenceThreadQuery.php
··· 217 217 $file_phids = array_mergev($file_phids); 218 218 219 219 // statuses of everyone currently in the conpherence 220 - // for a rolling three day window 220 + // we show sunday -> saturday in a list *AND* a window 221 + // of today -> +2 days. If its saturday we need 222 + // +2 days. 221 223 $start_epoch = phabricator_format_local_time( 222 - strtotime('today', strtotime('tomorrow')), 224 + strtotime('last sunday', strtotime('tomorrow')), 223 225 $this->getViewer(), 224 226 'U'); 225 227 $end_epoch = phabricator_format_local_time( 226 - strtotime('+3 days', strtotime('tomorrow')), 228 + strtotime('last sunday +8 days', strtotime('tomorrow')), 227 229 $this->getViewer(), 228 230 'U'); 229 231 $statuses = id(new PhabricatorUserStatus())
+18 -19
webroot/rsrc/css/application/conpherence/widget-pane.css
··· 140 140 .conpherence-widget-pane #widgets-calendar .aphront-multi-column-view { 141 141 width: 240px; 142 142 } 143 - .device .conpherence-widget-pane #widgets-calendar .aphront-multi-column-view { 144 - margin: 2px 0px 0px 0px; 143 + .device-phone .conpherence-widget-pane #widgets-calendar 144 + .aphront-multi-column-view { 145 + display: none; 146 + } 147 + .device-tablet .conpherence-widget-pane #widgets-calendar 148 + .aphront-multi-column-view { 145 149 width: 100%; 146 150 } 147 151 .conpherence-widget-pane #widgets-calendar .aphront-multi-column-view ··· 150 154 border-right: 1px solid #bfbfbf; 151 155 text-align: center; 152 156 } 157 + .device-phone .conpherence-widget-pane #widgets-calendar 158 + .aphront-multi-column-view .aphront-multi-column-column { 159 + border-right: 0; 160 + } 161 + 153 162 .device-phone .conpherence-widget-pane #widgets-calendar 154 163 .aphront-multi-column-fluid .aphront-multi-column-5-up 155 164 .aphront-multi-column-column-outer { ··· 248 257 font-size: 11px; 249 258 } 250 259 251 - .conpherence-widget-pane #widgets-calendar .divider { 252 - float: left; 253 - clear: both; 254 - width: 220px; 260 + .conpherence-widget-pane #widgets-calendar .top-border { 261 + border-top: 1px solid #E7E7E7; 262 + } 263 + 264 + .conpherence-widget-pane #widgets-calendar .user-status { 265 + padding: 10px 0px 10px 0px; 255 266 margin: 0px 0px 0px 10px; 256 - border: 1px dashed #bfbfbf; 257 - } 258 - .conpherence-widget-pane #widgets-calendar .divider { 259 - width: 96%; 260 - margin: 0px 0px 0px 2%; 261 - } 262 - .conpherence-widget-pane #widgets-calendar .spacer { 263 - float: left; 264 - clear: both; 265 - height: 10px; 266 - width: 100%; 267 267 } 268 268 269 269 .conpherence-widget-pane #widgets-calendar .user-status .icon { ··· 284 284 285 285 .conpherence-widget-pane #widgets-calendar .user-status .description { 286 286 width: 195px; 287 - float: left; 288 287 text-overflow: ellipsis; 289 - margin: 0 0 10px 10px; 288 + margin: 0 0 0px 20px; 290 289 } 291 290 292 291 .conpherence-widget-pane #widgets-calendar .user-status .participant {