Use ShippingMethod :frontend method and drop :backend to avoid ClassLength Rubocop error

This commit is contained in:
Cillian O'Ruanaidh
2022-07-15 15:51:23 +01:00
committed by Filipe
parent 0673f9a5ae
commit 87431c188e
2 changed files with 4 additions and 8 deletions

View File

@@ -71,10 +71,6 @@ module Spree
spree_calculators.__send__ model_name_without_spree_namespace
end
def backend?
!frontend?
end
# Some shipping methods are only meant to be set via backend
def frontend?
display_on != "back_end"

View File

@@ -32,14 +32,14 @@
- if shipping_methods.any?
- shipping_methods.each do |shipping_method|
%p
%label{ class: ("disabled" if shipping_method.backend?) }
%label{ class: ("disabled" unless shipping_method.frontend?) }
= check_box_tag "order_cycle[selected_shipping_method_ids][]",
shipping_method.id, @order_cycle.shipping_methods.include?(shipping_method),
disabled: shipping_method.backend?,
disabled: !shipping_method.frontend?,
id: "order_cycle_selected_shipping_method_ids_#{shipping_method.id}",
data: ({ "action" => "change->select-all#toggleCheckbox", "select-all-target" => "checkbox" } unless shipping_method.backend?)
data: ({ "action" => "change->select-all#toggleCheckbox", "select-all-target" => "checkbox" } if shipping_method.frontend?)
= shipping_method.name
- if shipping_method.backend?
- unless shipping_method.frontend?
= "(#{t('.back_end')})"
- if @order_cycle.distributors.many?
—