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.
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]>
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]>
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Closes #119. Follow-up to #118.
What changed
Collapsed filter (original scope of this PR)
us-calendar-controlsrow; the lesson-type list is collapsed by default and appears between that row and the calendar when opened.Show Only (2)), and setsaria-expanded/aria-controls.Booking block embedding options (added on request)
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.showTypeFilter/show_filter="no") drops the Show Only control entirely for studios that do not want it.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 noGET /bookings. An unrecognised value renders the whole page, so a typo cannot silently hide half of it.?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 inlesson-booking.mdandeditor-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:BookingPageTestfor every attribute and display mode,BlockPreviewTestfor the two single-section previews,BlockRegistrarTestfor the attribute schema)composer lint— no errorscomposer cs— cleanFront-end behaviour re-checked with the throwaway stub-DOM harness (not committed), now booting
booking.jsin a fresh context per scenario: default embed, pinned type, withdrawn pinned type, filter disabled, upcoming-only and booking-only embeds — 28/28 pass.