about summary refs log tree commit diff
path: root/app/controllers
diff options
context:
space:
mode:
authorEugen <eugen@zeonfederated.com>2017-02-08 03:04:29 +0100
committerGitHub <noreply@github.com>2017-02-08 03:04:29 +0100
commitd96e031dfc0db84318af9f4371403cdcf5bc2804 (patch)
tree3e559eb320c0b5cc2ad9983450da05bc7b9e3c81 /app/controllers
parentaa1213e0890efd93d9a2531e78bc70fc08154d7a (diff)
Fix #611 - Layout setting in registrations controller
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/auth/registrations_controller.rb9
1 files changed, 7 insertions, 2 deletions
diff --git a/app/controllers/auth/registrations_controller.rb b/app/controllers/auth/registrations_controller.rb
index b7d019c24..501e66807 100644
--- a/app/controllers/auth/registrations_controller.rb
+++ b/app/controllers/auth/registrations_controller.rb
@@ -1,8 +1,7 @@
 # frozen_string_literal: true
 
 class Auth::RegistrationsController < Devise::RegistrationsController
-  layout 'auth'
-  layout 'admin', only: [:edit]
+  layout :determine_layout
 
   before_action :check_single_user_mode
   before_action :configure_sign_up_params, only: [:create]
@@ -31,4 +30,10 @@ class Auth::RegistrationsController < Devise::RegistrationsController
   def check_single_user_mode
     redirect_to root_path if Rails.configuration.x.single_user_mode
   end
+  
+  private
+  
+  def determine_layout
+    %w(edit update).include?(action_name) ? 'admin' : 'auth'
+  end
 end