diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb index 38bc3665b51..efc93329ff5 100644 --- a/app/controllers/groups_controller.rb +++ b/app/controllers/groups_controller.rb @@ -1,7 +1,5 @@ class GroupsController < ApplicationController respond_to :html - layout 'group', except: [:new, :create] - before_filter :group, except: [:new, :create] # Authorize @@ -12,7 +10,8 @@ class GroupsController < ApplicationController # Load group projects before_filter :projects, except: [:new, :create] - layout 'navless', only: [:new, :create] + layout :determine_layout + before_filter :set_title, only: [:new, :create] def new @@ -141,4 +140,12 @@ class GroupsController < ApplicationController def set_title @title = 'New Group' end + + def determine_layout + if [:new, :create].include?(action_name.to_sym) + 'navless' + else + 'group' + end + end end diff --git a/app/controllers/teams_controller.rb b/app/controllers/teams_controller.rb index c7d4040725d..73c2fb43326 100644 --- a/app/controllers/teams_controller.rb +++ b/app/controllers/teams_controller.rb @@ -6,8 +6,8 @@ class TeamsController < ApplicationController before_filter :user_team, except: [:new, :create] - layout 'user_team', except: [:new, :create] - layout 'navless', only: [:new, :create] + layout :determine_layout + before_filter :set_title, only: [:new, :create] def show @@ -82,4 +82,12 @@ class TeamsController < ApplicationController def set_title @title = 'New Team' end + + def determine_layout + if [:new, :create].include?(action_name.to_sym) + 'navless' + else + 'user_team' + end + end end