The attached patch allows you to 'copy' the hours from the previous day to the selected day (e.g. Tuesday hours are same as Monday). Comes in handy when you have several blocks per day.

Note: the enhancement is only available in Office hours (week) widget.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

abrlam created an issue. See original summary.

abrlam’s picture

  • johnv committed bbc744d on 7.x-1.x authored by abrlam
    Issue #2872213 by abrlam: Add 'same as above' to widget to improve...
johnv’s picture

Version: 7.x-1.x-dev » 7.x-1.7
Status: Needs review » Needs work

Thanks, I committed your version. It has 1 flaw, however: the 2nd and later entries are not 'unhidden', after copying the values.

  • johnv committed 7c03a33 on 7.x-1.x
    Issue #2872213: reformat js wth coding standards
    

  • johnv committed abb9807 on 7.x-1.x
    Issue #2872213: fix error with first daty of week.
    
abrlam’s picture

Thank you johnv for the commit! I'll see what I can do with the 'unhidden' issue.

abrlam’s picture

The attached patch should fix the 'unhidden' issue in #4. If it looks good to you, could you commit it? Thanks.

abrlam’s picture

Status: Needs work » Needs review

  • johnv committed 8da23ea on 7.x-1.x authored by abrlam
    Issue #2872213 by abrlam: Add 'same as above' to widget to improve...
johnv’s picture

Status: Needs review » Fixed

Thanks, works perfectly.

  • johnv committed da587e3 on 8.x-1.x authored by abrlam
    Issue #2872213 by abrlam: Add 'same as above' to widget to improve...
carl@west-tec.com’s picture

The copy-button "Same as above" is hidden for day=0 --> Sunday.
The issue is that Sunday is shown as last day in the list; on the first row we see Monday.
Many shops have opening hours in the week, and different in the weekend. In these cases the logical way of working is :
1. Encode opening hours on Monday and copy them till friday
2. Encode opening hours on saterday and copy them for sunday.

in the patch you find altering code on the patch to make this happen.

johnv’s picture

Carl, your patch is not against the latest dev version. See commit #6, which already addresses (part of) your issue . Your usability problem can be addressed by setting the 'first day of week' to monday or Saturday in the Field Settings. (Formatter and Widget have separate settings in D7).

Perhaps it is a good idea to change the 'same as above' link to 'same as yesterday/previous day' and let day 1 copy from day 7.

  • johnv committed f0bceec on 8.x-1.x
    Issue #2872213: Let '\''same as above'\'' link copy from last day in...
johnv’s picture

Above commits implement the idea from carl #13.

  • johnv committed 77c1710 on 8.x-1.x
    Issue #2872213: Let '\''same as above'\'' link copy from last day in...

Status: Fixed » Closed (fixed)

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

myha’s picture

Added functionality to copy also comment values if comment field exists.

johnv’s picture

@myha, please add the patch to a new issue, or the patch will be lost. The issue is alrady closed for a long time.

SRizo’s picture

Case once we want to prepopulate first day(Monday/Sunday) for rest days with one click. Patch attached.

SRizo’s picture