Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
When porting office_hours from D7 to D8, the javascript is broken.
It contains:
- an Add link: 'add time slot' --> Fixed in #18
- a Copy link: 'same as above' --> Fixed in #21
- a Delete link: 'Remove' --> OK
A volunteer is needed to fix this code. See also the open issues regarding the widget.
Comments
Comment #2
gunwald CreditAttribution: gunwald commentedI could help with the JS part, but would you describe what exactly the JS is supposed to do so far.
Comment #3
johnvThanks for your offer.
1. The main JS-feature is:
If you define an OH field with 3 slots per day, you will now see 2 lines with the word 'and' in the first column and entry boxes in the remaining columns.
The required result (as you can see in the D7-version of OH):
- first line (of a day) is OK and is shown completely ( since it is the first line)
- 2nd line should show ONLY a JS-link with the text 'add more hours' (Since it initially contains no value, but the previous line is shown/has content.) Clicking on this exposes the entry boxes and the title 'and'.
- 3rd line should be hidden, since a) is has no initial content, and b) the line above has no initial content.
2. The D7 value contains some extra links like 'clear line' . You will find remains of it in the code.
see #2044465: Add links 'clear' and 'apply to all' to Widget to improve usability
The result should be the same as the D7 version. part one is the most important, and is a release blocker. Part 2 is a nice extra, and is not working entirely properly in D7 either.
Comment #4
gunwald CreditAttribution: gunwald commentedThank you for making that clear.
I looked into the code, apparently someone had already ported it to the Drupal 8 version of OH, but the CSS classes to decide which slot should be hidden (is empty) are missing. So, first thing to make JS working again, is to change the widget by adding a hidden 'Add more' link.
The second would be, to add a class to all empty slots (slots with empty fields) to make it easier to the JS part to decide which slot has to be hidden. In my opinion this should be done within a form state hook (at least in Drupal 7).
Where can I check out the current version?
git clone --branch 8.x-1.x git://git.drupal.org/project/office_hours.git
Seems to give me an old one.
Comment #5
johnvSounds like a solid analysis. The git 8nstructions on the project page are correct, so:
git clone --branch 8.x-1.x https://git.drupal.org/project/office_hours.git
cd office_hours
I did the update to D8. Perhaps the css classes are missing because the theme functions are very different with D7.
Comment #6
captcodemonkey CreditAttribution: captcodemonkey as a volunteer commentedWhat's the current status here? I'm willing to help resolve the JS blockers, but D.O isn't the best at showing them.
Comment #7
johnvThere hasn't been any progress. The status and tasks in #3 still reflect the current situation.
Any help would be amazing.
Comment #8
johnvComment #9
johnvComment #10
johnvComment #12
johnvAbove commit adds a skeleton for adding the js file. It is not activated yet, since that makes the widget hidden.
Comment #16
johnvImprovements from #2872213: Add 'same as above' to widget to improve usability are also incorporated.
Comment #17
johnvComment #19
johnvComment #22
johnvThis is now fixed. :-)