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/subject_plans/_semester_add_subject_form.html.erb b/app/views/subject_plans/_semester_add_subject_form.html.erb index ed7ca778e..7631b6347 100644 --- a/app/views/subject_plans/_semester_add_subject_form.html.erb +++ b/app/views/subject_plans/_semester_add_subject_form.html.erb @@ -4,11 +4,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( @@ -20,7 +17,5 @@ { 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 %> diff --git a/spec/system/planned_subjects_spec.rb b/spec/system/planned_subjects_spec.rb index 0f8a1d00b..5f89e8b6a 100644 --- a/spec/system/planned_subjects_spec.rb +++ b/spec/system/planned_subjects_spec.rb @@ -66,7 +66,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" @@ -88,7 +88,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"