Commit 68f4b59738b43d9d6969528188ec74a87546a29f
Exists in
master
and in
4 other branches
Merge pull request #1569 from jouve/simplify_controllers2
Simplify controllers and layout handling
Showing
29 changed files
with
93 additions
and
202 deletions
Show diff stats
app/controllers/application_controller.rb
| @@ -10,19 +10,17 @@ class ApplicationController < ActionController::Base | @@ -10,19 +10,17 @@ class ApplicationController < ActionController::Base | ||
| 10 | helper_method :abilities, :can? | 10 | helper_method :abilities, :can? |
| 11 | 11 | ||
| 12 | rescue_from Gitlab::Gitolite::AccessDenied do |exception| | 12 | rescue_from Gitlab::Gitolite::AccessDenied do |exception| |
| 13 | - render "errors/gitolite", layout: "error", status: 500 | 13 | + render "errors/gitolite", layout: "errors", status: 500 |
| 14 | end | 14 | end |
| 15 | 15 | ||
| 16 | rescue_from Encoding::CompatibilityError do |exception| | 16 | rescue_from Encoding::CompatibilityError do |exception| |
| 17 | - render "errors/encoding", layout: "error", status: 500 | 17 | + render "errors/encoding", layout: "errors", status: 500 |
| 18 | end | 18 | end |
| 19 | 19 | ||
| 20 | rescue_from ActiveRecord::RecordNotFound do |exception| | 20 | rescue_from ActiveRecord::RecordNotFound do |exception| |
| 21 | - render "errors/not_found", layout: "error", status: 404 | 21 | + render "errors/not_found", layout: "errors", status: 404 |
| 22 | end | 22 | end |
| 23 | 23 | ||
| 24 | - layout :layout_by_resource | ||
| 25 | - | ||
| 26 | protected | 24 | protected |
| 27 | 25 | ||
| 28 | def reject_blocked! | 26 | def reject_blocked! |
| @@ -43,14 +41,6 @@ class ApplicationController < ActionController::Base | @@ -43,14 +41,6 @@ class ApplicationController < ActionController::Base | ||
| 43 | end | 41 | end |
| 44 | end | 42 | end |
| 45 | 43 | ||
| 46 | - def layout_by_resource | ||
| 47 | - if devise_controller? | ||
| 48 | - "devise_layout" | ||
| 49 | - else | ||
| 50 | - "application" | ||
| 51 | - end | ||
| 52 | - end | ||
| 53 | - | ||
| 54 | def set_current_user_for_mailer | 44 | def set_current_user_for_mailer |
| 55 | MailerObserver.current_user = current_user | 45 | MailerObserver.current_user = current_user |
| 56 | end | 46 | end |
| @@ -68,7 +58,7 @@ class ApplicationController < ActionController::Base | @@ -68,7 +58,7 @@ class ApplicationController < ActionController::Base | ||
| 68 | end | 58 | end |
| 69 | 59 | ||
| 70 | def project | 60 | def project |
| 71 | - @project ||= current_user.projects.find_by_code(params[:project_id]) | 61 | + @project ||= current_user.projects.find_by_code(params[:project_id] || params[:id]) |
| 72 | @project || render_404 | 62 | @project || render_404 |
| 73 | end | 63 | end |
| 74 | 64 | ||
| @@ -85,15 +75,15 @@ class ApplicationController < ActionController::Base | @@ -85,15 +75,15 @@ class ApplicationController < ActionController::Base | ||
| 85 | end | 75 | end |
| 86 | 76 | ||
| 87 | def access_denied! | 77 | def access_denied! |
| 88 | - render "errors/access_denied", layout: "error", status: 404 | 78 | + render "errors/access_denied", layout: "errors", status: 404 |
| 89 | end | 79 | end |
| 90 | 80 | ||
| 91 | def not_found! | 81 | def not_found! |
| 92 | - render "errors/not_found", layout: "error", status: 404 | 82 | + render "errors/not_found", layout: "errors", status: 404 |
| 93 | end | 83 | end |
| 94 | 84 | ||
| 95 | def git_not_found! | 85 | def git_not_found! |
| 96 | - render "errors/git_not_found", layout: "error", status: 404 | 86 | + render "errors/git_not_found", layout: "errors", status: 404 |
| 97 | end | 87 | end |
| 98 | 88 | ||
| 99 | def method_missing(method_sym, *arguments, &block) | 89 | def method_missing(method_sym, *arguments, &block) |
app/controllers/blame_controller.rb
| 1 | # Controller for viewing a file's blame | 1 | # Controller for viewing a file's blame |
| 2 | -class BlameController < ApplicationController | 2 | +class BlameController < ProjectResourceController |
| 3 | include ExtractsPath | 3 | include ExtractsPath |
| 4 | 4 | ||
| 5 | - layout "project" | ||
| 6 | - | ||
| 7 | - before_filter :project | ||
| 8 | - | ||
| 9 | # Authorize | 5 | # Authorize |
| 10 | - before_filter :add_project_abilities | ||
| 11 | before_filter :authorize_read_project! | 6 | before_filter :authorize_read_project! |
| 12 | before_filter :authorize_code_access! | 7 | before_filter :authorize_code_access! |
| 13 | before_filter :require_non_empty_project | 8 | before_filter :require_non_empty_project |
app/controllers/blob_controller.rb
| 1 | # Controller for viewing a file's blame | 1 | # Controller for viewing a file's blame |
| 2 | -class BlobController < ApplicationController | 2 | +class BlobController < ProjectResourceController |
| 3 | include ExtractsPath | 3 | include ExtractsPath |
| 4 | include Gitlab::Encode | 4 | include Gitlab::Encode |
| 5 | 5 | ||
| 6 | - layout "project" | ||
| 7 | - | ||
| 8 | - before_filter :project | ||
| 9 | - | ||
| 10 | # Authorize | 6 | # Authorize |
| 11 | - before_filter :add_project_abilities | ||
| 12 | before_filter :authorize_read_project! | 7 | before_filter :authorize_read_project! |
| 13 | before_filter :authorize_code_access! | 8 | before_filter :authorize_code_access! |
| 14 | before_filter :require_non_empty_project | 9 | before_filter :require_non_empty_project |
app/controllers/commit_controller.rb
| 1 | # Controller for a specific Commit | 1 | # Controller for a specific Commit |
| 2 | # | 2 | # |
| 3 | # Not to be confused with CommitsController, plural. | 3 | # Not to be confused with CommitsController, plural. |
| 4 | -class CommitController < ApplicationController | ||
| 5 | - before_filter :project | ||
| 6 | - layout "project" | ||
| 7 | - | 4 | +class CommitController < ProjectResourceController |
| 8 | # Authorize | 5 | # Authorize |
| 9 | - before_filter :add_project_abilities | ||
| 10 | before_filter :authorize_read_project! | 6 | before_filter :authorize_read_project! |
| 11 | before_filter :authorize_code_access! | 7 | before_filter :authorize_code_access! |
| 12 | before_filter :require_non_empty_project | 8 | before_filter :require_non_empty_project |
app/controllers/commits_controller.rb
| 1 | require "base64" | 1 | require "base64" |
| 2 | 2 | ||
| 3 | -class CommitsController < ApplicationController | ||
| 4 | - before_filter :project | ||
| 5 | - layout "project" | ||
| 6 | - | 3 | +class CommitsController < ProjectResourceController |
| 7 | include ExtractsPath | 4 | include ExtractsPath |
| 8 | 5 | ||
| 9 | # Authorize | 6 | # Authorize |
| 10 | - before_filter :add_project_abilities | ||
| 11 | before_filter :authorize_read_project! | 7 | before_filter :authorize_read_project! |
| 12 | before_filter :authorize_code_access! | 8 | before_filter :authorize_code_access! |
| 13 | before_filter :require_non_empty_project | 9 | before_filter :require_non_empty_project |
app/controllers/compare_controller.rb
| 1 | -class CompareController < ApplicationController | ||
| 2 | - before_filter :project | ||
| 3 | - layout "project" | ||
| 4 | - | 1 | +class CompareController < ProjectResourceController |
| 5 | # Authorize | 2 | # Authorize |
| 6 | - before_filter :add_project_abilities | ||
| 7 | before_filter :authorize_read_project! | 3 | before_filter :authorize_read_project! |
| 8 | before_filter :authorize_code_access! | 4 | before_filter :authorize_code_access! |
| 9 | before_filter :require_non_empty_project | 5 | before_filter :require_non_empty_project |
app/controllers/deploy_keys_controller.rb
| 1 | -class DeployKeysController < ApplicationController | 1 | +class DeployKeysController < ProjectResourceController |
| 2 | respond_to :html | 2 | respond_to :html |
| 3 | - layout "project" | ||
| 4 | - before_filter :project | ||
| 5 | 3 | ||
| 6 | # Authorize | 4 | # Authorize |
| 7 | - before_filter :add_project_abilities | ||
| 8 | before_filter :authorize_admin_project! | 5 | before_filter :authorize_admin_project! |
| 9 | 6 | ||
| 10 | - def project | ||
| 11 | - @project ||= Project.find_by_code(params[:project_id]) | ||
| 12 | - end | ||
| 13 | - | ||
| 14 | def index | 7 | def index |
| 15 | @keys = @project.deploy_keys.all | 8 | @keys = @project.deploy_keys.all |
| 16 | end | 9 | end |
app/controllers/errors_controller.rb
app/controllers/hooks_controller.rb
| 1 | -class HooksController < ApplicationController | ||
| 2 | - before_filter :project | ||
| 3 | - layout "project" | ||
| 4 | - | 1 | +class HooksController < ProjectResourceController |
| 5 | # Authorize | 2 | # Authorize |
| 6 | - before_filter :add_project_abilities | ||
| 7 | before_filter :authorize_read_project! | 3 | before_filter :authorize_read_project! |
| 8 | before_filter :authorize_admin_project!, only: [:new, :create, :destroy] | 4 | before_filter :authorize_admin_project!, only: [:new, :create, :destroy] |
| 9 | 5 |
app/controllers/issues_controller.rb
| 1 | -class IssuesController < ApplicationController | ||
| 2 | - before_filter :project | 1 | +class IssuesController < ProjectResourceController |
| 3 | before_filter :module_enabled | 2 | before_filter :module_enabled |
| 4 | before_filter :issue, only: [:edit, :update, :destroy, :show] | 3 | before_filter :issue, only: [:edit, :update, :destroy, :show] |
| 5 | helper_method :issues_filter | 4 | helper_method :issues_filter |
| 6 | 5 | ||
| 7 | - layout "project" | ||
| 8 | - | ||
| 9 | - # Authorize | ||
| 10 | - before_filter :add_project_abilities | ||
| 11 | - | ||
| 12 | # Allow read any issue | 6 | # Allow read any issue |
| 13 | before_filter :authorize_read_issue! | 7 | before_filter :authorize_read_issue! |
| 14 | 8 |
app/controllers/labels_controller.rb
| 1 | -class LabelsController < ApplicationController | ||
| 2 | - before_filter :project | 1 | +class LabelsController < ProjectResourceController |
| 3 | before_filter :module_enabled | 2 | before_filter :module_enabled |
| 4 | 3 | ||
| 5 | - layout "project" | ||
| 6 | - | ||
| 7 | - # Authorize | ||
| 8 | - before_filter :add_project_abilities | ||
| 9 | - | ||
| 10 | # Allow read any issue | 4 | # Allow read any issue |
| 11 | before_filter :authorize_read_issue! | 5 | before_filter :authorize_read_issue! |
| 12 | 6 |
app/controllers/merge_requests_controller.rb
| 1 | -class MergeRequestsController < ApplicationController | ||
| 2 | - before_filter :project | 1 | +class MergeRequestsController < ProjectResourceController |
| 3 | before_filter :module_enabled | 2 | before_filter :module_enabled |
| 4 | before_filter :merge_request, only: [:edit, :update, :destroy, :show, :commits, :diffs, :automerge, :automerge_check, :raw] | 3 | before_filter :merge_request, only: [:edit, :update, :destroy, :show, :commits, :diffs, :automerge, :automerge_check, :raw] |
| 5 | before_filter :validates_merge_request, only: [:show, :diffs, :raw] | 4 | before_filter :validates_merge_request, only: [:show, :diffs, :raw] |
| 6 | before_filter :define_show_vars, only: [:show, :diffs] | 5 | before_filter :define_show_vars, only: [:show, :diffs] |
| 7 | - layout "project" | ||
| 8 | - | ||
| 9 | - # Authorize | ||
| 10 | - before_filter :add_project_abilities | ||
| 11 | 6 | ||
| 12 | # Allow read any merge_request | 7 | # Allow read any merge_request |
| 13 | before_filter :authorize_read_merge_request! | 8 | before_filter :authorize_read_merge_request! |
app/controllers/milestones_controller.rb
| 1 | -class MilestonesController < ApplicationController | ||
| 2 | - before_filter :project | 1 | +class MilestonesController < ProjectResourceController |
| 3 | before_filter :module_enabled | 2 | before_filter :module_enabled |
| 4 | before_filter :milestone, only: [:edit, :update, :destroy, :show] | 3 | before_filter :milestone, only: [:edit, :update, :destroy, :show] |
| 5 | - layout "project" | ||
| 6 | - | ||
| 7 | - # Authorize | ||
| 8 | - before_filter :add_project_abilities | ||
| 9 | 4 | ||
| 10 | # Allow read any milestone | 5 | # Allow read any milestone |
| 11 | before_filter :authorize_read_milestone! | 6 | before_filter :authorize_read_milestone! |
app/controllers/notes_controller.rb
| 1 | -class NotesController < ApplicationController | ||
| 2 | - before_filter :project | ||
| 3 | - | 1 | +class NotesController < ProjectResourceController |
| 4 | # Authorize | 2 | # Authorize |
| 5 | - before_filter :add_project_abilities | ||
| 6 | - | ||
| 7 | before_filter :authorize_read_note! | 3 | before_filter :authorize_read_note! |
| 8 | before_filter :authorize_write_note!, only: [:create] | 4 | before_filter :authorize_write_note!, only: [:create] |
| 9 | 5 |
app/controllers/profile_controller.rb
app/controllers/projects_controller.rb
| 1 | require Rails.root.join('lib', 'gitlab', 'graph_commit') | 1 | require Rails.root.join('lib', 'gitlab', 'graph_commit') |
| 2 | 2 | ||
| 3 | -class ProjectsController < ApplicationController | ||
| 4 | - before_filter :project, except: [:index, :new, :create] | ||
| 5 | - layout :determine_layout | 3 | +class ProjectsController < ProjectResourceController |
| 4 | + skip_before_filter :project, only: [:new, :create] | ||
| 6 | 5 | ||
| 7 | # Authorize | 6 | # Authorize |
| 8 | - before_filter :add_project_abilities | ||
| 9 | before_filter :authorize_read_project!, except: [:index, :new, :create] | 7 | before_filter :authorize_read_project!, except: [:index, :new, :create] |
| 10 | before_filter :authorize_admin_project!, only: [:edit, :update, :destroy] | 8 | before_filter :authorize_admin_project!, only: [:edit, :update, :destroy] |
| 11 | before_filter :require_non_empty_project, only: [:blob, :tree, :graph] | 9 | before_filter :require_non_empty_project, only: [:blob, :tree, :graph] |
| 12 | 10 | ||
| 11 | + layout 'application', only: [:new, :create] | ||
| 12 | + | ||
| 13 | def new | 13 | def new |
| 14 | @project = Project.new | 14 | @project = Project.new |
| 15 | end | 15 | end |
| @@ -93,19 +93,4 @@ class ProjectsController < ApplicationController | @@ -93,19 +93,4 @@ class ProjectsController < ApplicationController | ||
| 93 | format.html { redirect_to root_path } | 93 | format.html { redirect_to root_path } |
| 94 | end | 94 | end |
| 95 | end | 95 | end |
| 96 | - | ||
| 97 | - protected | ||
| 98 | - | ||
| 99 | - def project | ||
| 100 | - @project ||= Project.find_by_code(params[:id]) | ||
| 101 | - @project || render_404 | ||
| 102 | - end | ||
| 103 | - | ||
| 104 | - def determine_layout | ||
| 105 | - if @project && !@project.new_record? | ||
| 106 | - "project" | ||
| 107 | - else | ||
| 108 | - "application" | ||
| 109 | - end | ||
| 110 | - end | ||
| 111 | end | 96 | end |
app/controllers/protected_branches_controller.rb
| 1 | -class ProtectedBranchesController < ApplicationController | ||
| 2 | - before_filter :project | ||
| 3 | - | 1 | +class ProtectedBranchesController < ProjectResourceController |
| 4 | # Authorize | 2 | # Authorize |
| 5 | - before_filter :add_project_abilities | ||
| 6 | before_filter :authorize_read_project! | 3 | before_filter :authorize_read_project! |
| 7 | before_filter :require_non_empty_project | 4 | before_filter :require_non_empty_project |
| 8 | 5 | ||
| 9 | before_filter :authorize_admin_project!, only: [:destroy, :create] | 6 | before_filter :authorize_admin_project!, only: [:destroy, :create] |
| 10 | 7 | ||
| 11 | - layout "project" | ||
| 12 | - | ||
| 13 | def index | 8 | def index |
| 14 | @branches = @project.protected_branches.all | 9 | @branches = @project.protected_branches.all |
| 15 | @protected_branch = @project.protected_branches.new | 10 | @protected_branch = @project.protected_branches.new |
app/controllers/refs_controller.rb
| 1 | -class RefsController < ApplicationController | 1 | +class RefsController < ProjectResourceController |
| 2 | include Gitlab::Encode | 2 | include Gitlab::Encode |
| 3 | - before_filter :project | ||
| 4 | 3 | ||
| 5 | # Authorize | 4 | # Authorize |
| 6 | - before_filter :add_project_abilities | ||
| 7 | before_filter :authorize_read_project! | 5 | before_filter :authorize_read_project! |
| 8 | before_filter :authorize_code_access! | 6 | before_filter :authorize_code_access! |
| 9 | before_filter :require_non_empty_project | 7 | before_filter :require_non_empty_project |
| @@ -11,11 +9,9 @@ class RefsController < ApplicationController | @@ -11,11 +9,9 @@ class RefsController < ApplicationController | ||
| 11 | before_filter :ref | 9 | before_filter :ref |
| 12 | before_filter :define_tree_vars, only: [:blob, :logs_tree] | 10 | before_filter :define_tree_vars, only: [:blob, :logs_tree] |
| 13 | 11 | ||
| 14 | - layout "project" | ||
| 15 | - | ||
| 16 | - def switch | ||
| 17 | - respond_to do |format| | ||
| 18 | - format.html do | 12 | + def switch |
| 13 | + respond_to do |format| | ||
| 14 | + format.html do | ||
| 19 | new_path = if params[:destination] == "tree" | 15 | new_path = if params[:destination] == "tree" |
| 20 | project_tree_path(@project, @ref) | 16 | project_tree_path(@project, @ref) |
| 21 | else | 17 | else |
app/controllers/repositories_controller.rb
| 1 | -class RepositoriesController < ApplicationController | ||
| 2 | - before_filter :project | ||
| 3 | - | 1 | +class RepositoriesController < ProjectResourceController |
| 4 | # Authorize | 2 | # Authorize |
| 5 | - before_filter :add_project_abilities | ||
| 6 | before_filter :authorize_read_project! | 3 | before_filter :authorize_read_project! |
| 7 | before_filter :authorize_code_access! | 4 | before_filter :authorize_code_access! |
| 8 | before_filter :require_non_empty_project | 5 | before_filter :require_non_empty_project |
| 9 | 6 | ||
| 10 | - layout "project" | ||
| 11 | - | ||
| 12 | def show | 7 | def show |
| 13 | @activities = @project.commits_with_refs(20) | 8 | @activities = @project.commits_with_refs(20) |
| 14 | end | 9 | end |
app/controllers/snippets_controller.rb
| 1 | -class SnippetsController < ApplicationController | ||
| 2 | - before_filter :project | 1 | +class SnippetsController < ProjectResourceController |
| 3 | before_filter :snippet, only: [:show, :edit, :destroy, :update, :raw] | 2 | before_filter :snippet, only: [:show, :edit, :destroy, :update, :raw] |
| 4 | - layout "project" | ||
| 5 | - | ||
| 6 | - # Authorize | ||
| 7 | - before_filter :add_project_abilities | ||
| 8 | 3 | ||
| 9 | # Allow read any snippet | 4 | # Allow read any snippet |
| 10 | before_filter :authorize_read_snippet! | 5 | before_filter :authorize_read_snippet! |
app/controllers/team_members_controller.rb
| 1 | -class TeamMembersController < ApplicationController | ||
| 2 | - before_filter :project | ||
| 3 | - layout "project" | ||
| 4 | - | 1 | +class TeamMembersController < ProjectResourceController |
| 5 | # Authorize | 2 | # Authorize |
| 6 | - before_filter :add_project_abilities | ||
| 7 | before_filter :authorize_read_project! | 3 | before_filter :authorize_read_project! |
| 8 | before_filter :authorize_admin_project!, except: [:index, :show] | 4 | before_filter :authorize_admin_project!, except: [:index, :show] |
| 9 | 5 |
app/controllers/tree_controller.rb
| 1 | # Controller for viewing a repository's file structure | 1 | # Controller for viewing a repository's file structure |
| 2 | -class TreeController < ApplicationController | 2 | +class TreeController < ProjectResourceController |
| 3 | include ExtractsPath | 3 | include ExtractsPath |
| 4 | 4 | ||
| 5 | - layout "project" | ||
| 6 | - | ||
| 7 | - before_filter :project | ||
| 8 | - | ||
| 9 | # Authorize | 5 | # Authorize |
| 10 | - before_filter :add_project_abilities | ||
| 11 | before_filter :authorize_read_project! | 6 | before_filter :authorize_read_project! |
| 12 | before_filter :authorize_code_access! | 7 | before_filter :authorize_code_access! |
| 13 | before_filter :require_non_empty_project | 8 | before_filter :require_non_empty_project |
app/controllers/wikis_controller.rb
| 1 | -class WikisController < ApplicationController | ||
| 2 | - before_filter :project | ||
| 3 | - before_filter :add_project_abilities | 1 | +class WikisController < ProjectResourceController |
| 4 | before_filter :authorize_read_wiki! | 2 | before_filter :authorize_read_wiki! |
| 5 | before_filter :authorize_write_wiki!, only: [:edit, :create, :history] | 3 | before_filter :authorize_write_wiki!, only: [:edit, :create, :history] |
| 6 | before_filter :authorize_admin_wiki!, only: :destroy | 4 | before_filter :authorize_admin_wiki!, only: :destroy |
| 7 | - layout "project" | ||
| 8 | 5 | ||
| 9 | def pages | 6 | def pages |
| 10 | @wikis = @project.wikis.group(:slug).order("created_at") | 7 | @wikis = @project.wikis.group(:slug).order("created_at") |
app/views/layouts/error.html.haml
app/views/layouts/project.html.haml
| @@ -1,41 +0,0 @@ | @@ -1,41 +0,0 @@ | ||
| 1 | -!!! 5 | ||
| 2 | -%html{ lang: "en"} | ||
| 3 | - = render "layouts/head" | ||
| 4 | - %body{class: "#{app_theme} project"} | ||
| 5 | - = render "layouts/flash" | ||
| 6 | - = render "layouts/head_panel", title: @project.name | ||
| 7 | - .container | ||
| 8 | - %ul.main_menu | ||
| 9 | - = nav_link(html_options: {class: "home #{project_tab_class}"}) do | ||
| 10 | - = link_to @project.code, project_path(@project), title: "Project" | ||
| 11 | - | ||
| 12 | - - if @project.repo_exists? | ||
| 13 | - - if can? current_user, :download_code, @project | ||
| 14 | - = nav_link(controller: %w(tree blob blame)) do | ||
| 15 | - = link_to 'Files', project_tree_path(@project, @ref || @project.root_ref) | ||
| 16 | - = nav_link(controller: %w(commit commits compare repositories protected_branches)) do | ||
| 17 | - = link_to "Commits", project_commits_path(@project, @ref || @project.root_ref) | ||
| 18 | - = nav_link(path: 'projects#graph') do | ||
| 19 | - = link_to "Network", graph_project_path(@project) | ||
| 20 | - | ||
| 21 | - - if @project.issues_enabled | ||
| 22 | - = nav_link(controller: %w(issues milestones labels)) do | ||
| 23 | - = link_to project_issues_filter_path(@project) do | ||
| 24 | - Issues | ||
| 25 | - %span.count.issue_counter= @project.issues.opened.count | ||
| 26 | - | ||
| 27 | - - if @project.repo_exists? && @project.merge_requests_enabled | ||
| 28 | - = nav_link(controller: :merge_requests) do | ||
| 29 | - = link_to project_merge_requests_path(@project) do | ||
| 30 | - Merge Requests | ||
| 31 | - %span.count.merge_counter= @project.merge_requests.opened.count | ||
| 32 | - | ||
| 33 | - - if @project.wall_enabled | ||
| 34 | - = nav_link(path: 'projects#wall') do | ||
| 35 | - = link_to 'Wall', wall_project_path(@project) | ||
| 36 | - | ||
| 37 | - - if @project.wiki_enabled | ||
| 38 | - = nav_link(controller: :wikis) do | ||
| 39 | - = link_to 'Wiki', project_wiki_path(@project, :index) | ||
| 40 | - | ||
| 41 | - .content= yield |
| @@ -0,0 +1,41 @@ | @@ -0,0 +1,41 @@ | ||
| 1 | +!!! 5 | ||
| 2 | +%html{ lang: "en"} | ||
| 3 | + = render "layouts/head" | ||
| 4 | + %body{class: "#{app_theme} project"} | ||
| 5 | + = render "layouts/flash" | ||
| 6 | + = render "layouts/head_panel", title: @project.name | ||
| 7 | + .container | ||
| 8 | + %ul.main_menu | ||
| 9 | + = nav_link(html_options: {class: "home #{project_tab_class}"}) do | ||
| 10 | + = link_to @project.code, project_path(@project), title: "Project" | ||
| 11 | + | ||
| 12 | + - if @project.repo_exists? | ||
| 13 | + - if can? current_user, :download_code, @project | ||
| 14 | + = nav_link(controller: %w(tree blob blame)) do | ||
| 15 | + = link_to 'Files', project_tree_path(@project, @ref || @project.root_ref) | ||
| 16 | + = nav_link(controller: %w(commit commits compare repositories protected_branches)) do | ||
| 17 | + = link_to "Commits", project_commits_path(@project, @ref || @project.root_ref) | ||
| 18 | + = nav_link(path: 'projects#graph') do | ||
| 19 | + = link_to "Network", graph_project_path(@project) | ||
| 20 | + | ||
| 21 | + - if @project.issues_enabled | ||
| 22 | + = nav_link(controller: %w(issues milestones labels)) do | ||
| 23 | + = link_to project_issues_filter_path(@project) do | ||
| 24 | + Issues | ||
| 25 | + %span.count.issue_counter= @project.issues.opened.count | ||
| 26 | + | ||
| 27 | + - if @project.repo_exists? && @project.merge_requests_enabled | ||
| 28 | + = nav_link(controller: :merge_requests) do | ||
| 29 | + = link_to project_merge_requests_path(@project) do | ||
| 30 | + Merge Requests | ||
| 31 | + %span.count.merge_counter= @project.merge_requests.opened.count | ||
| 32 | + | ||
| 33 | + - if @project.wall_enabled | ||
| 34 | + = nav_link(path: 'projects#wall') do | ||
| 35 | + = link_to 'Wall', wall_project_path(@project) | ||
| 36 | + | ||
| 37 | + - if @project.wiki_enabled | ||
| 38 | + = nav_link(controller: :wikis) do | ||
| 39 | + = link_to 'Wiki', project_wiki_path(@project, :index) | ||
| 40 | + | ||
| 41 | + .content= yield |
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 |