Collapse the lesson-type filter behind a Show Only button #120

Merged
thatguygriff merged 2 commits from feature/lesson-type-filter-collapsed into main 2026-07-28 16:20:25 +00:00
Owner

Closes #119. Follow-up to #118.

What changed

Collapsed filter (original scope of this PR)

  • The List/Week toggle and a new Show Only button share one us-calendar-controls row; the lesson-type list is collapsed by default and appears between that row and the calendar when opened.
  • It stays open across re-renders, and collapsing it keeps the filter applied — the button keeps the toggle's active styling, carries the count (Show Only (2)), and sets aria-expanded/aria-controls.
  • The Lesson type heading now sits on its own line above the checkboxes instead of sharing a line with the first one.

Booking block embedding options (added on request)

  • Lesson type (lessonTypeId / [us_booking lesson_type="…"]) pins the block to a single private-lesson type: only the times bookable as it are listed, and it is the only type bookable there — auto-selected on the registration form. A pinned type that is no longer offered says so plainly rather than showing an empty calendar. With one type left, the filter control hides itself.
  • Show the lesson-type filter (showTypeFilter / show_filter="no") drops the Show Only control entirely for studios that do not want it.
  • Sections (displayMode / show="booking|upcoming") embeds one half of the page — booking calendar, or the student's upcoming lessons — so the two can live on different pages. The script skips the work belonging to a missing half: an upcoming-only embed makes no availability or offerings request, a booking-only embed makes no GET /bookings. An unrecognised value renders the whole page, so a typo cannot silently hide half of it.
  • The editor preview follows Sections, and the lesson-type select mirrors the group-class one (fetched from ?kind=private_lesson, "Unavailable lesson type #N" for a withdrawn type).

Options travel as data attributes on #us-booking-app (data-lesson-type, data-type-filter) or as containers the template omits. Docs updated in lesson-booking.md and editor-blocks.md; CHANGELOG entry under 1.2.2. No schema change, so no version bump.

Tests

  • composer test — 639 tests, 1833 assertions, OK (new coverage: BookingPageTest for every attribute and display mode, BlockPreviewTest for the two single-section previews, BlockRegistrarTest for the attribute schema)
  • composer lint — no errors
  • composer cs — clean

Front-end behaviour re-checked with the throwaway stub-DOM harness (not committed), now booting booking.js in a fresh context per scenario: default embed, pinned type, withdrawn pinned type, filter disabled, upcoming-only and booking-only embeds — 28/28 pass.

Closes #119. Follow-up to #118. ## What changed **Collapsed filter (original scope of this PR)** - The List/Week toggle and a new **Show Only** button share one `us-calendar-controls` row; the lesson-type list is collapsed by default and appears between that row and the calendar when opened. - It stays open across re-renders, and collapsing it keeps the filter applied — the button keeps the toggle's active styling, carries the count (`Show Only (2)`), and sets `aria-expanded`/`aria-controls`. - The **Lesson type** heading now sits on its own line above the checkboxes instead of sharing a line with the first one. **Booking block embedding options (added on request)** - **Lesson type** (`lessonTypeId` / `[us_booking lesson_type="…"]`) pins the block to a single private-lesson type: only the times bookable as it are listed, and it is the only type bookable there — auto-selected on the registration form. A pinned type that is no longer offered says so plainly rather than showing an empty calendar. With one type left, the filter control hides itself. - **Show the lesson-type filter** (`showTypeFilter` / `show_filter="no"`) drops the **Show Only** control entirely for studios that do not want it. - **Sections** (`displayMode` / `show="booking|upcoming"`) embeds one half of the page — booking calendar, or the student's upcoming lessons — so the two can live on different pages. The script skips the work belonging to a missing half: an upcoming-only embed makes no availability or offerings request, a booking-only embed makes no `GET /bookings`. An unrecognised value renders the whole page, so a typo cannot silently hide half of it. - The editor preview follows **Sections**, and the lesson-type select mirrors the group-class one (fetched from `?kind=private_lesson`, "Unavailable lesson type #N" for a withdrawn type). Options travel as data attributes on `#us-booking-app` (`data-lesson-type`, `data-type-filter`) or as containers the template omits. Docs updated in `lesson-booking.md` and `editor-blocks.md`; CHANGELOG entry under 1.2.2. No schema change, so no version bump. ## Tests - `composer test` — 639 tests, 1833 assertions, OK (new coverage: `BookingPageTest` for every attribute and display mode, `BlockPreviewTest` for the two single-section previews, `BlockRegistrarTest` for the attribute schema) - `composer lint` — no errors - `composer cs` — clean Front-end behaviour re-checked with the throwaway stub-DOM harness (not committed), now booting `booking.js` in a fresh context per scenario: default embed, pinned type, withdrawn pinned type, filter disabled, upcoming-only and booking-only embeds — 28/28 pass.
thatguygriff added 1 commit 2026-07-28 15:47:43 +00:00
Collapse the lesson-type filter behind a Show Only button
CI / Tests (PHP 8.1) (pull_request) Successful in 54s
CI / Tests (PHP 8.2) (pull_request) Successful in 54s
CI / No Debug Code (pull_request) Successful in 2s
CI / Coding Standards (pull_request) Successful in 2m52s
CI / PHPStan (pull_request) Successful in 3m3s
CI / Tests (PHP 8.3) (pull_request) Successful in 2m41s
CI / Build Plugin Zip (pull_request) Skipped
9d11cc3b01
The filter took a row of the booking calendar before a student had asked for
it. The view toggle and a new "Show Only" button now share one control row,
and the lesson-type list is revealed between that row and the calendar.

The list stays open across re-renders once revealed, and collapsing it leaves
the filter applied — the button keeps its active styling and carries the
number of ticked types, so a collapsed filter is never invisible.

Closes #119

Co-Authored-By: Claude Opus 5 <[email protected]>
thatguygriff added 1 commit 2026-07-28 16:16:25 +00:00
Add per-embed lesson-type and section options to the booking block
CI / Tests (PHP 8.1) (pull_request) Successful in 47s
CI / Tests (PHP 8.2) (pull_request) Successful in 54s
CI / No Debug Code (pull_request) Successful in 2s
CI / PHPStan (pull_request) Successful in 2m51s
CI / Coding Standards (pull_request) Successful in 2m56s
CI / Tests (PHP 8.3) (pull_request) Successful in 2m42s
CI / Build Plugin Zip (pull_request) Skipped
264d9cba01
Three sidebar options on the Lesson Booking block, all mirrored as shortcode
attributes and carried to the front end as data attributes on
#us-booking-app (or as omitted containers):

- Lesson type (lessonTypeId / lesson_type) pins the calendar to a single
  private-lesson type: only the times bookable as it are listed, and it is
  the only type bookable there, auto-selected on the registration form. A
  pinned type that is no longer offered says so instead of showing an empty
  calendar.
- Show the lesson-type filter (showTypeFilter / show_filter) drops the
  "Show Only" control for studios that do not want it.
- Sections (displayMode / show) embeds one half of the page — the booking
  calendar or the student's upcoming lessons — so the two can live on
  different pages. The script skips the work belonging to a missing half:
  no availability or catalog request for an upcoming-only embed, no
  bookings request for a booking-only one. An unrecognised value renders
  the whole page. The editor preview follows the same setting.

Also fixes the expanded filter's first lesson type sharing a line with the
"Lesson type" heading — the choices now sit in their own row beneath it.

Co-Authored-By: Claude Opus 5 <[email protected]>
thatguygriff merged commit 3a25c397c5 into main 2026-07-28 16:20:25 +00:00
thatguygriff deleted branch feature/lesson-type-filter-collapsed 2026-07-28 16:20:25 +00:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Unsupervised/unsupervised-scheduler#120