From 0f084b1bb0ad7fcff1a9a53f99cee529fb59f28f Mon Sep 17 00:00:00 2001 From: Santiago Rodriguez <46354312+santiagorodriguez96@users.noreply.github.com> Date: Fri, 27 Jun 2025 21:00:15 -0300 Subject: [PATCH] feat(planner): improve space in add subject section --- .../controllers/subject_selector_controller.js | 6 +++++- app/views/subjects/_planned_subjects_list.html.erb | 9 ++------- spec/system/planned_subjects_spec.rb | 4 ++-- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/app/javascript/controllers/subject_selector_controller.js b/app/javascript/controllers/subject_selector_controller.js index c55ad34aa..ac04ffc4a 100644 --- a/app/javascript/controllers/subject_selector_controller.js +++ b/app/javascript/controllers/subject_selector_controller.js @@ -14,7 +14,7 @@ export default class extends Controller { noChoicesText: "No hay materias disponibles", shouldSort: false, classNames: { - containerOuter: ["choices", "!m-0", "!h-10"], + containerOuter: ["choices", "!m-0", "!h-10", "flex-grow-1"], containerInner: [ "choices__inner", "!min-h-10", @@ -23,7 +23,11 @@ export default class extends Controller { "!items-center", "!bg-white", "!rounded-md", + "!px-4", + "!py-3", + "!border-none", ], + listSingle: ["choices__list", "choices__list--single", "!p-0"], }, }); } diff --git a/app/views/subjects/_planned_subjects_list.html.erb b/app/views/subjects/_planned_subjects_list.html.erb index edb4757f6..9eb4b4184 100644 --- a/app/views/subjects/_planned_subjects_list.html.erb +++ b/app/views/subjects/_planned_subjects_list.html.erb @@ -42,11 +42,8 @@ url: subject_plans_path, method: :post, data: { turbo: true, controller: "subject-selector" }, - class: 'flex items-center gap-3 px-4 py-3 hover:bg-gray-100 border-t border-gray-100' + class: 'flex items-center border-t border-gray-100 text-sm/6' ) do |form| %> - - Planificar: - <%= form.select( :subject_id, grouped_options_for_select( @@ -58,9 +55,7 @@ { data: { subject_selector_target: "select", action: "subject-selector#onChange" }, class: "invisible absolute" } ) %> <%= form.hidden_field :semester, value: semester %> - <%= form.button type: :submit, class: "cursor-pointer py-2 ps-3 material-icons text-gray-400 disabled:opacity-50 disabled:cursor-not-allowed", disabled: true, data: { subject_selector_target: "submitButton" } do %> - add_circle_outline - <% end %> + <%= render ButtonComponent.new(form: form, label: "Añadir") %> <% end %> <% end %> diff --git a/spec/system/planned_subjects_spec.rb b/spec/system/planned_subjects_spec.rb index a6a03cb16..4a707d6dc 100644 --- a/spec/system/planned_subjects_spec.rb +++ b/spec/system/planned_subjects_spec.rb @@ -62,7 +62,7 @@ within_semester_section("Primer semestre") do within_add_subject_section do select_from_choices('GAL 1 - 1030') - find("button[type='submit']").click + click_button "Añadir" end assert_available_subject "GAL 1" @@ -80,7 +80,7 @@ within_semester_section("Segundo semestre") do within_add_subject_section do select_from_choices('GAL 2 - 1031') - find("button[type='submit']").click + click_button "Añadir" end assert_blocked_subject "GAL 2"