diff --git a/app/assets/stylesheets/application/support-form.sass b/app/assets/stylesheets/application/support-form.sass index 9f69376b..2f74ba8d 100644 --- a/app/assets/stylesheets/application/support-form.sass +++ b/app/assets/stylesheets/application/support-form.sass @@ -89,9 +89,9 @@ align-items: center gap: 1em - label - display: flex - align-items: center - gap: .25em - font-size: .85em - font-style: italic + .go-to-next + display: flex + align-items: center + gap: .25em + font-size: .85em + font-style: italic diff --git a/app/helpers/support_form_helper.rb b/app/helpers/support_form_helper.rb index 6eb10a73..067f0e4c 100644 --- a/app/helpers/support_form_helper.rb +++ b/app/helpers/support_form_helper.rb @@ -1,7 +1,8 @@ module SupportFormHelper class SupportFormBuilder < ActionView::Helpers::FormBuilder attr_reader :template - delegate :capture, :content_tag, :render, to: :template, private: true + delegate :capture, :check_box_tag, :content_tag, :params, :render, + to: :template, private: true def errors render partial: "application/support_form/errors", locals: {form: self} @@ -38,6 +39,14 @@ module SupportFormHelper def actions(&block) content_tag(:section, class: "actions", &block) end + + def go_to_next_field(**options, &block) + content_tag(:label, class: "go-to-next", **options, &block) + end + + def go_to_next_check_box(value) + check_box_tag "next", value, checked: params[:next] == value + end end def support_form_with(**options, &block) diff --git a/app/views/alt_styles/edit.html.haml b/app/views/alt_styles/edit.html.haml index f1a8a09c..d6ee1835 100644 --- a/app/views/alt_styles/edit.html.haml +++ b/app/views/alt_styles/edit.html.haml @@ -28,9 +28,8 @@ = f.actions do = f.submit "Save changes" - %label{title: "If checked, takes you to the next unlabeled pet style, if any. Useful for labeling in bulk!"} - = check_box_tag "next", "unlabeled-style", - checked: params[:next] == "unlabeled-style" + = f.go_to_next_field title: "If checked, takes you to the next unlabeled pet style, if any. Useful for labeling in bulk!" do + = f.go_to_next_check_box "unlabeled-style" Then: Go to unlabeled style - content_for :stylesheets do