Download & Extend

Roll-up hours / grouping of days in formatter

Project:Office Hours
Version:7.x-1.x-dev
Component:User interface
Category:feature request
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

Is it possible to "roll-up" the hours if a the hours are the same? For example, if the hours are fixed Monday - Friday 8am - 5pm. Instead of print a row for each day, can it display "Mon - Fri. 8:00am - 5:00pm"?

Comments

#1

It's possible as a separate widget, not as the current widget. I do consider it, but there's lack of time on my behalf. If anyone submits a patch, I'll be happy to commit.

#2

Version:6.x-1.0» 6.x-1.x-dev

Attached patch:

version:
latest 6.x-1.x HEAD as of this post
files affected:
office_hours.module, office_hours.theme.inc
what it does:
provides a 'grouped' formatter for display days grouped by start and end hours.
unknown:
  • result on multiple time ranges for single day
  • time ranges that span over midnight - my initial thought is that it won't work
tested:
Limited testing has been done. Results from my simple test case:
formatter: default
Sunday:   Closed
Monday:  9:00 AM - 7:30 PM
Tuesday:  9:00 AM - 7:30 PM
Wednesday:  9:00 AM - 7:30 PM
Thursday:  9:00 AM - 7:30 PM
Friday:  9:00 AM - 7:30 PM
Saturday:  8:00 AM - 5:30 PM

formatter: grouped
Sun:   Closed
Mon - Fri:  9:00 AM - 7:30 PM
Sat:  8:00 AM - 5:30 PM

AttachmentSize
office_hours-769412--rollup-hours.patch 5.4 KB

#3

re-roll: moved the ordered weekdays to the end so output is correct for any 'first day of the week'

AttachmentSize
office_hours-769412--rollup-hours-1.patch 5.44 KB

#4

this re-roll removes dependency of group building on the 'first day of week'. Instead it indexes the groups on day name and then uses the properly ordered weekdays to output the groups.

AttachmentSize
office_hours-769412--rollup-hours-2.patch 5.63 KB

#5

Status:active» fixed

Cool. works as expected.
committed.

#6

@recrit This is exactly what I was hoping for. Thanks!

#7

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

#8

Title:Roll-up hours» Roll-up hours / grouping of days in formatter
Version:6.x-1.x-dev» 7.x-1.x-dev
Category:support request» feature request
Status:closed (fixed)» patch (to be ported)

This feature is not yet in D7.

#9

Status:patch (to be ported)» needs review

I've ported recrit's patch to D7. I've added some additional CSS classes to help with applying different CSS to grouped hours.

AttachmentSize
office-hours-769412-rollup-9.patch 6.86 KB

#10

Status:needs review» fixed

patch is heavily reworked and committed in f54fbb5

AttachmentSize
office_hours_769412_10_grouped_days_formatter.patch 9.72 KB

#11

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

nobody click here