Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

Apply .select2-clear class to instances of Select2 where include_blank: true

Matthew Kennedy9e9229b47a72
diff --git a/backend/app/views/spree/admin/customer_returns/new.html.erb b/backend/app/views/spree/admin/customer_returns/new.html.erb
index efeef9ee72..8f5ebffed7 100644
--- a/backend/app/views/spree/admin/customer_returns/new.html.erb
+++ b/backend/app/views/spree/admin/customer_returns/new.html.erb
@@ -24,7 +24,7 @@
<%= f.field_container :stock_location, class: ['form-group'] do %>
<%= f.label :stock_location, Spree.t(:stock_location) %> <span class="required">*</span>
- <%= f.select :stock_location_id, Spree::StockLocation.order_default.active.to_a.collect{|l|[l.name.humanize, l.id]}, {include_blank: true}, {class: 'select2', "data-placeholder" => Spree.t(:select_a_stock_location)} %>
+ <%= f.select :stock_location_id, Spree::StockLocation.order_default.active.to_a.collect{|l|[l.name.humanize, l.id]}, {include_blank: true}, {class: 'select2-clear', "data-placeholder" => Spree.t(:select_a_stock_location)} %>
<%= f.error_message_on :stock_location %>
<% end %>
</div>
diff --git a/backend/app/views/spree/admin/orders/index.html.erb b/backend/app/views/spree/admin/orders/index.html.erb
index 94ecc879af..3bef4201cb 100644
--- a/backend/app/views/spree/admin/orders/index.html.erb
+++ b/backend/app/views/spree/admin/orders/index.html.erb
@@ -67,21 +67,21 @@
<%= f.select :state_eq,
Spree::Order.state_machines[:state].states.map {|s| [Spree.t("order_state.#{s.name}"), s.value]},
{ include_blank: true },
- class: 'select2 js-filterable' %>
+ class: 'select2-clear js-filterable' %>
</div>
</div>
<div class="col-12 col-lg-4">
<div class="form-group">
<%= label_tag :q_payment_state_eq, Spree.t(:payment_state) %>
- <%= f.select :payment_state_eq, Spree::Order::PAYMENT_STATES.map {|s| [Spree.t("payment_states.#{s}"), s]}, { include_blank: true }, class: 'select2 js-filterable' %>
+ <%= f.select :payment_state_eq, Spree::Order::PAYMENT_STATES.map {|s| [Spree.t("payment_states.#{s}"), s]}, { include_blank: true }, class: 'select2-clear js-filterable' %>
</div>
</div>
<div class="col-12 col-lg-4">
<div class="form-group">
<%= label_tag :q_shipment_state_eq, Spree.t(:shipment_state) %>
- <%= f.select :shipment_state_eq, Spree::Order::SHIPMENT_STATES.map {|s| [Spree.t("shipment_states.#{s}"), s]}, { include_blank: true }, class: 'select2 js-filterable' %>
+ <%= f.select :shipment_state_eq, Spree::Order::SHIPMENT_STATES.map {|s| [Spree.t("shipment_states.#{s}"), s]}, { include_blank: true }, class: 'select2-clear js-filterable' %>
</div>
</div>
@@ -124,21 +124,21 @@
<div class="col-12 col-lg-4">
<div class="form-group">
<%= label_tag :q_promotions_id_in, Spree.t(:promotion) %>
- <%= f.select :promotions_id_in, Spree::Promotion.applied.pluck(:name, :id), { include_blank: true }, class: 'select2 js-filterable' %>
+ <%= f.select :promotions_id_in, Spree::Promotion.applied.pluck(:name, :id), { include_blank: true }, class: 'select2-clear js-filterable' %>
</div>
</div>
<div class="col-12 col-lg-4">
<div class="form-group">
<%= label_tag :q_store_id_in, Spree.t(:store) %>
- <%= f.select :store_id_in, Spree::Store.order(:name).pluck(:name, :id), { include_blank: true }, class: 'select2 js-filterable' %>
+ <%= f.select :store_id_in, Spree::Store.order(:name).pluck(:name, :id), { include_blank: true }, class: 'select2-clear js-filterable' %>
</div>
</div>
<div class="col-12 col-lg-4">
<div class="form-group">
<%= label_tag :q_channel_eq, Spree.t(:channel) %>
- <%= f.select :channel_eq, Spree::Order.distinct.pluck(:channel), { include_blank: true }, class: 'select2 js-filterable' %>
+ <%= f.select :channel_eq, Spree::Order.distinct.pluck(:channel), { include_blank: true }, class: 'select2-clear js-filterable' %>
</div>
</div>
diff --git a/backend/app/views/spree/admin/products/new.html.erb b/backend/app/views/spree/admin/products/new.html.erb
index 6c49bc9918..fabbcba321 100644
--- a/backend/app/views/spree/admin/products/new.html.erb
+++ b/backend/app/views/spree/admin/products/new.html.erb
@@ -27,7 +27,7 @@
<div data-hook="new_product_prototype" class="col-12 col-md-4">
<%= f.field_container :prototype, class: ['form-group'] do %>
<%= f.label :prototype_id, Spree.t(:prototype) %>
- <%= f.collection_select :prototype_id, Spree::Prototype.all, :id, :name, { include_blank: true }, { class: 'select2 w-100' } %>
+ <%= f.collection_select :prototype_id, Spree::Prototype.all, :id, :name, { include_blank: true }, { class: 'select2-clear w-100' } %>
<% end %>
</div>
diff --git a/backend/app/views/spree/admin/refunds/new.html.erb b/backend/app/views/spree/admin/refunds/new.html.erb
index cdf0fd2132..035395581b 100644
--- a/backend/app/views/spree/admin/refunds/new.html.erb
+++ b/backend/app/views/spree/admin/refunds/new.html.erb
@@ -25,7 +25,7 @@
<% end %>
<%= f.field_container :reason, class: ['form-group'] do %>
<%= f.label :refund_reason_id, Spree.t(:reason) %>
- <%= f.collection_select(:refund_reason_id, refund_reasons, :id, :name, {include_blank: true}, {class: 'select2'}) %>
+ <%= f.collection_select(:refund_reason_id, refund_reasons, :id, :name, {include_blank: true}, {class: 'select2-clear'}) %>
<%= f.error_message_on :reason %>
<% end %>
</div>
diff --git a/backend/app/views/spree/admin/reimbursements/edit.html.erb b/backend/app/views/spree/admin/reimbursements/edit.html.erb
index 00f8611239..2c2779958b 100644
--- a/backend/app/views/spree/admin/reimbursements/edit.html.erb
+++ b/backend/app/views/spree/admin/reimbursements/edit.html.erb
@@ -51,7 +51,7 @@
<% if return_item.exchange_processed? %>
<%= return_item.exchange_variant.exchange_name %>
<% else %>
- <%= item_fields.collection_select :exchange_variant_id, return_item.eligible_exchange_variants, :id, :exchange_name, { include_blank: true }, { class: "select2 return-item-exchange-selection" } %>
+ <%= item_fields.collection_select :exchange_variant_id, return_item.eligible_exchange_variants, :id, :exchange_name, { include_blank: true }, { class: "select2-clear return-item-exchange-selection" } %>
<% end %>
</td>
</tr>
diff --git a/backend/app/views/spree/admin/return_authorizations/_form.html.erb b/backend/app/views/spree/admin/return_authorizations/_form.html.erb
index be9a2f25b4..38f1218e24 100644
--- a/backend/app/views/spree/admin/return_authorizations/_form.html.erb
+++ b/backend/app/views/spree/admin/return_authorizations/_form.html.erb
@@ -61,7 +61,7 @@
</td>
<td>
<% if editable %>
- <%= item_fields.select :preferred_reimbursement_type_id, @reimbursement_types.collect{|r|[r.name.humanize, r.id]}, {include_blank: true}, {class: 'select2'} %>
+ <%= item_fields.select :preferred_reimbursement_type_id, @reimbursement_types.collect{|r|[r.name.humanize, r.id]}, {include_blank: true}, {class: 'select2-clear'} %>
<% end %>
</td>
<td>
@@ -69,7 +69,7 @@
<% if return_item.exchange_processed? %>
<%= return_item.exchange_variant.exchange_name %>
<% else %>
- <%= item_fields.collection_select :exchange_variant_id, return_item.eligible_exchange_variants, :id, :exchange_name, { include_blank: true }, { class: "select2 return-item-exchange-selection" } %>
+ <%= item_fields.collection_select :exchange_variant_id, return_item.eligible_exchange_variants, :id, :exchange_name, { include_blank: true }, { class: "select2-clear return-item-exchange-selection" } %>
<% end %>
<% end %>
</td>
@@ -84,13 +84,13 @@
<%= f.field_container :stock_location, class: ['form-group'] do %>
<%= f.label :stock_location, Spree.t(:stock_location) %> <span class="required">*</span>
- <%= f.select :stock_location_id, Spree::StockLocation.order_default.active.to_a.collect{|l|[l.name, l.id]}, {include_blank: true}, {class: 'select2', "data-placeholder" => Spree.t(:select_a_stock_location)} %>
+ <%= f.select :stock_location_id, Spree::StockLocation.order_default.active.to_a.collect{|l|[l.name, l.id]}, {include_blank: true}, {class: 'select2-clear', "data-placeholder" => Spree.t(:select_a_stock_location)} %>
<%= f.error_message_on :stock_location %>
<% end %>
<%= f.field_container :reason, class: ['form-group'] do %>
<%= f.label :reason, Spree.t(:reason) %> <span class="required">*</span>
- <%= f.select :return_authorization_reason_id, @reasons.collect{|r|[r.name, r.id]}, {include_blank: true}, {class: 'select2', "data-placeholder" => Spree.t(:select_a_return_authorization_reason)} %>
+ <%= f.select :return_authorization_reason_id, @reasons.collect{|r|[r.name, r.id]}, {include_blank: true}, {class: 'select2-clear', "data-placeholder" => Spree.t(:select_a_return_authorization_reason)} %>
<%= f.error_message_on :reason %>
<% end %>
diff --git a/backend/app/views/spree/admin/return_index/return_authorizations.html.erb b/backend/app/views/spree/admin/return_index/return_authorizations.html.erb
index e1f4d9685e..43a7a5f2ef 100644
--- a/backend/app/views/spree/admin/return_index/return_authorizations.html.erb
+++ b/backend/app/views/spree/admin/return_index/return_authorizations.html.erb
@@ -33,7 +33,7 @@
<div class="col-12 col-lg-6">
<div class="form-group">
<%= label_tag :q_state_eq, Spree.t(:status) %>
- <%= f.select :state_eq, Spree::ReturnAuthorization.state_machines[:state].states.collect {|s| [Spree.t("return_authorization_states.#{s.name}"), s.value]}, {include_blank: true}, class: 'select2 js-filterable' %>
+ <%= f.select :state_eq, Spree::ReturnAuthorization.state_machines[:state].states.collect {|s| [Spree.t("return_authorization_states.#{s.name}"), s.value]}, {include_blank: true}, class: 'select2-clear js-filterable' %>
</div>
</div>
</div>
diff --git a/backend/app/views/spree/admin/shipping_methods/_form.html.erb b/backend/app/views/spree/admin/shipping_methods/_form.html.erb
index c9fe5adcbc..8e2e0bae22 100644
--- a/backend/app/views/spree/admin/shipping_methods/_form.html.erb
+++ b/backend/app/views/spree/admin/shipping_methods/_form.html.erb
@@ -11,7 +11,7 @@
<div data-hook="admin_shipping_method_form_display_field" class="col-12 col-lg-6">
<%= f.field_container :display_on, class: ['form-group'] do %>
<%= f.label :display_on, Spree.t(:display) %>
- <%= select(:shipping_method, :display_on, Spree::ShippingMethod::DISPLAY.collect { |display| [Spree.t(display), display.to_s] }, { include_blank: true }, { class: 'select2' }) %>
+ <%= select(:shipping_method, :display_on, Spree::ShippingMethod::DISPLAY.collect { |display| [Spree.t(display), display.to_s] }, { include_blank: true }, { class: 'select2-clear' }) %>
<%= f.error_message_on :display_on %>
<% end %>
</div>
@@ -110,7 +110,7 @@
<div class="card-body">
<%= f.field_container :categories, class: ['form-group'] do %>
- <%= f.select :tax_category_id, @tax_categories.map { |tc| [tc.name, tc.id] }, { include_blank: true }, class: "select2" %>
+ <%= f.select :tax_category_id, @tax_categories.map { |tc| [tc.name, tc.id] }, { include_blank: true }, class: "select2-clear" %>
<%= f.error_message_on :tax_category_id %>
<% end %>
</div>
diff --git a/backend/app/views/spree/admin/stock_locations/_form.html.erb b/backend/app/views/spree/admin/stock_locations/_form.html.erb
index 1d07a3275b..618350e86f 100644
--- a/backend/app/views/spree/admin/stock_locations/_form.html.erb
+++ b/backend/app/views/spree/admin/stock_locations/_form.html.erb
@@ -80,7 +80,7 @@
<%= f.label :state_id, Spree.t(:state) %>
<span id="state" class="region">
<%= f.text_field :state_name, style: "#{f.object.country.states.empty? ? '' : 'display: none;'}", disabled: !f.object.country.states.empty?, class: 'state_name form-control' %>
- <%= f.collection_select :state_id, f.object.country.states.sort, :id, :name, { include_blank: true }, {class: 'select2', style: "#{f.object.country.states.empty? ? 'display: none;' : '' };", disabled: f.object.country.states.empty?} %>
+ <%= f.collection_select :state_id, f.object.country.states.sort, :id, :name, { include_blank: true }, {class: 'select2-clear', style: "#{f.object.country.states.empty? ? 'display: none;' : '' };", disabled: f.object.country.states.empty?} %>
</span>
<% end %>
</div>
diff --git a/backend/app/views/spree/admin/stock_transfers/index.html.erb b/backend/app/views/spree/admin/stock_transfers/index.html.erb
index 2ea6d65666..5fa4ea93f7 100644
--- a/backend/app/views/spree/admin/stock_transfers/index.html.erb
+++ b/backend/app/views/spree/admin/stock_transfers/index.html.erb
@@ -23,7 +23,7 @@
<%= f.label :source_location, Spree.t(:source) %>
<%= f.select :source_location_id_eq,
options_from_collection_for_select(@stock_locations, :id, :name, @q.source_location_id_eq),
- { include_blank: true }, class: 'select2 js-filterable' %>
+ { include_blank: true }, class: 'select2-clear js-filterable' %>
</div>
</div>
@@ -32,7 +32,7 @@
<%= f.label :destination_location, Spree.t(:destination) %>
<%= f.select :destination_location_id_eq,
options_from_collection_for_select(@stock_locations, :id, :name, @q.destination_location_id_eq),
- { include_blank: true }, class: 'select2 js-filterable' %>
+ { include_blank: true }, class: 'select2-clear js-filterable' %>
</div>
</div>
</div>
diff --git a/backend/app/views/spree/admin/variants/_form.html.erb b/backend/app/views/spree/admin/variants/_form.html.erb
index b8b01a5ff8..298be4dd18 100644
--- a/backend/app/views/spree/admin/variants/_form.html.erb
+++ b/backend/app/views/spree/admin/variants/_form.html.erb
@@ -6,10 +6,10 @@
<%= label :new_variant, option_type.presentation %>
<% if option_type.name == 'color' %>
<%= f.collection_select 'option_value_ids', option_type.option_values, :id, :name,
- { include_blank: true }, { name: 'variant[option_value_ids][]', class: 'select2', id: "option_value_ids-#{option_type.id}" } %>
+ { include_blank: true }, { name: 'variant[option_value_ids][]', class: 'select2-clear', id: "option_value_ids-#{option_type.id}" } %>
<% else %>
<%= f.collection_select 'option_value_ids', option_type.option_values, :id, :presentation,
- { include_blank: true }, { name: 'variant[option_value_ids][]', class: 'select2', id: "option_value_ids-#{option_type.id}" } %>
+ { include_blank: true }, { name: 'variant[option_value_ids][]', class: 'select2-clear', id: "option_value_ids-#{option_type.id}" } %>
<% end %>
</div>
<% end %>