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 | 11 | helper_method :abilities, :can? |
| 12 | 12 | |
| 13 | 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 | 15 | end |
| 16 | 16 | |
| 17 | 17 | rescue_from Encoding::CompatibilityError do |exception| |
| 18 | - render "errors/encoding", layout: "error", status: 500 | |
| 18 | + render "errors/encoding", layout: "errors", status: 500 | |
| 19 | 19 | end |
| 20 | 20 | |
| 21 | 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 | 23 | end |
| 24 | 24 | |
| 25 | - layout :layout_by_resource | |
| 26 | - | |
| 27 | 25 | protected |
| 28 | 26 | |
| 29 | 27 | def check_token_auth |
| ... | ... | @@ -51,14 +49,6 @@ class ApplicationController < ActionController::Base |
| 51 | 49 | end |
| 52 | 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 | 52 | def set_current_user_for_mailer |
| 63 | 53 | MailerObserver.current_user = current_user |
| 64 | 54 | end |
| ... | ... | @@ -93,15 +83,15 @@ class ApplicationController < ActionController::Base |
| 93 | 83 | end |
| 94 | 84 | |
| 95 | 85 | def access_denied! |
| 96 | - render "errors/access_denied", layout: "error", status: 404 | |
| 86 | + render "errors/access_denied", layout: "errors", status: 404 | |
| 97 | 87 | end |
| 98 | 88 | |
| 99 | 89 | def not_found! |
| 100 | - render "errors/not_found", layout: "error", status: 404 | |
| 90 | + render "errors/not_found", layout: "errors", status: 404 | |
| 101 | 91 | end |
| 102 | 92 | |
| 103 | 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 | 95 | end |
| 106 | 96 | |
| 107 | 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 | 2 | before_filter :project |
| 3 | 3 | # Authorize |
| 4 | 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 | 5 | end | ... | ... |
app/controllers/projects_controller.rb
| ... | ... | @@ -8,6 +8,8 @@ class ProjectsController < ProjectController |
| 8 | 8 | before_filter :authorize_admin_project!, only: [:edit, :update, :destroy] |
| 9 | 9 | before_filter :require_non_empty_project, only: [:blob, :tree, :graph] |
| 10 | 10 | |
| 11 | + layout 'application', only: [:new, :create] | |
| 12 | + | |
| 11 | 13 | def new |
| 12 | 14 | @project = Project.new |
| 13 | 15 | end | ... | ... |
app/views/layouts/error.html.haml
config/application.rb