Fix 'Copy previous day' link for Exception Days

Created on 7 January 2023, almost 2 years ago
Updated 31 May 2023, over 1 year ago

Problem/Motivation

The link 'Copy previous day' does not work for exception days.

Steps to reproduce

When you use the widget 'Office Hours (week) with exceptions', there is a part for normal weekdays, and below a part to 'add exception days'.
The link 'copy previous day' works fine for normal weekdays, but it does not do anything for Exception days.

Proposed resolution

option 1: hide the link
option 2: when a second exception day is created, the 'copy previous day' link should copy the values from the exception day right before the current one. The date may stay empty, or be filled with some sensible value (when still empty - keep the same when user has already provided data.)

🐛 Bug report
Status

Fixed

Version

1.8

Component

User interface

Created by

🇳🇱Netherlands johnv

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇪🇸Spain akalam

    I can confirm this issue with the other widgets

  • 🇪🇸Spain akalam

    This is only failing when the field is configured to use select form elements, when using input html5 elements the copy feature works fine.
    After looking closer, I think this commit might introduce the issue https://git.drupalcode.org/project/office_hours/-/commit/93ff3da18e18d40...

    There's a big refactor on the office_hours.js file on the dev release. I didn't test it, but it could be already fixed on the dev release. Can somebody test it there?

  • 🇨🇦Canada ebremner

    I can confirm that this is happening with HTML 5 time as well and with the 1.8 and dev versions. My suggestion is not to have the copy previous day for exceptions since it does not really make sense for this case. They will just add exceptions not use other days. Will try and create a patch to remove the link.

  • 🇳🇱Netherlands johnv

    I can imagine a use case where you want to enter a list exceptions, that are (almost) identical. The link would then copy the hours, leaving the date alone. YOu will maintain the dates separately.

  • 🇨🇦Canada ebremner

    Ok well the Copy link is not working at all for exception hours, can we remove it for now until that is fixed. I will provide a patch now to make this happen.

    • johnv committed 4eed0328 on 8.x-1.x
      Issue #3331785: Fix 'Copy previous day' link for Exception Days
      
  • Status changed to Fixed over 1 year ago
  • 🇳🇱Netherlands johnv

    Indeed, better no functionality the broken functionality.
    The problem occurs both in Exception List widget as in basic list widget (to be toggled with the Widget)

    However, I decided to spend too much time fixing this. Having learned a lot about (debugging) javascript, though.
    Thanks anyway.

  • 🇨🇦Canada ebremner

    Hi John,
    The Copy link is still not working for me in exception hours, it just sits there.

    Thanks,
    Eric

  • Status changed to Needs work over 1 year ago
  • Status changed to Fixed over 1 year ago
  • 🇳🇱Netherlands johnv

    I tested on Edge, Chrome, Firefox.
    The only problem I encountered, is that the JS was not refreshed in Firefox.
    You need to refresh the edit page using [CTRL+F5], not just [F5], to explicitely reload the JS.
    Not sure why this is happening.

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

  • Status changed to Fixed over 1 year ago
  • 🇨🇦Canada ebremner

    Yes it works as expected now with dev and a refreshed browser.

Production build 0.71.5 2024