From 0122a23c1fc5ddc3e923e8608a68782e26e41a7a Mon Sep 17 00:00:00 2001 From: John Hawthorn Date: Thu, 18 Jan 2018 11:29:38 -0800 Subject: [PATCH 1/6] Remove unused admin products helpers This removes taxon_options_for and option_types_options_for, which haven't been used since 2012 (when their usage replaced with querying the API) --- .../helpers/spree/admin/products_helper.rb | 24 ------------------- 1 file changed, 24 deletions(-) diff --git a/backend/app/helpers/spree/admin/products_helper.rb b/backend/app/helpers/spree/admin/products_helper.rb index 583d39f01dd..ad55544fda0 100644 --- a/backend/app/helpers/spree/admin/products_helper.rb +++ b/backend/app/helpers/spree/admin/products_helper.rb @@ -1,30 +1,6 @@ module Spree module Admin module ProductsHelper - def taxon_options_for(product) - options = @taxons.map do |taxon| - selected = product.taxons.include?(taxon) - content_tag(:option, - value: taxon.id, - selected: ('selected' if selected)) do - (taxon.ancestors.pluck(:name) + [taxon.name]).join(" -> ") - end - end - safe_join(options) - end - - def option_types_options_for(product) - @option_types.map do |option_type| - selected = product.option_types.include?(option_type) - content_tag(:option, - value: option_type.id, - selected: ('selected' if selected)) do - option_type.name - end - end - safe_join(options) - end - def show_rebuild_vat_checkbox? Spree::TaxRate.included_in_price.exists? end From 1c23ed226c77743ef50dfcce9e3e4b742a96a9b1 Mon Sep 17 00:00:00 2001 From: John Hawthorn Date: Thu, 18 Jan 2018 12:53:59 -0800 Subject: [PATCH 2/6] Remove inventory_settings_helper The only method defined here, show_not, hasn't been used since 2013. --- .../app/helpers/spree/admin/inventory_settings_helper.rb | 9 --------- 1 file changed, 9 deletions(-) delete mode 100644 backend/app/helpers/spree/admin/inventory_settings_helper.rb diff --git a/backend/app/helpers/spree/admin/inventory_settings_helper.rb b/backend/app/helpers/spree/admin/inventory_settings_helper.rb deleted file mode 100644 index b4923b5893a..00000000000 --- a/backend/app/helpers/spree/admin/inventory_settings_helper.rb +++ /dev/null @@ -1,9 +0,0 @@ -module Spree - module Admin - module InventorySettingsHelper - def show_not(true_or_false) - true_or_false ? '' : t('spree.not') - end - end - end -end From 858bafb496f228211e068335fa2b8ff05cc50ad3 Mon Sep 17 00:00:00 2001 From: John Hawthorn Date: Thu, 18 Jan 2018 12:54:50 -0800 Subject: [PATCH 3/6] Remove general_settings_helper The only page using this was removed from solidus 1.0. --- .../helpers/spree/admin/general_settings_helper.rb | 13 ------------- 1 file changed, 13 deletions(-) delete mode 100644 backend/app/helpers/spree/admin/general_settings_helper.rb diff --git a/backend/app/helpers/spree/admin/general_settings_helper.rb b/backend/app/helpers/spree/admin/general_settings_helper.rb deleted file mode 100644 index c1c39ea58a5..00000000000 --- a/backend/app/helpers/spree/admin/general_settings_helper.rb +++ /dev/null @@ -1,13 +0,0 @@ -module Spree - module Admin - module GeneralSettingsHelper - def currency_options - currencies = ::Money::Currency.table.map do |_code, details| - iso = details[:iso_code] - [iso, "#{details[:name]} (#{iso})"] - end - options_from_collection_for_select(currencies, :first, :last, Spree::Config[:currency]) - end - end - end -end From b0d3e6808438b9ef0affa81abadfa942f4e21be3 Mon Sep 17 00:00:00 2001 From: John Hawthorn Date: Thu, 18 Jan 2018 12:58:00 -0800 Subject: [PATCH 4/6] Remove tables_helper The only method in here, sort_by_active_class, hasn't been used since 2012. --- .../app/controllers/spree/admin/base_controller.rb | 1 - backend/app/helpers/spree/admin/tables_helper.rb | 13 ------------- 2 files changed, 14 deletions(-) delete mode 100644 backend/app/helpers/spree/admin/tables_helper.rb diff --git a/backend/app/controllers/spree/admin/base_controller.rb b/backend/app/controllers/spree/admin/base_controller.rb index 3c299f7cd61..83255145e71 100644 --- a/backend/app/controllers/spree/admin/base_controller.rb +++ b/backend/app/controllers/spree/admin/base_controller.rb @@ -2,7 +2,6 @@ module Spree module Admin class BaseController < Spree::BaseController helper 'spree/admin/navigation' - helper 'spree/admin/tables' layout '/spree/layouts/admin' before_action :authorize_admin diff --git a/backend/app/helpers/spree/admin/tables_helper.rb b/backend/app/helpers/spree/admin/tables_helper.rb deleted file mode 100644 index 0072c773f6f..00000000000 --- a/backend/app/helpers/spree/admin/tables_helper.rb +++ /dev/null @@ -1,13 +0,0 @@ -module Spree - module Admin - module TablesHelper - # Adds class 'active' to & tags - # for better tables styling - def sort_by_active_class(row) - if params[:q][:s] && params[:q][:s].include?(row) - return "sort-active" - end - end - end - end -end From ed2f32cd59dd64bfad6d514e888346d1cb272147 Mon Sep 17 00:00:00 2001 From: John Hawthorn Date: Thu, 18 Jan 2018 12:59:56 -0800 Subject: [PATCH 5/6] Remove attribute_name_for This hasn't been used since 2012, and was only ever used by other helper methods (probably why it was private, though that doesn't really restrict usage). --- backend/app/helpers/spree/admin/base_helper.rb | 6 ------ 1 file changed, 6 deletions(-) diff --git a/backend/app/helpers/spree/admin/base_helper.rb b/backend/app/helpers/spree/admin/base_helper.rb index db55b5d4937..8afba93bacd 100644 --- a/backend/app/helpers/spree/admin/base_helper.rb +++ b/backend/app/helpers/spree/admin/base_helper.rb @@ -130,12 +130,6 @@ def admin_layout(layout = nil) @admin_layout = layout if layout @admin_layout end - - private - - def attribute_name_for(field_name) - field_name.tr(' ', '_').downcase - end end end end From 639c6576d7aa2f2da96a969b5db3c1511c722d0d Mon Sep 17 00:00:00 2001 From: John Hawthorn Date: Thu, 18 Jan 2018 13:01:00 -0800 Subject: [PATCH 6/6] Remove taxons_helper This hasn't been used since 2012, though an unused view which referenced it was around until recently. This method is badly named and is likely to confuse users. It looks like a route method with the "_path" suffix, but it has a different idea of what "path" means. --- backend/app/helpers/spree/admin/taxons_helper.rb | 9 --------- 1 file changed, 9 deletions(-) delete mode 100644 backend/app/helpers/spree/admin/taxons_helper.rb diff --git a/backend/app/helpers/spree/admin/taxons_helper.rb b/backend/app/helpers/spree/admin/taxons_helper.rb deleted file mode 100644 index 87ee61dbd51..00000000000 --- a/backend/app/helpers/spree/admin/taxons_helper.rb +++ /dev/null @@ -1,9 +0,0 @@ -module Spree - module Admin - module TaxonsHelper - def taxon_path(taxon) - taxon.ancestors.reverse.collect(&:name).join( " >> ") - end - end - end -end