From 946a6326ac9c440846c9c30977b6cb68bfc79da3 Mon Sep 17 00:00:00 2001 From: Emi Matchu Date: Fri, 27 Sep 2024 22:34:52 -0700 Subject: [PATCH] Use radio buttons for poses in Rainbow Pool form, instead of dropdown Just a bit easier to find what you want! especially with the grid layout --- app/assets/stylesheets/pet_states/edit.sass | 25 +++++++++++++++++++++ app/helpers/pet_states_helper.rb | 14 +++++++++--- app/views/pet_states/edit.html.haml | 16 +++++++++---- 3 files changed, 48 insertions(+), 7 deletions(-) create mode 100644 app/assets/stylesheets/pet_states/edit.sass diff --git a/app/assets/stylesheets/pet_states/edit.sass b/app/assets/stylesheets/pet_states/edit.sass new file mode 100644 index 00000000..c1d019fa --- /dev/null +++ b/app/assets/stylesheets/pet_states/edit.sass @@ -0,0 +1,25 @@ +@import "../partials/clean/constants" + +outfit-viewer + margin: 0 auto + +.pose-options + list-style-type: none + display: grid + grid-template-columns: 1fr 1fr 1fr + gap: .25em + + label + display: flex + align-items: center + gap: .5em + padding: .5em 1em + border: 1px solid $soft-border-color + border-radius: 1em + + input + margin: 0 + + &:has(:checked) + background: $module-bg-color + border-color: $module-border-color diff --git a/app/helpers/pet_states_helper.rb b/app/helpers/pet_states_helper.rb index 67ea71b6..86356599 100644 --- a/app/helpers/pet_states_helper.rb +++ b/app/helpers/pet_states_helper.rb @@ -20,9 +20,17 @@ module PetStatesHelper end end - POSE_OPTIONS = %w(UNKNOWN HAPPY_FEM HAPPY_MASC SAD_FEM SAD_MASC SICK_FEM - SICK_MASC UNCONVERTED) + POSE_OPTIONS = %w(HAPPY_FEM SAD_FEM SICK_FEM HAPPY_MASC SAD_MASC SICK_MASC + UNCONVERTED UNKNOWN) def pose_options - POSE_OPTIONS.map { |p| [pose_name(p), p] } + POSE_OPTIONS + end + + def useful_pet_state_path(...) + if support_staff? + edit_pet_type_pet_state_path(...) + else + pet_type_pet_state_path(...) + end end end diff --git a/app/views/pet_states/edit.html.haml b/app/views/pet_states/edit.html.haml index 17226f11..5dc9ccd5 100644 --- a/app/views/pet_states/edit.html.haml +++ b/app/views/pet_states/edit.html.haml @@ -27,16 +27,24 @@ - @pet_state.errors.each do |error| %li= error.full_message %dl - %dt= f.label :pose - %dd= f.select :pose, pose_options - %dt= f.label :glitched, "Glitched?" - %dd= f.select :glitched, [["✅ Not marked as Glitched", false], + %dt Pose + %dd + %ul.pose-options + - pose_options.each do |pose| + %li + %label + = f.radio_button :pose, pose + = pose_name pose + %dt Glitched? + %dd + = f.select :glitched, [["✅ Not marked as Glitched", false], ["👾 Yes, it's bad news bonko'd", true]] = f.submit "Save" - content_for :stylesheets do = stylesheet_link_tag "application/breadcrumbs" = stylesheet_link_tag "application/outfit-viewer" + = page_stylesheet_link_tag "pet_states/edit" - content_for :javascripts do = javascript_include_tag "outfit-viewer"