select-your-own-seat

Expand History Expand History
Collapse History Collapse History

Progressively enhance price filtering

This commit progressively enhances the existing server-side price filtering to be possible from the client-side, without disrupting the current map state.

Embed data-price onto each <g> element to represent that Section record’s price.

When the corresponding <input type="radio"> element is checked, route the input event to the seats#filterSeats action. The seats#filterSeats action will use the checked radio button’s price to determine which Sections should be highlighted, and which Sections should have their opacity decreased.

The values for the opacity attribute that indicate inclusion and exclusion are encoded (as data-included-opacity and data-excluded-opacity) into the <g> elements that represent the Sections.

Additionally, wrap the filter <form> element’s <input type="submit"> element in a <noscript> element.

When JavaScript is enabled in the client’s web browser, the new Stimulus-powered event routing will apply the filter changes in real-time, without the need to submit the <form>.

However, when JavaScript is disabled, the <input type="submit"> will render, and the <form> will filter the map by making HTTP requests to the server.

Selecting a filter with the mouse

price filtering with mouse

Selecting a filter with focus

price filtering with focus