From 3070bb20ed902da6c23267988a103bea70a55df7 Mon Sep 17 00:00:00 2001 From: Matt-Yorkley <9029026+Matt-Yorkley@users.noreply.github.com> Date: Thu, 4 Mar 2021 13:22:27 +0000 Subject: [PATCH] WIP - Update loading of helpers in controllers Rails has changed the way helpers are loaded. It's a bit weird. It was throwing lots of errors, and recommended using this setting, but now requires that all helpers are loaded explicitly. I'm not sure about this. --- app/controllers/application_controller.rb | 12 ++++++++++++ app/controllers/base_controller.rb | 2 -- app/controllers/spree/admin/base_controller.rb | 5 +++++ config/application.rb | 2 ++ .../admin/shared/_order_links.html.haml_spec.rb | 1 + 5 files changed, 20 insertions(+), 2 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 399d1ae9e1..dfa0ea9a65 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -13,6 +13,18 @@ class ApplicationController < ActionController::Base self.responder = ApplicationResponder respond_to :html + helper 'spree/base' + helper 'spree/orders' + helper 'shared' + helper 'enterprises' + helper 'order_cycles' + helper 'order' + helper 'shop' + helper 'injection' + helper 'markdown' + helper 'footer_links' + helper 'discourse' + protect_from_forgery include Spree::Core::ControllerHelpers::Auth diff --git a/app/controllers/base_controller.rb b/app/controllers/base_controller.rb index 8ea4718cb5..312dee2063 100644 --- a/app/controllers/base_controller.rb +++ b/app/controllers/base_controller.rb @@ -13,8 +13,6 @@ class BaseController < ApplicationController include I18nHelper include OrderCyclesHelper - helper 'spree/base' - before_action :set_locale before_action :check_order_cycle_expiry diff --git a/app/controllers/spree/admin/base_controller.rb b/app/controllers/spree/admin/base_controller.rb index 8d002b583c..8139afa2ff 100644 --- a/app/controllers/spree/admin/base_controller.rb +++ b/app/controllers/spree/admin/base_controller.rb @@ -3,7 +3,12 @@ module Spree class BaseController < ApplicationController ssl_required + helper 'shared' helper 'spree/admin/navigation' + helper 'spree/admin/orders' + helper 'admin/injection' + helper 'admin/orders' + layout '/spree/layouts/admin' include I18nHelper diff --git a/config/application.rb b/config/application.rb index 33638102f5..f76a58f203 100644 --- a/config/application.rb +++ b/config/application.rb @@ -200,5 +200,7 @@ module Openfoodnetwork config.active_support.escape_html_entities_in_json = true config.active_job.queue_adapter = :delayed_job + + config.action_controller.include_all_helpers = false end end diff --git a/spec/views/spree/admin/shared/_order_links.html.haml_spec.rb b/spec/views/spree/admin/shared/_order_links.html.haml_spec.rb index 264a81976b..b15eb93f02 100644 --- a/spec/views/spree/admin/shared/_order_links.html.haml_spec.rb +++ b/spec/views/spree/admin/shared/_order_links.html.haml_spec.rb @@ -4,6 +4,7 @@ require "spec_helper" describe "spree/admin/shared/_order_links.html.haml" do helper Spree::BaseHelper # required to make pretty_time work + helper Spree::Admin::OrdersHelper before do order = create(:order)