aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlban Peignier2017-11-26 17:15:21 +0100
committerAlban Peignier2017-11-26 17:15:21 +0100
commit3d82cd8ce2e703e17278e3ac6c043568851781a5 (patch)
tree8ba9af62e2dc3c7052054e5710705c947a94dcde
parente9f84780c9b79bcab6ddb69ca9b730fba7811611 (diff)
downloadchouette-core-3d82cd8ce2e703e17278e3ac6c043568851781a5.tar.bz2
Use an helper to invoke render method safely. Refs #4735
-rw-r--r--app/controllers/application_controller.rb8
-rw-r--r--app/helpers/custom_view_helper.rb9
2 files changed, 9 insertions, 8 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index 6c83547f0..6a9f6942f 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -38,13 +38,6 @@ class ApplicationController < ActionController::Base
end
helper_method :current_offer_workbench
- def render_custom_view(view)
- view_name = [view, current_organisation.custom_view].compact.join('_')
- Rails.logger.info "Render custom view #{view_name}"
- render partial: view_name
- end
- helper_method :render_custom_view
-
def current_functional_scope
functional_scope = current_organisation.sso_attributes.try(:[], "functional_scope") if current_organisation
JSON.parse(functional_scope) if functional_scope
@@ -55,7 +48,6 @@ class ApplicationController < ActionController::Base
current_organisation
end
-
# Overwriting the sign_out redirect path method
def after_sign_out_path_for(resource_or_scope)
new_user_session_path
diff --git a/app/helpers/custom_view_helper.rb b/app/helpers/custom_view_helper.rb
new file mode 100644
index 000000000..5f1c3b3ff
--- /dev/null
+++ b/app/helpers/custom_view_helper.rb
@@ -0,0 +1,9 @@
+module CustomViewHelper
+
+ def render_custom_view(view)
+ view_name = [view, current_organisation.custom_view].compact.join('_')
+ Rails.logger.info "Render custom view #{view_name}"
+ render partial: view_name
+ end
+
+end