Commit be18397d82ca16fefed7287c8078a9b41bf37c95

Authored by Cyril
1 parent 933c5e41

rename ProjectController to ProjectResourceController

app/controllers/blame_controller.rb
1 1 # Controller for viewing a file's blame
2   -class BlameController < ProjectController
  2 +class BlameController < ProjectResourceController
3 3 include ExtractsPath
4 4  
5 5 # Authorize
... ...
app/controllers/blob_controller.rb
1 1 # Controller for viewing a file's blame
2   -class BlobController < ProjectController
  2 +class BlobController < ProjectResourceController
3 3 include ExtractsPath
4 4 include Gitlab::Encode
5 5  
... ...
app/controllers/commit_controller.rb
1 1 # Controller for a specific Commit
2 2 #
3 3 # Not to be confused with CommitsController, plural.
4   -class CommitController < ProjectController
  4 +class CommitController < ProjectResourceController
5 5 # Authorize
6 6 before_filter :authorize_read_project!
7 7 before_filter :authorize_code_access!
... ...
app/controllers/commits_controller.rb
1 1 require "base64"
2 2  
3   -class CommitsController < ProjectController
  3 +class CommitsController < ProjectResourceController
4 4 include ExtractsPath
5 5  
6 6 # Authorize
... ...
app/controllers/compare_controller.rb
1   -class CompareController < ProjectController
  1 +class CompareController < ProjectResourceController
2 2 # Authorize
3 3 before_filter :authorize_read_project!
4 4 before_filter :authorize_code_access!
... ...
app/controllers/deploy_keys_controller.rb
1   -class DeployKeysController < ProjectController
  1 +class DeployKeysController < ProjectResourceController
2 2 respond_to :html
3 3  
4 4 # Authorize
... ...
app/controllers/hooks_controller.rb
1   -class HooksController < ProjectController
  1 +class HooksController < ProjectResourceController
2 2 # Authorize
3 3 before_filter :authorize_read_project!
4 4 before_filter :authorize_admin_project!, only: [:new, :create, :destroy]
... ...
app/controllers/issues_controller.rb
1   -class IssuesController < ProjectController
  1 +class IssuesController < ProjectResourceController
2 2 before_filter :module_enabled
3 3 before_filter :issue, only: [:edit, :update, :destroy, :show]
4 4 helper_method :issues_filter
... ...
app/controllers/labels_controller.rb
1   -class LabelsController < ProjectController
  1 +class LabelsController < ProjectResourceController
2 2 before_filter :module_enabled
3 3  
4 4 # Allow read any issue
... ...
app/controllers/merge_requests_controller.rb
1   -class MergeRequestsController < ProjectController
  1 +class MergeRequestsController < ProjectResourceController
2 2 before_filter :module_enabled
3 3 before_filter :merge_request, only: [:edit, :update, :destroy, :show, :commits, :diffs, :automerge, :automerge_check, :raw]
4 4 before_filter :validates_merge_request, only: [:show, :diffs, :raw]
... ...
app/controllers/milestones_controller.rb
1   -class MilestonesController < ProjectController
  1 +class MilestonesController < ProjectResourceController
2 2 before_filter :module_enabled
3 3 before_filter :milestone, only: [:edit, :update, :destroy, :show]
4 4  
... ...
app/controllers/notes_controller.rb
1   -class NotesController < ProjectController
  1 +class NotesController < ProjectResourceController
2 2 # Authorize
3 3 before_filter :authorize_read_note!
4 4 before_filter :authorize_write_note!, only: [:create]
... ...
app/controllers/project_controller.rb
... ... @@ -1,5 +0,0 @@
1   -class ProjectController < ApplicationController
2   - before_filter :project
3   - # Authorize
4   - before_filter :add_project_abilities
5   -end
app/controllers/project_resource_controller.rb 0 → 100644
... ... @@ -0,0 +1,5 @@
  1 +class ProjectResourceController < ApplicationController
  2 + before_filter :project
  3 + # Authorize
  4 + before_filter :add_project_abilities
  5 +end
... ...
app/controllers/projects_controller.rb
1 1 require Rails.root.join('lib', 'gitlab', 'graph_commit')
2 2  
3   -class ProjectsController < ProjectController
  3 +class ProjectsController < ProjectResourceController
4 4 skip_before_filter :project, only: [:new, :create]
5 5  
6 6 # Authorize
... ...
app/controllers/protected_branches_controller.rb
1   -class ProtectedBranchesController < ProjectController
  1 +class ProtectedBranchesController < ProjectResourceController
2 2 # Authorize
3 3 before_filter :authorize_read_project!
4 4 before_filter :require_non_empty_project
... ...
app/controllers/refs_controller.rb
1   -class RefsController < ProjectController
  1 +class RefsController < ProjectResourceController
2 2 include Gitlab::Encode
3 3  
4 4 # Authorize
... ...
app/controllers/repositories_controller.rb
1   -class RepositoriesController < ProjectController
  1 +class RepositoriesController < ProjectResourceController
2 2 # Authorize
3 3 before_filter :authorize_read_project!
4 4 before_filter :authorize_code_access!
... ...
app/controllers/snippets_controller.rb
1   -class SnippetsController < ProjectController
  1 +class SnippetsController < ProjectResourceController
2 2 before_filter :snippet, only: [:show, :edit, :destroy, :update, :raw]
3 3  
4 4 # Allow read any snippet
... ...
app/controllers/team_members_controller.rb
1   -class TeamMembersController < ProjectController
  1 +class TeamMembersController < ProjectResourceController
2 2 # Authorize
3 3 before_filter :authorize_read_project!
4 4 before_filter :authorize_admin_project!, except: [:index, :show]
... ...
app/controllers/tree_controller.rb
1 1 # Controller for viewing a repository's file structure
2   -class TreeController < ProjectController
  2 +class TreeController < ProjectResourceController
3 3 include ExtractsPath
4 4  
5 5 # Authorize
... ...
app/controllers/wikis_controller.rb
1   -class WikisController < ProjectController
  1 +class WikisController < ProjectResourceController
2 2 before_filter :authorize_read_wiki!
3 3 before_filter :authorize_write_wiki!, only: [:edit, :create, :history]
4 4 before_filter :authorize_admin_wiki!, only: :destroy
... ...
app/views/layouts/project.html.haml
... ... @@ -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
app/views/layouts/project_resource.html.haml 0 → 100644
... ... @@ -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
... ...