Commit bdf317addc2ae586c76f46ccb1aa8659513baf16
1 parent
078a8f0e
Exists in
master
and in
4 other branches
layout selected by controller name
Showing
8 changed files
with
22 additions
and
40 deletions
Show diff stats
app/controllers/application_controller.rb
@@ -11,19 +11,17 @@ class ApplicationController < ActionController::Base | @@ -11,19 +11,17 @@ class ApplicationController < ActionController::Base | ||
11 | helper_method :abilities, :can? | 11 | helper_method :abilities, :can? |
12 | 12 | ||
13 | rescue_from Gitlab::Gitolite::AccessDenied do |exception| | 13 | rescue_from Gitlab::Gitolite::AccessDenied do |exception| |
14 | - render "errors/gitolite", layout: "error", status: 500 | 14 | + render "errors/gitolite", layout: "errors", status: 500 |
15 | end | 15 | end |
16 | 16 | ||
17 | rescue_from Encoding::CompatibilityError do |exception| | 17 | rescue_from Encoding::CompatibilityError do |exception| |
18 | - render "errors/encoding", layout: "error", status: 500 | 18 | + render "errors/encoding", layout: "errors", status: 500 |
19 | end | 19 | end |
20 | 20 | ||
21 | rescue_from ActiveRecord::RecordNotFound do |exception| | 21 | rescue_from ActiveRecord::RecordNotFound do |exception| |
22 | - render "errors/not_found", layout: "error", status: 404 | 22 | + render "errors/not_found", layout: "errors", status: 404 |
23 | end | 23 | end |
24 | 24 | ||
25 | - layout :layout_by_resource | ||
26 | - | ||
27 | protected | 25 | protected |
28 | 26 | ||
29 | def check_token_auth | 27 | def check_token_auth |
@@ -51,14 +49,6 @@ class ApplicationController < ActionController::Base | @@ -51,14 +49,6 @@ class ApplicationController < ActionController::Base | ||
51 | end | 49 | end |
52 | end | 50 | end |
53 | 51 | ||
54 | - def layout_by_resource | ||
55 | - if devise_controller? | ||
56 | - "devise_layout" | ||
57 | - else | ||
58 | - "application" | ||
59 | - end | ||
60 | - end | ||
61 | - | ||
62 | def set_current_user_for_mailer | 52 | def set_current_user_for_mailer |
63 | MailerObserver.current_user = current_user | 53 | MailerObserver.current_user = current_user |
64 | end | 54 | end |
@@ -93,15 +83,15 @@ class ApplicationController < ActionController::Base | @@ -93,15 +83,15 @@ class ApplicationController < ActionController::Base | ||
93 | end | 83 | end |
94 | 84 | ||
95 | def access_denied! | 85 | def access_denied! |
96 | - render "errors/access_denied", layout: "error", status: 404 | 86 | + render "errors/access_denied", layout: "errors", status: 404 |
97 | end | 87 | end |
98 | 88 | ||
99 | def not_found! | 89 | def not_found! |
100 | - render "errors/not_found", layout: "error", status: 404 | 90 | + render "errors/not_found", layout: "errors", status: 404 |
101 | end | 91 | end |
102 | 92 | ||
103 | def git_not_found! | 93 | def git_not_found! |
104 | - render "errors/git_not_found", layout: "error", status: 404 | 94 | + render "errors/git_not_found", layout: "errors", status: 404 |
105 | end | 95 | end |
106 | 96 | ||
107 | def method_missing(method_sym, *arguments, &block) | 97 | def method_missing(method_sym, *arguments, &block) |
app/controllers/errors_controller.rb
app/controllers/profile_controller.rb
app/controllers/project_controller.rb
@@ -2,15 +2,4 @@ class ProjectController < ApplicationController | @@ -2,15 +2,4 @@ class ProjectController < ApplicationController | ||
2 | before_filter :project | 2 | before_filter :project |
3 | # Authorize | 3 | # Authorize |
4 | before_filter :add_project_abilities | 4 | before_filter :add_project_abilities |
5 | - | ||
6 | - layout :determine_layout | ||
7 | - | ||
8 | - protected | ||
9 | - def determine_layout | ||
10 | - if @project && !@project.new_record? | ||
11 | - 'project' | ||
12 | - else | ||
13 | - 'application' | ||
14 | - end | ||
15 | - end | ||
16 | end | 5 | end |
app/controllers/projects_controller.rb
@@ -8,6 +8,8 @@ class ProjectsController < ProjectController | @@ -8,6 +8,8 @@ class ProjectsController < ProjectController | ||
8 | before_filter :authorize_admin_project!, only: [:edit, :update, :destroy] | 8 | before_filter :authorize_admin_project!, only: [:edit, :update, :destroy] |
9 | before_filter :require_non_empty_project, only: [:blob, :tree, :graph] | 9 | before_filter :require_non_empty_project, only: [:blob, :tree, :graph] |
10 | 10 | ||
11 | + layout 'application', only: [:new, :create] | ||
12 | + | ||
11 | def new | 13 | def new |
12 | @project = Project.new | 14 | @project = Project.new |
13 | end | 15 | end |
app/views/layouts/error.html.haml
config/application.rb
@@ -53,5 +53,9 @@ module Gitlab | @@ -53,5 +53,9 @@ module Gitlab | ||
53 | 53 | ||
54 | # Add fonts | 54 | # Add fonts |
55 | config.assets.paths << "#{Rails.root}/app/assets/fonts" | 55 | config.assets.paths << "#{Rails.root}/app/assets/fonts" |
56 | + | ||
57 | + config.to_prepare do | ||
58 | + Devise::SessionsController.layout 'devise_layout' | ||
59 | + end | ||
56 | end | 60 | end |
57 | end | 61 | end |