Skip to content

Conversation

@JoeyStk
Copy link
Contributor

@JoeyStk JoeyStk commented Dec 12, 2025

Short description

This PR renames the verbose name of contact opening hours to office hours, adds office hours to contact cards and transforms the opening hours of contacts to contain the timezones (as we already do it for POIs).

Proposed changes

  • Rename office hours (but only verbose name)
  • Add office hours to contact card
  • Transform opening hours

Side effects

  • Since this PR still has a few open questions, I decided not to remove the beta permissions yet :) We have to do this is a later commit or PR.

Faithfulness to issue description and design

There are some deviations from the design:

  1. Toggling office hours in the contact card is not possible (bcs contact cards are non-editable objects). They will be shown as open by default (in the editor only)
  2. Showing the current day on the contact card is also not possible (at least as long as we don't have shortcodes)

These have been communicated to and approved by PO

How to test

TBD

Resolved issues

Fixes: #4006
Fixes: #3659 (partly)


Pull Request Review Guidelines

@PeterNerlich PeterNerlich marked this pull request as ready for review December 22, 2025 13:49
@MizukiTemma
Copy link
Member

@hauf-toni @osmers @laravoelk

Faithfulness to issue description and design

There are no intended deviations from the issue and design.

There are some deviations from the design:
a. opening office hours in the contact card is not possible (bcs contact cards are non-editable objects)
b. showing the current day on the contact card is also not possible (at least as long as we don't have shortcodes)
I will talk to the POs about it.

Were those discussed already?

@PeterNerlich
Copy link
Contributor

Were those discussed already?

Thanks for bringing attention to it. They were. I just updated the description to reflect what we discussed and agreed on

Copy link
Member

@MizukiTemma MizukiTemma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good 😸 Thank you!

One small suggestion:

In the design, there is some space on the left of the opening hours.
If the rows with each week day start in the same indent with "Show office hours" (behind the icon), it brings a better view.

Image Image

@MizukiTemma MizukiTemma self-assigned this Jan 22, 2026
@dkehne
Copy link
Collaborator

dkehne commented Jan 22, 2026

Review Summary

What it does

  1. Renames "opening hours" to "office hours" for contacts (verbose_name + migration)
  2. Adds office hours display to contact cards using <details> HTML element
  3. Transforms contact opening hours in API to include timezone (like POIs)
  4. Creates as_weekday_iterator template filter for displaying hours

Key observations

  1. Good refactoring in API - Extracting transform_opening_hours function avoids code duplication between POI and contact opening hours

  2. Template filter is clean - as_weekday_iterator nicely pairs weekday names with opening hours data

  3. Clever TinyMCE solution - Opens <details> elements in editor (for visibility) but closes them in saved content

  4. Type hint issue (minor) - In opening_hour.py:

    related_class: type[POIForm] | type[Contact]

    But poi_context_mixin.py passes POI (not POIForm). Should be type[POI] | type[Contact].

  5. Migration is correct - Only changes verbose_name, no data migration needed

  6. German translations complete - "Sprechzeiten" used for office hours

  7. Design deviations documented - PR clearly notes what couldn't be implemented and that PO approved

Minor issue: Type hint for related_class parameter should be type[POI] | type[Contact] not type[POIForm] | type[Contact]. Non-blocking.

Overall well-implemented feature. ✅

Copy link
Collaborator

@dkehne dkehne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed - looks good! ✅

@PeterNerlich
Copy link
Contributor

PeterNerlich commented Jan 23, 2026

One small suggestion

Thanks! I reworked the way we render the details so that it makes more sense – now even if we have more lines and items for any particular detail they are guarantueed* to display nicely.

Please have a quick final look, it is exchanging paragraphs as containers for list items and some css to make everything fit together properly. It might be a bit cryptic, I can also add some comments to explain my intention, but we don't usually do that so it felt weird randomly starting 😅

* meaning after I was done playing around, the solution felt actually elegant

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rename opening hours to office hours for a contact Show office hours in contact cards and remove beta permission

6 participants