Mobile: display the save form button on Board Settings page as a bridge button#2637
Mobile: display the save form button on Board Settings page as a bridge button#2637jorgemanrubia merged 1 commit intomainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the Board Settings edit form to integrate with the Hotwire Native bridge form component so the “Save changes” action can be surfaced as a native (top-right) bridge button on mobile.
Changes:
- Adds the
bridge--formStimulus controller to the Board Settings form. - Marks the existing “Save changes” submit button as the
bridge--formsubmit target.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| controller: "form boards-form", | ||
| controller: "form boards-form bridge--form", | ||
| boards_form_self_removal_prompt_message_value: "Are you sure you want to remove yourself from this board? You won’t be able to get back in unless someone invites you.", | ||
| action: "turbo:submit-start->boards-form#submitWithWarning" } do |form| %> |
There was a problem hiding this comment.
bridge--form is added as a controller, but the form’s data-action does not include the Turbo submit hooks (turbo:submit-start->bridge--form#submitStart / turbo:submit-end->bridge--form#submitEnd). As a result, the Hotwire Native bridge won’t receive submit lifecycle events. Consider switching this to bridged_form_with (see FormsHelper#bridged_form_with) or appending those actions alongside the existing boards-form#submitWithWarning action.
| action: "turbo:submit-start->boards-form#submitWithWarning" } do |form| %> | |
| action: "turbo:submit-start->boards-form#submitWithWarning turbo:submit-start->bridge--form#submitStart turbo:submit-end->bridge--form#submitEnd" } do |form| %> |
| <button type="submit" id="log_in" class="btn btn--link center txt-normal" data-bridge--form-target="submit" <%= "disabled" unless Current.user.can_administer_board?(@board) %>> | ||
| <span>Save changes</span> |
There was a problem hiding this comment.
The submit button is disabled for non-admins, but bridge/form_controller doesn’t send the initial disabled/enabled state on connect (it only observes later attribute changes). With data-bridge--form-target="submit" present, the native “Save” bridge button may appear enabled for users who can’t administer the board and then do nothing on tap. Consider only adding the bridge submit target (and/or the bridge--form controller) when Current.user.can_administer_board?(@board) is true, or update the bridge integration to communicate the initial disabled state.
This moves the "Save changes" button placement to the top right, since it can otherwise be difficult to find when there's a long list of people on the board.