From 81d8d5e9c9075e358e7ea7c699af24fbd7978c57 Mon Sep 17 00:00:00 2001 From: Thomas von Deyen Date: Wed, 27 Sep 2023 10:47:17 +0200 Subject: [PATCH] Use normal select tag for most select boxes These selects do not need the select2 features, because the list of options is small. --- .../alchemy/admin/ingredients/_file_fields.html.erb | 5 ++--- .../admin/ingredients/_picture_fields.html.erb | 8 +++----- .../alchemy/admin/ingredients/_video_fields.html.erb | 3 +-- app/views/alchemy/admin/languages/_form.html.erb | 3 +-- app/views/alchemy/admin/nodes/_form.html.erb | 3 +-- .../alchemy/admin/pages/_external_link.html.erb | 2 +- app/views/alchemy/admin/pages/_file_link.html.erb | 2 +- .../alchemy/admin/pages/_internal_link.html.erb | 2 +- app/views/alchemy/admin/pages/edit.html.erb | 4 ++-- .../admin/partials/_language_tree_select.html.erb | 5 +++-- .../alchemy/admin/partials/_site_select.html.erb | 3 +-- app/views/alchemy/admin/styleguide/index.html.erb | 12 +++++++++++- spec/features/admin/language_tree_feature_spec.rb | 2 +- 13 files changed, 29 insertions(+), 25 deletions(-) diff --git a/app/views/alchemy/admin/ingredients/_file_fields.html.erb b/app/views/alchemy/admin/ingredients/_file_fields.html.erb index ab4a675bfa..1e68c60122 100644 --- a/app/views/alchemy/admin/ingredients/_file_fields.html.erb +++ b/app/views/alchemy/admin/ingredients/_file_fields.html.erb @@ -5,8 +5,7 @@ <%- if css_classes.present? -%> <%= f.input :css_class, collection: css_classes, - include_blank: Alchemy.t('None'), - input_html: {class: 'alchemy_selectbox'} %> + include_blank: Alchemy.t('None') %> <%- else -%> <%= f.input :css_class, label: Alchemy.t(:position_in_text), @@ -14,5 +13,5 @@ [Alchemy.t(:above), "no_float"], [Alchemy.t(:left), "left"], [Alchemy.t(:right), "right"] - ], include_blank: Alchemy.t('Layout default'), input_html: {class: 'alchemy_selectbox'} %> + ], include_blank: Alchemy.t('Layout default') %> <%- end -%> diff --git a/app/views/alchemy/admin/ingredients/_picture_fields.html.erb b/app/views/alchemy/admin/ingredients/_picture_fields.html.erb index f0d826e4a1..500f8492c1 100644 --- a/app/views/alchemy/admin/ingredients/_picture_fields.html.erb +++ b/app/views/alchemy/admin/ingredients/_picture_fields.html.erb @@ -6,14 +6,12 @@ collection: [ [Alchemy.t('Layout default'), ""] ] + ingredient.settings[:sizes].to_a, - include_blank: false, - input_html: {class: 'alchemy_selectbox'} %> + include_blank: false %> <%- end -%> <%- if ingredient.settings[:css_classes].present? -%> <%= f.input :css_class, collection: ingredient.settings[:css_classes], - include_blank: Alchemy.t('None'), - input_html: {class: 'alchemy_selectbox'} %> + include_blank: Alchemy.t('None') %> <%- else -%> <%= f.input :css_class, label: Alchemy.t(:position_in_text), @@ -21,5 +19,5 @@ [Alchemy.t(:above), "no_float"], [Alchemy.t(:left), "left"], [Alchemy.t(:right), "right"] - ], include_blank: Alchemy.t("Layout default"), input_html: {class: 'alchemy_selectbox'} %> + ], include_blank: Alchemy.t("Layout default") %> <%- end -%> diff --git a/app/views/alchemy/admin/ingredients/_video_fields.html.erb b/app/views/alchemy/admin/ingredients/_video_fields.html.erb index dfa598c7b8..41c92177d6 100644 --- a/app/views/alchemy/admin/ingredients/_video_fields.html.erb +++ b/app/views/alchemy/admin/ingredients/_video_fields.html.erb @@ -5,5 +5,4 @@ <%= f.input :loop, as: :boolean %> <%= f.input :muted, as: :boolean %> <%= f.input :playsinline, as: :boolean %> -<%= f.input :preload, collection: %w(auto none metadata), - include_blank: false, input_html: {class: 'alchemy_selectbox'} %> +<%= f.input :preload, collection: %w(auto none metadata), include_blank: false %> diff --git a/app/views/alchemy/admin/languages/_form.html.erb b/app/views/alchemy/admin/languages/_form.html.erb index 8ee463d007..6c7455d960 100644 --- a/app/views/alchemy/admin/languages/_form.html.erb +++ b/app/views/alchemy/admin/languages/_form.html.erb @@ -8,8 +8,7 @@ <% if language.errors[:locale].present? || language.locale.present? %> <%= f.input :locale, collection: language.matching_locales.presence || ::I18n.available_locales, - selected: language.locale || language.language_code || ::I18n.default_locale.to_s, - input_html: {class: 'alchemy_selectbox'} %> + selected: language.locale || language.language_code || ::I18n.default_locale.to_s %> <% end %> <%= f.input :frontpage_name %> <%= f.input :page_layout, diff --git a/app/views/alchemy/admin/nodes/_form.html.erb b/app/views/alchemy/admin/nodes/_form.html.erb index 4175f37b2e..0408af18b6 100644 --- a/app/views/alchemy/admin/nodes/_form.html.erb +++ b/app/views/alchemy/admin/nodes/_form.html.erb @@ -2,8 +2,7 @@ <% if node.new_record? && node.root? %> <%= f.input :menu_type, collection: Alchemy::Language.current.available_menu_names.map { |n| [I18n.t(n, scope: [:alchemy, :menu_names]), n] }, - include_blank: false, - input_html: { class: 'alchemy_selectbox' } %> + include_blank: false %> <% else %> <% if node.root? %> <%= f.input :name %> diff --git a/app/views/alchemy/admin/pages/_external_link.html.erb b/app/views/alchemy/admin/pages/_external_link.html.erb index 004e074e57..496ee9c31e 100644 --- a/app/views/alchemy/admin/pages/_external_link.html.erb +++ b/app/views/alchemy/admin/pages/_external_link.html.erb @@ -23,7 +23,7 @@ <%= select_tag 'external_link_target', options_for_select(Alchemy::Page.link_target_options), - class: 'alchemy_selectbox link_target' %> + class: 'link_target' %>
<%= button_tag Alchemy.t(:apply), class: 'create-link button', data: { link_type: 'external' } %> diff --git a/app/views/alchemy/admin/pages/_file_link.html.erb b/app/views/alchemy/admin/pages/_file_link.html.erb index a86608aa26..d17a026e23 100644 --- a/app/views/alchemy/admin/pages/_file_link.html.erb +++ b/app/views/alchemy/admin/pages/_file_link.html.erb @@ -23,7 +23,7 @@ <%= select_tag 'file_link_target', options_for_select(Alchemy::Page.link_target_options), - class: 'alchemy_selectbox link_target' %> + class: 'link_target' %>
<%= button_tag Alchemy.t(:apply), class: 'create-link button', data: { link_type: 'file' } %> diff --git a/app/views/alchemy/admin/pages/_internal_link.html.erb b/app/views/alchemy/admin/pages/_internal_link.html.erb index 3f8f050d4f..651b61dfac 100644 --- a/app/views/alchemy/admin/pages/_internal_link.html.erb +++ b/app/views/alchemy/admin/pages/_internal_link.html.erb @@ -27,7 +27,7 @@ <%= select_tag 'internal_link_target', options_for_select(Alchemy::Page.link_target_options), - class: 'alchemy_selectbox link_target' %> + class: 'link_target' %>
<%= button_tag Alchemy.t(:apply), class: 'create-link button', data: { link_type: 'internal' } %> diff --git a/app/views/alchemy/admin/pages/edit.html.erb b/app/views/alchemy/admin/pages/edit.html.erb index 397a87b974..c13094a5af 100644 --- a/app/views/alchemy/admin/pages/edit.html.erb +++ b/app/views/alchemy/admin/pages/edit.html.erb @@ -106,7 +106,7 @@ <%= select_tag 'preview_size', preview_sizes_for_select, - class: 'alchemy_selectbox medium' %> + class: 'medium' %>
<% if @preview_urls.many? %> @@ -114,7 +114,7 @@ <%= select_tag 'preview_url', options_for_select(@preview_urls), - class: 'alchemy_selectbox large' %> + class: 'large' %> <% end %>
diff --git a/app/views/alchemy/admin/partials/_language_tree_select.html.erb b/app/views/alchemy/admin/partials/_language_tree_select.html.erb index 83e62f6160..78613546ca 100644 --- a/app/views/alchemy/admin/partials/_language_tree_select.html.erb +++ b/app/views/alchemy/admin/partials/_language_tree_select.html.erb @@ -8,11 +8,12 @@ languages.map { |l| [l.name, l.id] }, Alchemy::Language.current.id ), - class: 'alchemy_selectbox short', data: {'auto-submit' => true} ) %> <% end %> - +
<% end %> diff --git a/app/views/alchemy/admin/partials/_site_select.html.erb b/app/views/alchemy/admin/partials/_site_select.html.erb index 5b016217ca..d6ae45dd5f 100644 --- a/app/views/alchemy/admin/partials/_site_select.html.erb +++ b/app/views/alchemy/admin/partials/_site_select.html.erb @@ -1,8 +1,7 @@ <%- if multi_site? -%>
<%= select_tag 'change_site', - options_for_select(sites_for_select, Alchemy::Site.current.id), - class: 'alchemy_selectbox' %> + options_for_select(sites_for_select, Alchemy::Site.current.id) %>
diff --git a/app/views/alchemy/admin/styleguide/index.html.erb b/app/views/alchemy/admin/styleguide/index.html.erb index 53d3a69f13..5046c675ae 100644 --- a/app/views/alchemy/admin/styleguide/index.html.erb +++ b/app/views/alchemy/admin/styleguide/index.html.erb @@ -61,9 +61,19 @@ <% end %>
+
+ + +
+
- diff --git a/spec/features/admin/language_tree_feature_spec.rb b/spec/features/admin/language_tree_feature_spec.rb index c71a84796b..67a0e2c1e2 100644 --- a/spec/features/admin/language_tree_feature_spec.rb +++ b/spec/features/admin/language_tree_feature_spec.rb @@ -51,7 +51,7 @@ it "displays a form for creating language root with preselected page layout and front page name" do visit("/admin/pages") - select2 "Klingon", from: "Language tree" + select "Klingon", from: "Language tree" expect(page).to have_content("This language has no homepage yet") within("form#create_language_tree") do