Commit 590c84c7a4a5f838a94c13b39c749ab25dffa210
1 parent
08e52a56
Exists in
master
and in
4 other branches
Fix determine of layout for group/team
Showing
2 changed files
with
20 additions
and
5 deletions
Show diff stats
app/controllers/groups_controller.rb
| 1 | 1 | class GroupsController < ApplicationController |
| 2 | 2 | respond_to :html |
| 3 | - layout 'group', except: [:new, :create] | |
| 4 | - | |
| 5 | 3 | before_filter :group, except: [:new, :create] |
| 6 | 4 | |
| 7 | 5 | # Authorize |
| ... | ... | @@ -12,7 +10,8 @@ class GroupsController < ApplicationController |
| 12 | 10 | # Load group projects |
| 13 | 11 | before_filter :projects, except: [:new, :create] |
| 14 | 12 | |
| 15 | - layout 'navless', only: [:new, :create] | |
| 13 | + layout :determine_layout | |
| 14 | + | |
| 16 | 15 | before_filter :set_title, only: [:new, :create] |
| 17 | 16 | |
| 18 | 17 | def new |
| ... | ... | @@ -141,4 +140,12 @@ class GroupsController < ApplicationController |
| 141 | 140 | def set_title |
| 142 | 141 | @title = 'New Group' |
| 143 | 142 | end |
| 143 | + | |
| 144 | + def determine_layout | |
| 145 | + if [:new, :create].include?(action_name.to_sym) | |
| 146 | + 'navless' | |
| 147 | + else | |
| 148 | + 'group' | |
| 149 | + end | |
| 150 | + end | |
| 144 | 151 | end | ... | ... |
app/controllers/teams_controller.rb
| ... | ... | @@ -6,8 +6,8 @@ class TeamsController < ApplicationController |
| 6 | 6 | |
| 7 | 7 | before_filter :user_team, except: [:new, :create] |
| 8 | 8 | |
| 9 | - layout 'user_team', except: [:new, :create] | |
| 10 | - layout 'navless', only: [:new, :create] | |
| 9 | + layout :determine_layout | |
| 10 | + | |
| 11 | 11 | before_filter :set_title, only: [:new, :create] |
| 12 | 12 | |
| 13 | 13 | def show |
| ... | ... | @@ -82,4 +82,12 @@ class TeamsController < ApplicationController |
| 82 | 82 | def set_title |
| 83 | 83 | @title = 'New Team' |
| 84 | 84 | end |
| 85 | + | |
| 86 | + def determine_layout | |
| 87 | + if [:new, :create].include?(action_name.to_sym) | |
| 88 | + 'navless' | |
| 89 | + else | |
| 90 | + 'user_team' | |
| 91 | + end | |
| 92 | + end | |
| 85 | 93 | end | ... | ... |