Commit e55e23bbda6f6a95982109bc46e48a5550e4c181
Exists in
master
and in
4 other branches
Merge branch 'refactor/projects_controllers' of /home/git/repositories/gitlab/gitlabhq into 6-0-dev
Showing
336 changed files
with
4267 additions
and
4270 deletions
Show diff stats
Too many changes.
To preserve performance only 100 of 336 files displayed.
app/assets/javascripts/dispatcher.js.coffee
@@ -18,19 +18,19 @@ class Dispatcher | @@ -18,19 +18,19 @@ class Dispatcher | ||
18 | path = page.split(':') | 18 | path = page.split(':') |
19 | 19 | ||
20 | switch page | 20 | switch page |
21 | - when 'issues:index' | 21 | + when 'projects:issues:index' |
22 | Issues.init() | 22 | Issues.init() |
23 | when 'dashboard:show' | 23 | when 'dashboard:show' |
24 | new Dashboard() | 24 | new Dashboard() |
25 | - when 'commit:show' | 25 | + when 'projects:commit:show' |
26 | new Commit() | 26 | new Commit() |
27 | - when 'groups:show', 'teams:show', 'projects:show' | 27 | + when 'groups:show', 'projects:show' |
28 | Pager.init(20, true) | 28 | Pager.init(20, true) |
29 | when 'projects:new', 'projects:edit' | 29 | when 'projects:new', 'projects:edit' |
30 | new Project() | 30 | new Project() |
31 | - when 'walls:show' | 31 | + when 'projects:walls:show' |
32 | new Wall(project_id) | 32 | new Wall(project_id) |
33 | - when 'teams:members:index' | 33 | + when 'projects:teams:members:index' |
34 | new TeamMembers() | 34 | new TeamMembers() |
35 | when 'groups:people' | 35 | when 'groups:people' |
36 | new GroupMembers() | 36 | new GroupMembers() |
app/controllers/blame_controller.rb
@@ -1,14 +0,0 @@ | @@ -1,14 +0,0 @@ | ||
1 | -# Controller for viewing a file's blame | ||
2 | -class BlameController < ProjectResourceController | ||
3 | - include ExtractsPath | ||
4 | - | ||
5 | - # Authorize | ||
6 | - before_filter :authorize_read_project! | ||
7 | - before_filter :authorize_code_access! | ||
8 | - before_filter :require_non_empty_project | ||
9 | - | ||
10 | - def show | ||
11 | - @blob = Gitlab::Git::Blob.new(@repository, @commit.id, @ref, @path) | ||
12 | - @blame = Gitlab::Git::Blame.new(project.repository, @commit.id, @path) | ||
13 | - end | ||
14 | -end |
app/controllers/blob_controller.rb
@@ -1,13 +0,0 @@ | @@ -1,13 +0,0 @@ | ||
1 | -# Controller for viewing a file's blame | ||
2 | -class BlobController < ProjectResourceController | ||
3 | - include ExtractsPath | ||
4 | - | ||
5 | - # Authorize | ||
6 | - before_filter :authorize_read_project! | ||
7 | - before_filter :authorize_code_access! | ||
8 | - before_filter :require_non_empty_project | ||
9 | - | ||
10 | - def show | ||
11 | - @blob = Gitlab::Git::Blob.new(@repository, @commit.id, @ref, @path) | ||
12 | - end | ||
13 | -end |
app/controllers/commit_controller.rb
@@ -1,43 +0,0 @@ | @@ -1,43 +0,0 @@ | ||
1 | -# Controller for a specific Commit | ||
2 | -# | ||
3 | -# Not to be confused with CommitsController, plural. | ||
4 | -class CommitController < ProjectResourceController | ||
5 | - # Authorize | ||
6 | - before_filter :authorize_read_project! | ||
7 | - before_filter :authorize_code_access! | ||
8 | - before_filter :require_non_empty_project | ||
9 | - | ||
10 | - def show | ||
11 | - result = CommitLoadContext.new(project, current_user, params).execute | ||
12 | - | ||
13 | - @commit = result[:commit] | ||
14 | - | ||
15 | - if @commit.nil? | ||
16 | - git_not_found! | ||
17 | - return | ||
18 | - end | ||
19 | - | ||
20 | - @suppress_diff = result[:suppress_diff] | ||
21 | - | ||
22 | - @note = result[:note] | ||
23 | - @line_notes = result[:line_notes] | ||
24 | - @notes_count = result[:notes_count] | ||
25 | - @target_type = :commit | ||
26 | - @target_id = @commit.id | ||
27 | - | ||
28 | - @comments_allowed = @reply_allowed = true | ||
29 | - @comments_target = { noteable_type: 'Commit', | ||
30 | - commit_id: @commit.id } | ||
31 | - | ||
32 | - respond_to do |format| | ||
33 | - format.html do | ||
34 | - if result[:status] == :huge_commit | ||
35 | - render "huge_commit" and return | ||
36 | - end | ||
37 | - end | ||
38 | - | ||
39 | - format.diff { render text: @commit.to_diff } | ||
40 | - format.patch { render text: @commit.to_patch } | ||
41 | - end | ||
42 | - end | ||
43 | -end |
app/controllers/commits_controller.rb
@@ -1,23 +0,0 @@ | @@ -1,23 +0,0 @@ | ||
1 | -require "base64" | ||
2 | - | ||
3 | -class CommitsController < ProjectResourceController | ||
4 | - include ExtractsPath | ||
5 | - | ||
6 | - # Authorize | ||
7 | - before_filter :authorize_read_project! | ||
8 | - before_filter :authorize_code_access! | ||
9 | - before_filter :require_non_empty_project | ||
10 | - | ||
11 | - def show | ||
12 | - @repo = @project.repository | ||
13 | - @limit, @offset = (params[:limit] || 40), (params[:offset] || 0) | ||
14 | - | ||
15 | - @commits = @repo.commits(@ref, @path, @limit, @offset) | ||
16 | - | ||
17 | - respond_to do |format| | ||
18 | - format.html # index.html.erb | ||
19 | - format.js | ||
20 | - format.atom { render layout: false } | ||
21 | - end | ||
22 | - end | ||
23 | -end |
app/controllers/compare_controller.rb
@@ -1,23 +0,0 @@ | @@ -1,23 +0,0 @@ | ||
1 | -class CompareController < ProjectResourceController | ||
2 | - # Authorize | ||
3 | - before_filter :authorize_read_project! | ||
4 | - before_filter :authorize_code_access! | ||
5 | - before_filter :require_non_empty_project | ||
6 | - | ||
7 | - def index | ||
8 | - end | ||
9 | - | ||
10 | - def show | ||
11 | - compare = Gitlab::Git::Compare.new(project.repository, params[:from], params[:to]) | ||
12 | - | ||
13 | - @commits = compare.commits | ||
14 | - @commit = compare.commit | ||
15 | - @diffs = compare.diffs | ||
16 | - @refs_are_same = compare.same | ||
17 | - @line_notes = [] | ||
18 | - end | ||
19 | - | ||
20 | - def create | ||
21 | - redirect_to project_compare_path(@project, params[:from], params[:to]) | ||
22 | - end | ||
23 | -end |
app/controllers/deploy_keys_controller.rb
@@ -1,61 +0,0 @@ | @@ -1,61 +0,0 @@ | ||
1 | -class DeployKeysController < ProjectResourceController | ||
2 | - respond_to :html | ||
3 | - | ||
4 | - # Authorize | ||
5 | - before_filter :authorize_admin_project! | ||
6 | - | ||
7 | - layout "project_settings" | ||
8 | - | ||
9 | - def index | ||
10 | - @enabled_keys = @project.deploy_keys.all | ||
11 | - @available_keys = available_keys - @enabled_keys | ||
12 | - end | ||
13 | - | ||
14 | - def show | ||
15 | - @key = @project.deploy_keys.find(params[:id]) | ||
16 | - end | ||
17 | - | ||
18 | - def new | ||
19 | - @key = @project.deploy_keys.new | ||
20 | - | ||
21 | - respond_with(@key) | ||
22 | - end | ||
23 | - | ||
24 | - def create | ||
25 | - @key = DeployKey.new(params[:deploy_key]) | ||
26 | - | ||
27 | - if @key.valid? && @project.deploy_keys << @key | ||
28 | - redirect_to project_deploy_keys_path(@project) | ||
29 | - else | ||
30 | - render "new" | ||
31 | - end | ||
32 | - end | ||
33 | - | ||
34 | - def destroy | ||
35 | - @key = @project.deploy_keys.find(params[:id]) | ||
36 | - @key.destroy | ||
37 | - | ||
38 | - respond_to do |format| | ||
39 | - format.html { redirect_to project_deploy_keys_url } | ||
40 | - format.js { render nothing: true } | ||
41 | - end | ||
42 | - end | ||
43 | - | ||
44 | - def enable | ||
45 | - project.deploy_keys << available_keys.find(params[:id]) | ||
46 | - | ||
47 | - redirect_to project_deploy_keys_path(@project) | ||
48 | - end | ||
49 | - | ||
50 | - def disable | ||
51 | - @project.deploy_keys_projects.where(deploy_key_id: params[:id]).last.destroy | ||
52 | - | ||
53 | - redirect_to project_deploy_keys_path(@project) | ||
54 | - end | ||
55 | - | ||
56 | - protected | ||
57 | - | ||
58 | - def available_keys | ||
59 | - @available_keys ||= current_user.accessible_deploy_keys | ||
60 | - end | ||
61 | -end |
app/controllers/edit_tree_controller.rb
@@ -1,49 +0,0 @@ | @@ -1,49 +0,0 @@ | ||
1 | -# Controller for edit a repository's file | ||
2 | -class EditTreeController < ProjectResourceController | ||
3 | - include ExtractsPath | ||
4 | - | ||
5 | - # Authorize | ||
6 | - before_filter :authorize_read_project! | ||
7 | - before_filter :authorize_code_access! | ||
8 | - before_filter :require_non_empty_project | ||
9 | - | ||
10 | - before_filter :edit_requirements, only: [:show, :update] | ||
11 | - | ||
12 | - def show | ||
13 | - @last_commit = @project.repository.last_commit_for(@ref, @path).sha | ||
14 | - end | ||
15 | - | ||
16 | - def update | ||
17 | - edit_file_action = Gitlab::Satellite::EditFileAction.new(current_user, @project, @ref, @path) | ||
18 | - updated_successfully = edit_file_action.commit!( | ||
19 | - params[:content], | ||
20 | - params[:commit_message], | ||
21 | - params[:last_commit] | ||
22 | - ) | ||
23 | - | ||
24 | - if updated_successfully | ||
25 | - redirect_to project_blob_path(@project, @id), notice: "Your changes have been successfully commited" | ||
26 | - else | ||
27 | - flash[:notice] = "Your changes could not be commited, because the file has been changed" | ||
28 | - render :show | ||
29 | - end | ||
30 | - end | ||
31 | - | ||
32 | - private | ||
33 | - | ||
34 | - def edit_requirements | ||
35 | - @blob = Gitlab::Git::Blob.new(@repository, @commit.id, @ref, @path) | ||
36 | - | ||
37 | - unless @blob.exists? && @blob.text? | ||
38 | - redirect_to project_blob_path(@project, @id), notice: "You can only edit text files" | ||
39 | - end | ||
40 | - | ||
41 | - allowed = if project.protected_branch? @ref | ||
42 | - can?(current_user, :push_code_to_protected_branches, project) | ||
43 | - else | ||
44 | - can?(current_user, :push_code, project) | ||
45 | - end | ||
46 | - | ||
47 | - return access_denied! unless allowed | ||
48 | - end | ||
49 | -end |
app/controllers/graphs_controller.rb
@@ -1,17 +0,0 @@ | @@ -1,17 +0,0 @@ | ||
1 | -class GraphsController < ProjectResourceController | ||
2 | - # Authorize | ||
3 | - before_filter :authorize_read_project! | ||
4 | - before_filter :authorize_code_access! | ||
5 | - before_filter :require_non_empty_project | ||
6 | - | ||
7 | - def show | ||
8 | - respond_to do |format| | ||
9 | - format.html | ||
10 | - format.js do | ||
11 | - @repo = @project.repository | ||
12 | - @stats = Gitlab::Git::GitStats.new(@repo.raw, @repo.root_ref) | ||
13 | - @log = @stats.parsed_log.to_json rescue [] | ||
14 | - end | ||
15 | - end | ||
16 | - end | ||
17 | -end |
app/controllers/hooks_controller.rb
@@ -1,39 +0,0 @@ | @@ -1,39 +0,0 @@ | ||
1 | -class HooksController < ProjectResourceController | ||
2 | - # Authorize | ||
3 | - before_filter :authorize_read_project! | ||
4 | - before_filter :authorize_admin_project!, only: [:new, :create, :destroy] | ||
5 | - | ||
6 | - respond_to :html | ||
7 | - | ||
8 | - layout "project_settings" | ||
9 | - | ||
10 | - def index | ||
11 | - @hooks = @project.hooks.all | ||
12 | - @hook = ProjectHook.new | ||
13 | - end | ||
14 | - | ||
15 | - def create | ||
16 | - @hook = @project.hooks.new(params[:hook]) | ||
17 | - @hook.save | ||
18 | - | ||
19 | - if @hook.valid? | ||
20 | - redirect_to project_hooks_path(@project) | ||
21 | - else | ||
22 | - @hooks = @project.hooks.all | ||
23 | - render :index | ||
24 | - end | ||
25 | - end | ||
26 | - | ||
27 | - def test | ||
28 | - TestHookContext.new(project, current_user, params).execute | ||
29 | - | ||
30 | - redirect_to :back | ||
31 | - end | ||
32 | - | ||
33 | - def destroy | ||
34 | - @hook = @project.hooks.find(params[:id]) | ||
35 | - @hook.destroy | ||
36 | - | ||
37 | - redirect_to project_hooks_path(@project) | ||
38 | - end | ||
39 | -end |
app/controllers/issues_controller.rb
@@ -1,114 +0,0 @@ | @@ -1,114 +0,0 @@ | ||
1 | -class IssuesController < ProjectResourceController | ||
2 | - before_filter :module_enabled | ||
3 | - before_filter :issue, only: [:edit, :update, :show] | ||
4 | - | ||
5 | - # Allow read any issue | ||
6 | - before_filter :authorize_read_issue! | ||
7 | - | ||
8 | - # Allow write(create) issue | ||
9 | - before_filter :authorize_write_issue!, only: [:new, :create] | ||
10 | - | ||
11 | - # Allow modify issue | ||
12 | - before_filter :authorize_modify_issue!, only: [:edit, :update] | ||
13 | - | ||
14 | - respond_to :js, :html | ||
15 | - | ||
16 | - def index | ||
17 | - terms = params['issue_search'] | ||
18 | - | ||
19 | - @issues = issues_filtered | ||
20 | - @issues = @issues.where("title LIKE ?", "%#{terms}%") if terms.present? | ||
21 | - @issues = @issues.page(params[:page]).per(20) | ||
22 | - | ||
23 | - | ||
24 | - assignee_id, milestone_id = params[:assignee_id], params[:milestone_id] | ||
25 | - | ||
26 | - @assignee = @project.team.find(assignee_id) if assignee_id.present? && !assignee_id.to_i.zero? | ||
27 | - @milestone = @project.milestones.find(milestone_id) if milestone_id.present? && !milestone_id.to_i.zero? | ||
28 | - | ||
29 | - respond_to do |format| | ||
30 | - format.html # index.html.erb | ||
31 | - format.js | ||
32 | - format.atom { render layout: false } | ||
33 | - end | ||
34 | - end | ||
35 | - | ||
36 | - def new | ||
37 | - @issue = @project.issues.new(params[:issue]) | ||
38 | - respond_with(@issue) | ||
39 | - end | ||
40 | - | ||
41 | - def edit | ||
42 | - respond_with(@issue) | ||
43 | - end | ||
44 | - | ||
45 | - def show | ||
46 | - @note = @project.notes.new(noteable: @issue) | ||
47 | - @target_type = :issue | ||
48 | - @target_id = @issue.id | ||
49 | - | ||
50 | - respond_to do |format| | ||
51 | - format.html | ||
52 | - format.js | ||
53 | - end | ||
54 | - end | ||
55 | - | ||
56 | - def create | ||
57 | - @issue = @project.issues.new(params[:issue]) | ||
58 | - @issue.author = current_user | ||
59 | - @issue.save | ||
60 | - | ||
61 | - respond_to do |format| | ||
62 | - format.html do | ||
63 | - if @issue.valid? | ||
64 | - redirect_to project_issue_path(@project, @issue) | ||
65 | - else | ||
66 | - render :new | ||
67 | - end | ||
68 | - end | ||
69 | - format.js | ||
70 | - end | ||
71 | - end | ||
72 | - | ||
73 | - def update | ||
74 | - @issue.update_attributes(params[:issue].merge(author_id_of_changes: current_user.id)) | ||
75 | - | ||
76 | - respond_to do |format| | ||
77 | - format.js | ||
78 | - format.html do | ||
79 | - if @issue.valid? | ||
80 | - redirect_to [@project, @issue] | ||
81 | - else | ||
82 | - render :edit | ||
83 | - end | ||
84 | - end | ||
85 | - end | ||
86 | - end | ||
87 | - | ||
88 | - def bulk_update | ||
89 | - result = Issues::BulkUpdateContext.new(project, current_user, params).execute | ||
90 | - redirect_to :back, notice: "#{result[:count]} issues updated" | ||
91 | - end | ||
92 | - | ||
93 | - protected | ||
94 | - | ||
95 | - def issue | ||
96 | - @issue ||= @project.issues.find(params[:id]) | ||
97 | - end | ||
98 | - | ||
99 | - def authorize_modify_issue! | ||
100 | - return render_404 unless can?(current_user, :modify_issue, @issue) | ||
101 | - end | ||
102 | - | ||
103 | - def authorize_admin_issue! | ||
104 | - return render_404 unless can?(current_user, :admin_issue, @issue) | ||
105 | - end | ||
106 | - | ||
107 | - def module_enabled | ||
108 | - return render_404 unless @project.issues_enabled | ||
109 | - end | ||
110 | - | ||
111 | - def issues_filtered | ||
112 | - @issues = Issues::ListContext.new(project, current_user, params).execute | ||
113 | - end | ||
114 | -end |
app/controllers/labels_controller.rb
@@ -1,24 +0,0 @@ | @@ -1,24 +0,0 @@ | ||
1 | -class LabelsController < ProjectResourceController | ||
2 | - before_filter :module_enabled | ||
3 | - | ||
4 | - # Allow read any issue | ||
5 | - before_filter :authorize_read_issue! | ||
6 | - | ||
7 | - respond_to :js, :html | ||
8 | - | ||
9 | - def index | ||
10 | - @labels = @project.issues_labels | ||
11 | - end | ||
12 | - | ||
13 | - def generate | ||
14 | - Gitlab::IssuesLabels.generate(@project) | ||
15 | - | ||
16 | - redirect_to project_labels_path(@project) | ||
17 | - end | ||
18 | - | ||
19 | - protected | ||
20 | - | ||
21 | - def module_enabled | ||
22 | - return render_404 unless @project.issues_enabled | ||
23 | - end | ||
24 | -end |
app/controllers/merge_requests_controller.rb
@@ -1,163 +0,0 @@ | @@ -1,163 +0,0 @@ | ||
1 | -require 'gitlab/satellite/satellite' | ||
2 | - | ||
3 | -class MergeRequestsController < ProjectResourceController | ||
4 | - before_filter :module_enabled | ||
5 | - before_filter :merge_request, only: [:edit, :update, :show, :commits, :diffs, :automerge, :automerge_check, :ci_status] | ||
6 | - before_filter :validates_merge_request, only: [:show, :diffs] | ||
7 | - before_filter :define_show_vars, only: [:show, :diffs] | ||
8 | - | ||
9 | - # Allow read any merge_request | ||
10 | - before_filter :authorize_read_merge_request! | ||
11 | - | ||
12 | - # Allow write(create) merge_request | ||
13 | - before_filter :authorize_write_merge_request!, only: [:new, :create] | ||
14 | - | ||
15 | - # Allow modify merge_request | ||
16 | - before_filter :authorize_modify_merge_request!, only: [:close, :edit, :update, :sort] | ||
17 | - | ||
18 | - def index | ||
19 | - @merge_requests = MergeRequestsLoadContext.new(project, current_user, params).execute | ||
20 | - end | ||
21 | - | ||
22 | - def show | ||
23 | - respond_to do |format| | ||
24 | - format.html | ||
25 | - format.js | ||
26 | - | ||
27 | - format.diff { render text: @merge_request.to_diff } | ||
28 | - format.patch { render text: @merge_request.to_patch } | ||
29 | - end | ||
30 | - end | ||
31 | - | ||
32 | - def diffs | ||
33 | - @diffs = @merge_request.diffs | ||
34 | - @commit = @merge_request.last_commit | ||
35 | - | ||
36 | - @comments_allowed = @reply_allowed = true | ||
37 | - @comments_target = { noteable_type: 'MergeRequest', | ||
38 | - noteable_id: @merge_request.id } | ||
39 | - @line_notes = @merge_request.notes.where("line_code is not null") | ||
40 | - end | ||
41 | - | ||
42 | - def new | ||
43 | - @merge_request = @project.merge_requests.new(params[:merge_request]) | ||
44 | - end | ||
45 | - | ||
46 | - def edit | ||
47 | - end | ||
48 | - | ||
49 | - def create | ||
50 | - @merge_request = @project.merge_requests.new(params[:merge_request]) | ||
51 | - @merge_request.author = current_user | ||
52 | - | ||
53 | - if @merge_request.save | ||
54 | - @merge_request.reload_code | ||
55 | - redirect_to [@project, @merge_request], notice: 'Merge request was successfully created.' | ||
56 | - else | ||
57 | - render "new" | ||
58 | - end | ||
59 | - end | ||
60 | - | ||
61 | - def update | ||
62 | - if @merge_request.update_attributes(params[:merge_request].merge(author_id_of_changes: current_user.id)) | ||
63 | - @merge_request.reload_code | ||
64 | - @merge_request.mark_as_unchecked | ||
65 | - redirect_to [@project, @merge_request], notice: 'Merge request was successfully updated.' | ||
66 | - else | ||
67 | - render "edit" | ||
68 | - end | ||
69 | - end | ||
70 | - | ||
71 | - def automerge_check | ||
72 | - if @merge_request.unchecked? | ||
73 | - @merge_request.check_if_can_be_merged | ||
74 | - end | ||
75 | - render json: {merge_status: @merge_request.merge_status_name} | ||
76 | - rescue Gitlab::SatelliteNotExistError | ||
77 | - render json: {merge_status: :no_satellite} | ||
78 | - end | ||
79 | - | ||
80 | - def automerge | ||
81 | - return access_denied! unless allowed_to_merge? | ||
82 | - | ||
83 | - if @merge_request.opened? && @merge_request.can_be_merged? | ||
84 | - @merge_request.should_remove_source_branch = params[:should_remove_source_branch] | ||
85 | - @merge_request.automerge!(current_user) | ||
86 | - @status = true | ||
87 | - else | ||
88 | - @status = false | ||
89 | - end | ||
90 | - end | ||
91 | - | ||
92 | - def branch_from | ||
93 | - @commit = @repository.commit(params[:ref]) | ||
94 | - end | ||
95 | - | ||
96 | - def branch_to | ||
97 | - @commit = @repository.commit(params[:ref]) | ||
98 | - end | ||
99 | - | ||
100 | - def ci_status | ||
101 | - status = project.gitlab_ci_service.commit_status(merge_request.last_commit.sha) | ||
102 | - response = { status: status } | ||
103 | - | ||
104 | - render json: response | ||
105 | - end | ||
106 | - | ||
107 | - protected | ||
108 | - | ||
109 | - def merge_request | ||
110 | - @merge_request ||= @project.merge_requests.find(params[:id]) | ||
111 | - end | ||
112 | - | ||
113 | - def authorize_modify_merge_request! | ||
114 | - return render_404 unless can?(current_user, :modify_merge_request, @merge_request) | ||
115 | - end | ||
116 | - | ||
117 | - def authorize_admin_merge_request! | ||
118 | - return render_404 unless can?(current_user, :admin_merge_request, @merge_request) | ||
119 | - end | ||
120 | - | ||
121 | - def module_enabled | ||
122 | - return render_404 unless @project.merge_requests_enabled | ||
123 | - end | ||
124 | - | ||
125 | - def validates_merge_request | ||
126 | - # Show git not found page if target branch doesn't exist | ||
127 | - return invalid_mr unless @project.repository.branch_names.include?(@merge_request.target_branch) | ||
128 | - | ||
129 | - # Show git not found page if source branch doesn't exist | ||
130 | - # and there is no saved commits between source & target branch | ||
131 | - return invalid_mr if !@project.repository.branch_names.include?(@merge_request.source_branch) && @merge_request.commits.blank? | ||
132 | - end | ||
133 | - | ||
134 | - def define_show_vars | ||
135 | - # Build a note object for comment form | ||
136 | - @note = @project.notes.new(noteable: @merge_request) | ||
137 | - | ||
138 | - # Get commits from repository | ||
139 | - # or from cache if already merged | ||
140 | - @commits = @merge_request.commits | ||
141 | - | ||
142 | - @allowed_to_merge = allowed_to_merge? | ||
143 | - @show_merge_controls = @merge_request.opened? && @commits.any? && @allowed_to_merge | ||
144 | - | ||
145 | - @target_type = :merge_request | ||
146 | - @target_id = @merge_request.id | ||
147 | - end | ||
148 | - | ||
149 | - def allowed_to_merge? | ||
150 | - action = if project.protected_branch?(@merge_request.target_branch) | ||
151 | - :push_code_to_protected_branches | ||
152 | - else | ||
153 | - :push_code | ||
154 | - end | ||
155 | - | ||
156 | - can?(current_user, action, @project) | ||
157 | - end | ||
158 | - | ||
159 | - def invalid_mr | ||
160 | - # Render special view for MR with removed source or target branch | ||
161 | - render 'invalid' | ||
162 | - end | ||
163 | -end |
app/controllers/milestones_controller.rb
@@ -1,94 +0,0 @@ | @@ -1,94 +0,0 @@ | ||
1 | -class MilestonesController < ProjectResourceController | ||
2 | - before_filter :module_enabled | ||
3 | - before_filter :milestone, only: [:edit, :update, :destroy, :show] | ||
4 | - | ||
5 | - # Allow read any milestone | ||
6 | - before_filter :authorize_read_milestone! | ||
7 | - | ||
8 | - # Allow admin milestone | ||
9 | - before_filter :authorize_admin_milestone!, except: [:index, :show] | ||
10 | - | ||
11 | - respond_to :html | ||
12 | - | ||
13 | - def index | ||
14 | - @milestones = case params[:f] | ||
15 | - when 'all'; @project.milestones.order("state, due_date DESC") | ||
16 | - when 'closed'; @project.milestones.closed.order("due_date DESC") | ||
17 | - else @project.milestones.active.order("due_date DESC") | ||
18 | - end | ||
19 | - | ||
20 | - @milestones = @milestones.includes(:project) | ||
21 | - @milestones = @milestones.page(params[:page]).per(20) | ||
22 | - end | ||
23 | - | ||
24 | - def new | ||
25 | - @milestone = @project.milestones.new | ||
26 | - respond_with(@milestone) | ||
27 | - end | ||
28 | - | ||
29 | - def edit | ||
30 | - respond_with(@milestone) | ||
31 | - end | ||
32 | - | ||
33 | - def show | ||
34 | - @issues = @milestone.issues | ||
35 | - @users = @milestone.participants.uniq | ||
36 | - @merge_requests = @milestone.merge_requests | ||
37 | - | ||
38 | - respond_to do |format| | ||
39 | - format.html | ||
40 | - format.js | ||
41 | - end | ||
42 | - end | ||
43 | - | ||
44 | - def create | ||
45 | - @milestone = @project.milestones.new(params[:milestone]) | ||
46 | - @milestone.author_id_of_changes = current_user.id | ||
47 | - | ||
48 | - if @milestone.save | ||
49 | - redirect_to project_milestone_path(@project, @milestone) | ||
50 | - else | ||
51 | - render "new" | ||
52 | - end | ||
53 | - end | ||
54 | - | ||
55 | - def update | ||
56 | - @milestone.update_attributes(params[:milestone].merge(author_id_of_changes: current_user.id)) | ||
57 | - | ||
58 | - respond_to do |format| | ||
59 | - format.js | ||
60 | - format.html do | ||
61 | - if @milestone.valid? | ||
62 | - redirect_to [@project, @milestone] | ||
63 | - else | ||
64 | - render :edit | ||
65 | - end | ||
66 | - end | ||
67 | - end | ||
68 | - end | ||
69 | - | ||
70 | - def destroy | ||
71 | - return access_denied! unless can?(current_user, :admin_milestone, @milestone) | ||
72 | - | ||
73 | - @milestone.destroy | ||
74 | - | ||
75 | - respond_to do |format| | ||
76 | - format.html { redirect_to project_milestones_path } | ||
77 | - format.js { render nothing: true } | ||
78 | - end | ||
79 | - end | ||
80 | - | ||
81 | - protected | ||
82 | - | ||
83 | - def milestone | ||
84 | - @milestone ||= @project.milestones.find(params[:id]) | ||
85 | - end | ||
86 | - | ||
87 | - def authorize_admin_milestone! | ||
88 | - return render_404 unless can?(current_user, :admin_milestone, @project) | ||
89 | - end | ||
90 | - | ||
91 | - def module_enabled | ||
92 | - return render_404 unless @project.issues_enabled | ||
93 | - end | ||
94 | -end |
app/controllers/network_controller.rb
@@ -1,23 +0,0 @@ | @@ -1,23 +0,0 @@ | ||
1 | -class NetworkController < ProjectResourceController | ||
2 | - include ExtractsPath | ||
3 | - include ApplicationHelper | ||
4 | - | ||
5 | - # Authorize | ||
6 | - before_filter :authorize_read_project! | ||
7 | - before_filter :authorize_code_access! | ||
8 | - before_filter :require_non_empty_project | ||
9 | - | ||
10 | - def show | ||
11 | - if @options[:q] | ||
12 | - @commit = @project.repository.commit(@options[:q]) || @commit | ||
13 | - end | ||
14 | - | ||
15 | - respond_to do |format| | ||
16 | - format.html | ||
17 | - | ||
18 | - format.json do | ||
19 | - @graph = Network::Graph.new(project, @ref, @commit, @options[:filter_ref]) | ||
20 | - end | ||
21 | - end | ||
22 | - end | ||
23 | -end |
app/controllers/notes_controller.rb
@@ -1,76 +0,0 @@ | @@ -1,76 +0,0 @@ | ||
1 | -class NotesController < ProjectResourceController | ||
2 | - # Authorize | ||
3 | - before_filter :authorize_read_note! | ||
4 | - before_filter :authorize_write_note!, only: [:create] | ||
5 | - | ||
6 | - respond_to :js | ||
7 | - | ||
8 | - def index | ||
9 | - @notes = Notes::LoadContext.new(project, current_user, params).execute | ||
10 | - @target_type = params[:target_type].camelize | ||
11 | - @target_id = params[:target_id] | ||
12 | - | ||
13 | - if params[:target_type] == "merge_request" | ||
14 | - @discussions = discussions_from_notes | ||
15 | - end | ||
16 | - | ||
17 | - respond_with(@notes) | ||
18 | - end | ||
19 | - | ||
20 | - def create | ||
21 | - @note = Notes::CreateContext.new(project, current_user, params).execute | ||
22 | - @target_type = params[:target_type].camelize | ||
23 | - @target_id = params[:target_id] | ||
24 | - | ||
25 | - respond_to do |format| | ||
26 | - format.html {redirect_to :back} | ||
27 | - format.js | ||
28 | - end | ||
29 | - end | ||
30 | - | ||
31 | - def destroy | ||
32 | - @note = @project.notes.find(params[:id]) | ||
33 | - return access_denied! unless can?(current_user, :admin_note, @note) | ||
34 | - @note.destroy | ||
35 | - | ||
36 | - respond_to do |format| | ||
37 | - format.js { render nothing: true } | ||
38 | - end | ||
39 | - end | ||
40 | - | ||
41 | - def preview | ||
42 | - render text: view_context.markdown(params[:note]) | ||
43 | - end | ||
44 | - | ||
45 | - protected | ||
46 | - | ||
47 | - def discussion_notes_for(note) | ||
48 | - @notes.select do |other_note| | ||
49 | - note.discussion_id == other_note.discussion_id | ||
50 | - end | ||
51 | - end | ||
52 | - | ||
53 | - def discussions_from_notes | ||
54 | - discussion_ids = [] | ||
55 | - discussions = [] | ||
56 | - | ||
57 | - @notes.each do |note| | ||
58 | - next if discussion_ids.include?(note.discussion_id) | ||
59 | - | ||
60 | - # don't group notes for the main target | ||
61 | - if note_for_main_target?(note) | ||
62 | - discussions << [note] | ||
63 | - else | ||
64 | - discussions << discussion_notes_for(note) | ||
65 | - discussion_ids << note.discussion_id | ||
66 | - end | ||
67 | - end | ||
68 | - | ||
69 | - discussions | ||
70 | - end | ||
71 | - | ||
72 | - # Helps to distinguish e.g. commit notes in mr notes list | ||
73 | - def note_for_main_target?(note) | ||
74 | - (@target_type.camelize == note.noteable_type && !note.for_diff_line?) | ||
75 | - end | ||
76 | -end |
app/controllers/project_resource_controller.rb
app/controllers/projects/application_controller.rb
@@ -0,0 +1,14 @@ | @@ -0,0 +1,14 @@ | ||
1 | +# Controller for viewing a file's blame | ||
2 | +class Projects::BlameController < Projects::ApplicationController | ||
3 | + include ExtractsPath | ||
4 | + | ||
5 | + # Authorize | ||
6 | + before_filter :authorize_read_project! | ||
7 | + before_filter :authorize_code_access! | ||
8 | + before_filter :require_non_empty_project | ||
9 | + | ||
10 | + def show | ||
11 | + @blob = Gitlab::Git::Blob.new(@repository, @commit.id, @ref, @path) | ||
12 | + @blame = Gitlab::Git::Blame.new(project.repository, @commit.id, @path) | ||
13 | + end | ||
14 | +end |
@@ -0,0 +1,13 @@ | @@ -0,0 +1,13 @@ | ||
1 | +# Controller for viewing a file's blame | ||
2 | +class Projects::BlobController < Projects::ApplicationController | ||
3 | + include ExtractsPath | ||
4 | + | ||
5 | + # Authorize | ||
6 | + before_filter :authorize_read_project! | ||
7 | + before_filter :authorize_code_access! | ||
8 | + before_filter :require_non_empty_project | ||
9 | + | ||
10 | + def show | ||
11 | + @blob = Gitlab::Git::Blob.new(@repository, @commit.id, @ref, @path) | ||
12 | + end | ||
13 | +end |
@@ -0,0 +1,43 @@ | @@ -0,0 +1,43 @@ | ||
1 | +# Controller for a specific Commit | ||
2 | +# | ||
3 | +# Not to be confused with CommitsController, plural. | ||
4 | +class Projects::CommitController < Projects::ApplicationController | ||
5 | + # Authorize | ||
6 | + before_filter :authorize_read_project! | ||
7 | + before_filter :authorize_code_access! | ||
8 | + before_filter :require_non_empty_project | ||
9 | + | ||
10 | + def show | ||
11 | + result = CommitLoadContext.new(project, current_user, params).execute | ||
12 | + | ||
13 | + @commit = result[:commit] | ||
14 | + | ||
15 | + if @commit.nil? | ||
16 | + git_not_found! | ||
17 | + return | ||
18 | + end | ||
19 | + | ||
20 | + @suppress_diff = result[:suppress_diff] | ||
21 | + | ||
22 | + @note = result[:note] | ||
23 | + @line_notes = result[:line_notes] | ||
24 | + @notes_count = result[:notes_count] | ||
25 | + @target_type = :commit | ||
26 | + @target_id = @commit.id | ||
27 | + | ||
28 | + @comments_allowed = @reply_allowed = true | ||
29 | + @comments_target = { noteable_type: 'Commit', | ||
30 | + commit_id: @commit.id } | ||
31 | + | ||
32 | + respond_to do |format| | ||
33 | + format.html do | ||
34 | + if result[:status] == :huge_commit | ||
35 | + render "huge_commit" and return | ||
36 | + end | ||
37 | + end | ||
38 | + | ||
39 | + format.diff { render text: @commit.to_diff } | ||
40 | + format.patch { render text: @commit.to_patch } | ||
41 | + end | ||
42 | + end | ||
43 | +end |
@@ -0,0 +1,23 @@ | @@ -0,0 +1,23 @@ | ||
1 | +require "base64" | ||
2 | + | ||
3 | +class Projects::CommitsController < Projects::ApplicationController | ||
4 | + include ExtractsPath | ||
5 | + | ||
6 | + # Authorize | ||
7 | + before_filter :authorize_read_project! | ||
8 | + before_filter :authorize_code_access! | ||
9 | + before_filter :require_non_empty_project | ||
10 | + | ||
11 | + def show | ||
12 | + @repo = @project.repository | ||
13 | + @limit, @offset = (params[:limit] || 40), (params[:offset] || 0) | ||
14 | + | ||
15 | + @commits = @repo.commits(@ref, @path, @limit, @offset) | ||
16 | + | ||
17 | + respond_to do |format| | ||
18 | + format.html # index.html.erb | ||
19 | + format.js | ||
20 | + format.atom { render layout: false } | ||
21 | + end | ||
22 | + end | ||
23 | +end |
@@ -0,0 +1,23 @@ | @@ -0,0 +1,23 @@ | ||
1 | +class Projects::CompareController < Projects::ApplicationController | ||
2 | + # Authorize | ||
3 | + before_filter :authorize_read_project! | ||
4 | + before_filter :authorize_code_access! | ||
5 | + before_filter :require_non_empty_project | ||
6 | + | ||
7 | + def index | ||
8 | + end | ||
9 | + | ||
10 | + def show | ||
11 | + compare = Gitlab::Git::Compare.new(project.repository, params[:from], params[:to]) | ||
12 | + | ||
13 | + @commits = compare.commits | ||
14 | + @commit = compare.commit | ||
15 | + @diffs = compare.diffs | ||
16 | + @refs_are_same = compare.same | ||
17 | + @line_notes = [] | ||
18 | + end | ||
19 | + | ||
20 | + def create | ||
21 | + redirect_to project_compare_path(@project, params[:from], params[:to]) | ||
22 | + end | ||
23 | +end |
@@ -0,0 +1,61 @@ | @@ -0,0 +1,61 @@ | ||
1 | +class Projects::DeployKeysController < Projects::ApplicationController | ||
2 | + respond_to :html | ||
3 | + | ||
4 | + # Authorize | ||
5 | + before_filter :authorize_admin_project! | ||
6 | + | ||
7 | + layout "project_settings" | ||
8 | + | ||
9 | + def index | ||
10 | + @enabled_keys = @project.deploy_keys.all | ||
11 | + @available_keys = available_keys - @enabled_keys | ||
12 | + end | ||
13 | + | ||
14 | + def show | ||
15 | + @key = @project.deploy_keys.find(params[:id]) | ||
16 | + end | ||
17 | + | ||
18 | + def new | ||
19 | + @key = @project.deploy_keys.new | ||
20 | + | ||
21 | + respond_with(@key) | ||
22 | + end | ||
23 | + | ||
24 | + def create | ||
25 | + @key = DeployKey.new(params[:deploy_key]) | ||
26 | + | ||
27 | + if @key.valid? && @project.deploy_keys << @key | ||
28 | + redirect_to project_deploy_keys_path(@project) | ||
29 | + else | ||
30 | + render "new" | ||
31 | + end | ||
32 | + end | ||
33 | + | ||
34 | + def destroy | ||
35 | + @key = @project.deploy_keys.find(params[:id]) | ||
36 | + @key.destroy | ||
37 | + | ||
38 | + respond_to do |format| | ||
39 | + format.html { redirect_to project_deploy_keys_url } | ||
40 | + format.js { render nothing: true } | ||
41 | + end | ||
42 | + end | ||
43 | + | ||
44 | + def enable | ||
45 | + project.deploy_keys << available_keys.find(params[:id]) | ||
46 | + | ||
47 | + redirect_to project_deploy_keys_path(@project) | ||
48 | + end | ||
49 | + | ||
50 | + def disable | ||
51 | + @project.deploy_keys_projects.where(deploy_key_id: params[:id]).last.destroy | ||
52 | + | ||
53 | + redirect_to project_deploy_keys_path(@project) | ||
54 | + end | ||
55 | + | ||
56 | + protected | ||
57 | + | ||
58 | + def available_keys | ||
59 | + @available_keys ||= current_user.accessible_deploy_keys | ||
60 | + end | ||
61 | +end |
@@ -0,0 +1,49 @@ | @@ -0,0 +1,49 @@ | ||
1 | +# Controller for edit a repository's file | ||
2 | +class Projects::EditTreeController < Projects::ApplicationController | ||
3 | + include ExtractsPath | ||
4 | + | ||
5 | + # Authorize | ||
6 | + before_filter :authorize_read_project! | ||
7 | + before_filter :authorize_code_access! | ||
8 | + before_filter :require_non_empty_project | ||
9 | + | ||
10 | + before_filter :edit_requirements, only: [:show, :update] | ||
11 | + | ||
12 | + def show | ||
13 | + @last_commit = @project.repository.last_commit_for(@ref, @path).sha | ||
14 | + end | ||
15 | + | ||
16 | + def update | ||
17 | + edit_file_action = Gitlab::Satellite::EditFileAction.new(current_user, @project, @ref, @path) | ||
18 | + updated_successfully = edit_file_action.commit!( | ||
19 | + params[:content], | ||
20 | + params[:commit_message], | ||
21 | + params[:last_commit] | ||
22 | + ) | ||
23 | + | ||
24 | + if updated_successfully | ||
25 | + redirect_to project_blob_path(@project, @id), notice: "Your changes have been successfully commited" | ||
26 | + else | ||
27 | + flash[:notice] = "Your changes could not be commited, because the file has been changed" | ||
28 | + render :show | ||
29 | + end | ||
30 | + end | ||
31 | + | ||
32 | + private | ||
33 | + | ||
34 | + def edit_requirements | ||
35 | + @blob = Gitlab::Git::Blob.new(@repository, @commit.id, @ref, @path) | ||
36 | + | ||
37 | + unless @blob.exists? && @blob.text? | ||
38 | + redirect_to project_blob_path(@project, @id), notice: "You can only edit text files" | ||
39 | + end | ||
40 | + | ||
41 | + allowed = if project.protected_branch? @ref | ||
42 | + can?(current_user, :push_code_to_protected_branches, project) | ||
43 | + else | ||
44 | + can?(current_user, :push_code, project) | ||
45 | + end | ||
46 | + | ||
47 | + return access_denied! unless allowed | ||
48 | + end | ||
49 | +end |
@@ -0,0 +1,17 @@ | @@ -0,0 +1,17 @@ | ||
1 | +class Projects::GraphsController < Projects::ApplicationController | ||
2 | + # Authorize | ||
3 | + before_filter :authorize_read_project! | ||
4 | + before_filter :authorize_code_access! | ||
5 | + before_filter :require_non_empty_project | ||
6 | + | ||
7 | + def show | ||
8 | + respond_to do |format| | ||
9 | + format.html | ||
10 | + format.js do | ||
11 | + @repo = @project.repository | ||
12 | + @stats = Gitlab::Git::GitStats.new(@repo.raw, @repo.root_ref) | ||
13 | + @log = @stats.parsed_log.to_json rescue [] | ||
14 | + end | ||
15 | + end | ||
16 | + end | ||
17 | +end |
@@ -0,0 +1,39 @@ | @@ -0,0 +1,39 @@ | ||
1 | +class Projects::HooksController < Projects::ApplicationController | ||
2 | + # Authorize | ||
3 | + before_filter :authorize_read_project! | ||
4 | + before_filter :authorize_admin_project!, only: [:new, :create, :destroy] | ||
5 | + | ||
6 | + respond_to :html | ||
7 | + | ||
8 | + layout "project_settings" | ||
9 | + | ||
10 | + def index | ||
11 | + @hooks = @project.hooks.all | ||
12 | + @hook = ProjectHook.new | ||
13 | + end | ||
14 | + | ||
15 | + def create | ||
16 | + @hook = @project.hooks.new(params[:hook]) | ||
17 | + @hook.save | ||
18 | + | ||
19 | + if @hook.valid? | ||
20 | + redirect_to project_hooks_path(@project) | ||
21 | + else | ||
22 | + @hooks = @project.hooks.all | ||
23 | + render :index | ||
24 | + end | ||
25 | + end | ||
26 | + | ||
27 | + def test | ||
28 | + TestHookContext.new(project, current_user, params).execute | ||
29 | + | ||
30 | + redirect_to :back | ||
31 | + end | ||
32 | + | ||
33 | + def destroy | ||
34 | + @hook = @project.hooks.find(params[:id]) | ||
35 | + @hook.destroy | ||
36 | + | ||
37 | + redirect_to project_hooks_path(@project) | ||
38 | + end | ||
39 | +end |
@@ -0,0 +1,114 @@ | @@ -0,0 +1,114 @@ | ||
1 | +class Projects::IssuesController < Projects::ApplicationController | ||
2 | + before_filter :module_enabled | ||
3 | + before_filter :issue, only: [:edit, :update, :show] | ||
4 | + | ||
5 | + # Allow read any issue | ||
6 | + before_filter :authorize_read_issue! | ||
7 | + | ||
8 | + # Allow write(create) issue | ||
9 | + before_filter :authorize_write_issue!, only: [:new, :create] | ||
10 | + | ||
11 | + # Allow modify issue | ||
12 | + before_filter :authorize_modify_issue!, only: [:edit, :update] | ||
13 | + | ||
14 | + respond_to :js, :html | ||
15 | + | ||
16 | + def index | ||
17 | + terms = params['issue_search'] | ||
18 | + | ||
19 | + @issues = issues_filtered | ||
20 | + @issues = @issues.where("title LIKE ?", "%#{terms}%") if terms.present? | ||
21 | + @issues = @issues.page(params[:page]).per(20) | ||
22 | + | ||
23 | + | ||
24 | + assignee_id, milestone_id = params[:assignee_id], params[:milestone_id] | ||
25 | + | ||
26 | + @assignee = @project.team.find(assignee_id) if assignee_id.present? && !assignee_id.to_i.zero? | ||
27 | + @milestone = @project.milestones.find(milestone_id) if milestone_id.present? && !milestone_id.to_i.zero? | ||
28 | + | ||
29 | + respond_to do |format| | ||
30 | + format.html # index.html.erb | ||
31 | + format.js | ||
32 | + format.atom { render layout: false } | ||
33 | + end | ||
34 | + end | ||
35 | + | ||
36 | + def new | ||
37 | + @issue = @project.issues.new(params[:issue]) | ||
38 | + respond_with(@issue) | ||
39 | + end | ||
40 | + | ||
41 | + def edit | ||
42 | + respond_with(@issue) | ||
43 | + end | ||
44 | + | ||
45 | + def show | ||
46 | + @note = @project.notes.new(noteable: @issue) | ||
47 | + @target_type = :issue | ||
48 | + @target_id = @issue.id | ||
49 | + | ||
50 | + respond_to do |format| | ||
51 | + format.html | ||
52 | + format.js | ||
53 | + end | ||
54 | + end | ||
55 | + | ||
56 | + def create | ||
57 | + @issue = @project.issues.new(params[:issue]) | ||
58 | + @issue.author = current_user | ||
59 | + @issue.save | ||
60 | + | ||
61 | + respond_to do |format| | ||
62 | + format.html do | ||
63 | + if @issue.valid? | ||
64 | + redirect_to project_issue_path(@project, @issue) | ||
65 | + else | ||
66 | + render :new | ||
67 | + end | ||
68 | + end | ||
69 | + format.js | ||
70 | + end | ||
71 | + end | ||
72 | + | ||
73 | + def update | ||
74 | + @issue.update_attributes(params[:issue].merge(author_id_of_changes: current_user.id)) | ||
75 | + | ||
76 | + respond_to do |format| | ||
77 | + format.js | ||
78 | + format.html do | ||
79 | + if @issue.valid? | ||
80 | + redirect_to [@project, @issue] | ||
81 | + else | ||
82 | + render :edit | ||
83 | + end | ||
84 | + end | ||
85 | + end | ||
86 | + end | ||
87 | + | ||
88 | + def bulk_update | ||
89 | + result = Issues::BulkUpdateContext.new(project, current_user, params).execute | ||
90 | + redirect_to :back, notice: "#{result[:count]} issues updated" | ||
91 | + end | ||
92 | + | ||
93 | + protected | ||
94 | + | ||
95 | + def issue | ||
96 | + @issue ||= @project.issues.find(params[:id]) | ||
97 | + end | ||
98 | + | ||
99 | + def authorize_modify_issue! | ||
100 | + return render_404 unless can?(current_user, :modify_issue, @issue) | ||
101 | + end | ||
102 | + | ||
103 | + def authorize_admin_issue! | ||
104 | + return render_404 unless can?(current_user, :admin_issue, @issue) | ||
105 | + end | ||
106 | + | ||
107 | + def module_enabled | ||
108 | + return render_404 unless @project.issues_enabled | ||
109 | + end | ||
110 | + | ||
111 | + def issues_filtered | ||
112 | + @issues = Issues::ListContext.new(project, current_user, params).execute | ||
113 | + end | ||
114 | +end |
@@ -0,0 +1,24 @@ | @@ -0,0 +1,24 @@ | ||
1 | +class Projects::LabelsController < Projects::ApplicationController | ||
2 | + before_filter :module_enabled | ||
3 | + | ||
4 | + # Allow read any issue | ||
5 | + before_filter :authorize_read_issue! | ||
6 | + | ||
7 | + respond_to :js, :html | ||
8 | + | ||
9 | + def index | ||
10 | + @labels = @project.issues_labels | ||
11 | + end | ||
12 | + | ||
13 | + def generate | ||
14 | + Gitlab::IssuesLabels.generate(@project) | ||
15 | + | ||
16 | + redirect_to project_labels_path(@project) | ||
17 | + end | ||
18 | + | ||
19 | + protected | ||
20 | + | ||
21 | + def module_enabled | ||
22 | + return render_404 unless @project.issues_enabled | ||
23 | + end | ||
24 | +end |
@@ -0,0 +1,163 @@ | @@ -0,0 +1,163 @@ | ||
1 | +require 'gitlab/satellite/satellite' | ||
2 | + | ||
3 | +class Projects::MergeRequestsController < Projects::ApplicationController | ||
4 | + before_filter :module_enabled | ||
5 | + before_filter :merge_request, only: [:edit, :update, :show, :commits, :diffs, :automerge, :automerge_check, :ci_status] | ||
6 | + before_filter :validates_merge_request, only: [:show, :diffs] | ||
7 | + before_filter :define_show_vars, only: [:show, :diffs] | ||
8 | + | ||
9 | + # Allow read any merge_request | ||
10 | + before_filter :authorize_read_merge_request! | ||
11 | + | ||
12 | + # Allow write(create) merge_request | ||
13 | + before_filter :authorize_write_merge_request!, only: [:new, :create] | ||
14 | + | ||
15 | + # Allow modify merge_request | ||
16 | + before_filter :authorize_modify_merge_request!, only: [:close, :edit, :update, :sort] | ||
17 | + | ||
18 | + def index | ||
19 | + @merge_requests = MergeRequestsLoadContext.new(project, current_user, params).execute | ||
20 | + end | ||
21 | + | ||
22 | + def show | ||
23 | + respond_to do |format| | ||
24 | + format.html | ||
25 | + format.js | ||
26 | + | ||
27 | + format.diff { render text: @merge_request.to_diff } | ||
28 | + format.patch { render text: @merge_request.to_patch } | ||
29 | + end | ||
30 | + end | ||
31 | + | ||
32 | + def diffs | ||
33 | + @diffs = @merge_request.diffs | ||
34 | + @commit = @merge_request.last_commit | ||
35 | + | ||
36 | + @comments_allowed = @reply_allowed = true | ||
37 | + @comments_target = { noteable_type: 'MergeRequest', | ||
38 | + noteable_id: @merge_request.id } | ||
39 | + @line_notes = @merge_request.notes.where("line_code is not null") | ||
40 | + end | ||
41 | + | ||
42 | + def new | ||
43 | + @merge_request = @project.merge_requests.new(params[:merge_request]) | ||
44 | + end | ||
45 | + | ||
46 | + def edit | ||
47 | + end | ||
48 | + | ||
49 | + def create | ||
50 | + @merge_request = @project.merge_requests.new(params[:merge_request]) | ||
51 | + @merge_request.author = current_user | ||
52 | + | ||
53 | + if @merge_request.save | ||
54 | + @merge_request.reload_code | ||
55 | + redirect_to [@project, @merge_request], notice: 'Merge request was successfully created.' | ||
56 | + else | ||
57 | + render "new" | ||
58 | + end | ||
59 | + end | ||
60 | + | ||
61 | + def update | ||
62 | + if @merge_request.update_attributes(params[:merge_request].merge(author_id_of_changes: current_user.id)) | ||
63 | + @merge_request.reload_code | ||
64 | + @merge_request.mark_as_unchecked | ||
65 | + redirect_to [@project, @merge_request], notice: 'Merge request was successfully updated.' | ||
66 | + else | ||
67 | + render "edit" | ||
68 | + end | ||
69 | + end | ||
70 | + | ||
71 | + def automerge_check | ||
72 | + if @merge_request.unchecked? | ||
73 | + @merge_request.check_if_can_be_merged | ||
74 | + end | ||
75 | + render json: {merge_status: @merge_request.merge_status_name} | ||
76 | + rescue Gitlab::SatelliteNotExistError | ||
77 | + render json: {merge_status: :no_satellite} | ||
78 | + end | ||
79 | + | ||
80 | + def automerge | ||
81 | + return access_denied! unless allowed_to_merge? | ||
82 | + | ||
83 | + if @merge_request.opened? && @merge_request.can_be_merged? | ||
84 | + @merge_request.should_remove_source_branch = params[:should_remove_source_branch] | ||
85 | + @merge_request.automerge!(current_user) | ||
86 | + @status = true | ||
87 | + else | ||
88 | + @status = false | ||
89 | + end | ||
90 | + end | ||
91 | + | ||
92 | + def branch_from | ||
93 | + @commit = @repository.commit(params[:ref]) | ||
94 | + end | ||
95 | + | ||
96 | + def branch_to | ||
97 | + @commit = @repository.commit(params[:ref]) | ||
98 | + end | ||
99 | + | ||
100 | + def ci_status | ||
101 | + status = project.gitlab_ci_service.commit_status(merge_request.last_commit.sha) | ||
102 | + response = { status: status } | ||
103 | + | ||
104 | + render json: response | ||
105 | + end | ||
106 | + | ||
107 | + protected | ||
108 | + | ||
109 | + def merge_request | ||
110 | + @merge_request ||= @project.merge_requests.find(params[:id]) | ||
111 | + end | ||
112 | + | ||
113 | + def authorize_modify_merge_request! | ||
114 | + return render_404 unless can?(current_user, :modify_merge_request, @merge_request) | ||
115 | + end | ||
116 | + | ||
117 | + def authorize_admin_merge_request! | ||
118 | + return render_404 unless can?(current_user, :admin_merge_request, @merge_request) | ||
119 | + end | ||
120 | + | ||
121 | + def module_enabled | ||
122 | + return render_404 unless @project.merge_requests_enabled | ||
123 | + end | ||
124 | + | ||
125 | + def validates_merge_request | ||
126 | + # Show git not found page if target branch doesn't exist | ||
127 | + return invalid_mr unless @project.repository.branch_names.include?(@merge_request.target_branch) | ||
128 | + | ||
129 | + # Show git not found page if source branch doesn't exist | ||
130 | + # and there is no saved commits between source & target branch | ||
131 | + return invalid_mr if !@project.repository.branch_names.include?(@merge_request.source_branch) && @merge_request.commits.blank? | ||
132 | + end | ||
133 | + | ||
134 | + def define_show_vars | ||
135 | + # Build a note object for comment form | ||
136 | + @note = @project.notes.new(noteable: @merge_request) | ||
137 | + | ||
138 | + # Get commits from repository | ||
139 | + # or from cache if already merged | ||
140 | + @commits = @merge_request.commits | ||
141 | + | ||
142 | + @allowed_to_merge = allowed_to_merge? | ||
143 | + @show_merge_controls = @merge_request.opened? && @commits.any? && @allowed_to_merge | ||
144 | + | ||
145 | + @target_type = :merge_request | ||
146 | + @target_id = @merge_request.id | ||
147 | + end | ||
148 | + | ||
149 | + def allowed_to_merge? | ||
150 | + action = if project.protected_branch?(@merge_request.target_branch) | ||
151 | + :push_code_to_protected_branches | ||
152 | + else | ||
153 | + :push_code | ||
154 | + end | ||
155 | + | ||
156 | + can?(current_user, action, @project) | ||
157 | + end | ||
158 | + | ||
159 | + def invalid_mr | ||
160 | + # Render special view for MR with removed source or target branch | ||
161 | + render 'invalid' | ||
162 | + end | ||
163 | +end |
@@ -0,0 +1,94 @@ | @@ -0,0 +1,94 @@ | ||
1 | +class Projects::MilestonesController < Projects::ApplicationController | ||
2 | + before_filter :module_enabled | ||
3 | + before_filter :milestone, only: [:edit, :update, :destroy, :show] | ||
4 | + | ||
5 | + # Allow read any milestone | ||
6 | + before_filter :authorize_read_milestone! | ||
7 | + | ||
8 | + # Allow admin milestone | ||
9 | + before_filter :authorize_admin_milestone!, except: [:index, :show] | ||
10 | + | ||
11 | + respond_to :html | ||
12 | + | ||
13 | + def index | ||
14 | + @milestones = case params[:f] | ||
15 | + when 'all'; @project.milestones.order("state, due_date DESC") | ||
16 | + when 'closed'; @project.milestones.closed.order("due_date DESC") | ||
17 | + else @project.milestones.active.order("due_date DESC") | ||
18 | + end | ||
19 | + | ||
20 | + @milestones = @milestones.includes(:project) | ||
21 | + @milestones = @milestones.page(params[:page]).per(20) | ||
22 | + end | ||
23 | + | ||
24 | + def new | ||
25 | + @milestone = @project.milestones.new | ||
26 | + respond_with(@milestone) | ||
27 | + end | ||
28 | + | ||
29 | + def edit | ||
30 | + respond_with(@milestone) | ||
31 | + end | ||
32 | + | ||
33 | + def show | ||
34 | + @issues = @milestone.issues | ||
35 | + @users = @milestone.participants.uniq | ||
36 | + @merge_requests = @milestone.merge_requests | ||
37 | + | ||
38 | + respond_to do |format| | ||
39 | + format.html | ||
40 | + format.js | ||
41 | + end | ||
42 | + end | ||
43 | + | ||
44 | + def create | ||
45 | + @milestone = @project.milestones.new(params[:milestone]) | ||
46 | + @milestone.author_id_of_changes = current_user.id | ||
47 | + | ||
48 | + if @milestone.save | ||
49 | + redirect_to project_milestone_path(@project, @milestone) | ||
50 | + else | ||
51 | + render "new" | ||
52 | + end | ||
53 | + end | ||
54 | + | ||
55 | + def update | ||
56 | + @milestone.update_attributes(params[:milestone].merge(author_id_of_changes: current_user.id)) | ||
57 | + | ||
58 | + respond_to do |format| | ||
59 | + format.js | ||
60 | + format.html do | ||
61 | + if @milestone.valid? | ||
62 | + redirect_to [@project, @milestone] | ||
63 | + else | ||
64 | + render :edit | ||
65 | + end | ||
66 | + end | ||
67 | + end | ||
68 | + end | ||
69 | + | ||
70 | + def destroy | ||
71 | + return access_denied! unless can?(current_user, :admin_milestone, @milestone) | ||
72 | + | ||
73 | + @milestone.destroy | ||
74 | + | ||
75 | + respond_to do |format| | ||
76 | + format.html { redirect_to project_milestones_path } | ||
77 | + format.js { render nothing: true } | ||
78 | + end | ||
79 | + end | ||
80 | + | ||
81 | + protected | ||
82 | + | ||
83 | + def milestone | ||
84 | + @milestone ||= @project.milestones.find(params[:id]) | ||
85 | + end | ||
86 | + | ||
87 | + def authorize_admin_milestone! | ||
88 | + return render_404 unless can?(current_user, :admin_milestone, @project) | ||
89 | + end | ||
90 | + | ||
91 | + def module_enabled | ||
92 | + return render_404 unless @project.issues_enabled | ||
93 | + end | ||
94 | +end |
@@ -0,0 +1,23 @@ | @@ -0,0 +1,23 @@ | ||
1 | +class Projects::NetworkController < Projects::ApplicationController | ||
2 | + include ExtractsPath | ||
3 | + include ApplicationHelper | ||
4 | + | ||
5 | + # Authorize | ||
6 | + before_filter :authorize_read_project! | ||
7 | + before_filter :authorize_code_access! | ||
8 | + before_filter :require_non_empty_project | ||
9 | + | ||
10 | + def show | ||
11 | + if @options[:q] | ||
12 | + @commit = @project.repository.commit(@options[:q]) || @commit | ||
13 | + end | ||
14 | + | ||
15 | + respond_to do |format| | ||
16 | + format.html | ||
17 | + | ||
18 | + format.json do | ||
19 | + @graph = Network::Graph.new(project, @ref, @commit, @options[:filter_ref]) | ||
20 | + end | ||
21 | + end | ||
22 | + end | ||
23 | +end |
@@ -0,0 +1,76 @@ | @@ -0,0 +1,76 @@ | ||
1 | +class Projects::NotesController < Projects::ApplicationController | ||
2 | + # Authorize | ||
3 | + before_filter :authorize_read_note! | ||
4 | + before_filter :authorize_write_note!, only: [:create] | ||
5 | + | ||
6 | + respond_to :js | ||
7 | + | ||
8 | + def index | ||
9 | + @notes = Notes::LoadContext.new(project, current_user, params).execute | ||
10 | + @target_type = params[:target_type].camelize | ||
11 | + @target_id = params[:target_id] | ||
12 | + | ||
13 | + if params[:target_type] == "merge_request" | ||
14 | + @discussions = discussions_from_notes | ||
15 | + end | ||
16 | + | ||
17 | + respond_with(@notes) | ||
18 | + end | ||
19 | + | ||
20 | + def create | ||
21 | + @note = Notes::CreateContext.new(project, current_user, params).execute | ||
22 | + @target_type = params[:target_type].camelize | ||
23 | + @target_id = params[:target_id] | ||
24 | + | ||
25 | + respond_to do |format| | ||
26 | + format.html {redirect_to :back} | ||
27 | + format.js | ||
28 | + end | ||
29 | + end | ||
30 | + | ||
31 | + def destroy | ||
32 | + @note = @project.notes.find(params[:id]) | ||
33 | + return access_denied! unless can?(current_user, :admin_note, @note) | ||
34 | + @note.destroy | ||
35 | + | ||
36 | + respond_to do |format| | ||
37 | + format.js { render nothing: true } | ||
38 | + end | ||
39 | + end | ||
40 | + | ||
41 | + def preview | ||
42 | + render text: view_context.markdown(params[:note]) | ||
43 | + end | ||
44 | + | ||
45 | + protected | ||
46 | + | ||
47 | + def discussion_notes_for(note) | ||
48 | + @notes.select do |other_note| | ||
49 | + note.discussion_id == other_note.discussion_id | ||
50 | + end | ||
51 | + end | ||
52 | + | ||
53 | + def discussions_from_notes | ||
54 | + discussion_ids = [] | ||
55 | + discussions = [] | ||
56 | + | ||
57 | + @notes.each do |note| | ||
58 | + next if discussion_ids.include?(note.discussion_id) | ||
59 | + | ||
60 | + # don't group notes for the main target | ||
61 | + if note_for_main_target?(note) | ||
62 | + discussions << [note] | ||
63 | + else | ||
64 | + discussions << discussion_notes_for(note) | ||
65 | + discussion_ids << note.discussion_id | ||
66 | + end | ||
67 | + end | ||
68 | + | ||
69 | + discussions | ||
70 | + end | ||
71 | + | ||
72 | + # Helps to distinguish e.g. commit notes in mr notes list | ||
73 | + def note_for_main_target?(note) | ||
74 | + (@target_type.camelize == note.noteable_type && !note.for_diff_line?) | ||
75 | + end | ||
76 | +end |
app/controllers/projects/protected_branches_controller.rb
0 → 100644
@@ -0,0 +1,26 @@ | @@ -0,0 +1,26 @@ | ||
1 | +class Projects::ProtectedBranchesController < Projects::ApplicationController | ||
2 | + # Authorize | ||
3 | + before_filter :authorize_read_project! | ||
4 | + before_filter :require_non_empty_project | ||
5 | + | ||
6 | + before_filter :authorize_admin_project!, only: [:destroy, :create] | ||
7 | + | ||
8 | + def index | ||
9 | + @branches = @project.protected_branches.all | ||
10 | + @protected_branch = @project.protected_branches.new | ||
11 | + end | ||
12 | + | ||
13 | + def create | ||
14 | + @project.protected_branches.create(params[:protected_branch]) | ||
15 | + redirect_to project_protected_branches_path(@project) | ||
16 | + end | ||
17 | + | ||
18 | + def destroy | ||
19 | + @project.protected_branches.find(params[:id]).destroy | ||
20 | + | ||
21 | + respond_to do |format| | ||
22 | + format.html { redirect_to project_protected_branches_path } | ||
23 | + format.js { render nothing: true } | ||
24 | + end | ||
25 | + end | ||
26 | +end |
@@ -0,0 +1,25 @@ | @@ -0,0 +1,25 @@ | ||
1 | +# Controller for viewing a file's raw | ||
2 | +class Projects::RawController < Projects::ApplicationController | ||
3 | + include ExtractsPath | ||
4 | + | ||
5 | + # Authorize | ||
6 | + before_filter :authorize_read_project! | ||
7 | + before_filter :authorize_code_access! | ||
8 | + before_filter :require_non_empty_project | ||
9 | + | ||
10 | + def show | ||
11 | + @blob = Gitlab::Git::Blob.new(@repository, @commit.id, @ref, @path) | ||
12 | + | ||
13 | + if @blob.exists? | ||
14 | + send_data( | ||
15 | + @blob.data, | ||
16 | + type: @blob.mime_type, | ||
17 | + disposition: 'inline', | ||
18 | + filename: @blob.name | ||
19 | + ) | ||
20 | + else | ||
21 | + not_found! | ||
22 | + end | ||
23 | + end | ||
24 | +end | ||
25 | + |
@@ -0,0 +1,43 @@ | @@ -0,0 +1,43 @@ | ||
1 | +class Projects::RefsController < Projects::ApplicationController | ||
2 | + include ExtractsPath | ||
3 | + | ||
4 | + # Authorize | ||
5 | + before_filter :authorize_read_project! | ||
6 | + before_filter :authorize_code_access! | ||
7 | + before_filter :require_non_empty_project | ||
8 | + | ||
9 | + def switch | ||
10 | + respond_to do |format| | ||
11 | + format.html do | ||
12 | + new_path = if params[:destination] == "tree" | ||
13 | + project_tree_path(@project, (@id)) | ||
14 | + elsif params[:destination] == "blob" | ||
15 | + project_blob_path(@project, (@id)) | ||
16 | + elsif params[:destination] == "graph" | ||
17 | + project_network_path(@project, @id, @options) | ||
18 | + else | ||
19 | + project_commits_path(@project, @id) | ||
20 | + end | ||
21 | + | ||
22 | + redirect_to new_path | ||
23 | + end | ||
24 | + format.js do | ||
25 | + @ref = params[:ref] | ||
26 | + define_tree_vars | ||
27 | + render "tree" | ||
28 | + end | ||
29 | + end | ||
30 | + end | ||
31 | + | ||
32 | + def logs_tree | ||
33 | + contents = @tree.entries | ||
34 | + @logs = contents.map do |content| | ||
35 | + file = params[:path] ? File.join(params[:path], content.name) : content.name | ||
36 | + last_commit = @repo.commits(@commit.id, file, 1).last | ||
37 | + { | ||
38 | + file_name: content.name, | ||
39 | + commit: last_commit | ||
40 | + } | ||
41 | + end | ||
42 | + end | ||
43 | +end |
@@ -0,0 +1,41 @@ | @@ -0,0 +1,41 @@ | ||
1 | +class Projects::RepositoriesController < Projects::ApplicationController | ||
2 | + # Authorize | ||
3 | + before_filter :authorize_read_project! | ||
4 | + before_filter :authorize_code_access! | ||
5 | + before_filter :require_non_empty_project | ||
6 | + | ||
7 | + def show | ||
8 | + @activities = @repository.commits_with_refs(20) | ||
9 | + end | ||
10 | + | ||
11 | + def branches | ||
12 | + @branches = @repository.branches | ||
13 | + end | ||
14 | + | ||
15 | + def tags | ||
16 | + @tags = @repository.tags | ||
17 | + end | ||
18 | + | ||
19 | + def stats | ||
20 | + @stats = Gitlab::Git::Stats.new(@repository.raw, @repository.root_ref) | ||
21 | + @graph = @stats.graph | ||
22 | + end | ||
23 | + | ||
24 | + def archive | ||
25 | + unless can?(current_user, :download_code, @project) | ||
26 | + render_404 and return | ||
27 | + end | ||
28 | + | ||
29 | + | ||
30 | + storage_path = Rails.root.join("tmp", "repositories") | ||
31 | + | ||
32 | + file_path = @repository.archive_repo(params[:ref], storage_path) | ||
33 | + | ||
34 | + if file_path | ||
35 | + # Send file to user | ||
36 | + send_file file_path | ||
37 | + else | ||
38 | + render_404 | ||
39 | + end | ||
40 | + end | ||
41 | +end |
@@ -0,0 +1,39 @@ | @@ -0,0 +1,39 @@ | ||
1 | +class Projects::ServicesController < Projects::ApplicationController | ||
2 | + # Authorize | ||
3 | + before_filter :authorize_admin_project! | ||
4 | + before_filter :service, only: [:edit, :update, :test] | ||
5 | + | ||
6 | + respond_to :html | ||
7 | + | ||
8 | + layout "project_settings" | ||
9 | + | ||
10 | + def index | ||
11 | + @project.build_missing_services | ||
12 | + @services = @project.services.reload | ||
13 | + end | ||
14 | + | ||
15 | + def edit | ||
16 | + end | ||
17 | + | ||
18 | + def update | ||
19 | + if @service.update_attributes(params[:service]) | ||
20 | + redirect_to edit_project_service_path(@project, @service.to_param) | ||
21 | + else | ||
22 | + render 'edit' | ||
23 | + end | ||
24 | + end | ||
25 | + | ||
26 | + def test | ||
27 | + data = GitPushService.new.sample_data(project, current_user) | ||
28 | + | ||
29 | + @service.execute(data) | ||
30 | + | ||
31 | + redirect_to :back | ||
32 | + end | ||
33 | + | ||
34 | + private | ||
35 | + | ||
36 | + def service | ||
37 | + @service ||= @project.services.find { |service| service.to_param == params[:id] } | ||
38 | + end | ||
39 | +end |
app/controllers/projects/snippets_controller.rb
@@ -14,7 +14,7 @@ class Projects::SnippetsController < Projects::ApplicationController | @@ -14,7 +14,7 @@ class Projects::SnippetsController < Projects::ApplicationController | ||
14 | # Allow destroy snippet | 14 | # Allow destroy snippet |
15 | before_filter :authorize_admin_project_snippet!, only: [:destroy] | 15 | before_filter :authorize_admin_project_snippet!, only: [:destroy] |
16 | 16 | ||
17 | - layout 'project_resource' | 17 | + layout 'projects' |
18 | 18 | ||
19 | respond_to :html | 19 | respond_to :html |
20 | 20 |
@@ -0,0 +1,62 @@ | @@ -0,0 +1,62 @@ | ||
1 | +class Projects::TeamMembersController < Projects::ApplicationController | ||
2 | + # Authorize | ||
3 | + before_filter :authorize_read_project! | ||
4 | + before_filter :authorize_admin_project!, except: [:index, :show] | ||
5 | + | ||
6 | + layout "project_settings" | ||
7 | + | ||
8 | + def index | ||
9 | + @group = @project.group | ||
10 | + @users_projects = @project.users_projects.order('project_access DESC') | ||
11 | + end | ||
12 | + | ||
13 | + def new | ||
14 | + @user_project_relation = project.users_projects.new | ||
15 | + end | ||
16 | + | ||
17 | + def create | ||
18 | + users = User.where(id: params[:user_ids].split(',')) | ||
19 | + | ||
20 | + @project.team << [users, params[:project_access]] | ||
21 | + | ||
22 | + if params[:redirect_to] | ||
23 | + redirect_to params[:redirect_to] | ||
24 | + else | ||
25 | + redirect_to project_team_index_path(@project) | ||
26 | + end | ||
27 | + end | ||
28 | + | ||
29 | + def update | ||
30 | + @user_project_relation = project.users_projects.find_by_user_id(member) | ||
31 | + @user_project_relation.update_attributes(params[:team_member]) | ||
32 | + | ||
33 | + unless @user_project_relation.valid? | ||
34 | + flash[:alert] = "User should have at least one role" | ||
35 | + end | ||
36 | + redirect_to project_team_index_path(@project) | ||
37 | + end | ||
38 | + | ||
39 | + def destroy | ||
40 | + @user_project_relation = project.users_projects.find_by_user_id(member) | ||
41 | + @user_project_relation.destroy | ||
42 | + | ||
43 | + respond_to do |format| | ||
44 | + format.html { redirect_to project_team_index_path(@project) } | ||
45 | + format.js { render nothing: true } | ||
46 | + end | ||
47 | + end | ||
48 | + | ||
49 | + def apply_import | ||
50 | + giver = Project.find(params[:source_project_id]) | ||
51 | + status = @project.team.import(giver) | ||
52 | + notice = status ? "Succesfully imported" : "Import failed" | ||
53 | + | ||
54 | + redirect_to project_team_index_path(project), notice: notice | ||
55 | + end | ||
56 | + | ||
57 | + protected | ||
58 | + | ||
59 | + def member | ||
60 | + @member ||= User.find_by_username(params[:id]) | ||
61 | + end | ||
62 | +end |
@@ -0,0 +1,17 @@ | @@ -0,0 +1,17 @@ | ||
1 | +# Controller for viewing a repository's file structure | ||
2 | +class Projects::TreeController < Projects::ApplicationController | ||
3 | + include ExtractsPath | ||
4 | + | ||
5 | + # Authorize | ||
6 | + before_filter :authorize_read_project! | ||
7 | + before_filter :authorize_code_access! | ||
8 | + before_filter :require_non_empty_project | ||
9 | + | ||
10 | + def show | ||
11 | + respond_to do |format| | ||
12 | + format.html | ||
13 | + # Disable cache so browser history works | ||
14 | + format.js { no_cache_headers } | ||
15 | + end | ||
16 | + end | ||
17 | +end |
@@ -0,0 +1,20 @@ | @@ -0,0 +1,20 @@ | ||
1 | +class Projects::WallsController < Projects::ApplicationController | ||
2 | + before_filter :module_enabled | ||
3 | + | ||
4 | + respond_to :js, :html | ||
5 | + | ||
6 | + def show | ||
7 | + @note = @project.notes.new | ||
8 | + | ||
9 | + respond_to do |format| | ||
10 | + format.html | ||
11 | + end | ||
12 | + end | ||
13 | + | ||
14 | + protected | ||
15 | + | ||
16 | + def module_enabled | ||
17 | + return render_404 unless @project.wall_enabled | ||
18 | + end | ||
19 | +end | ||
20 | + |
@@ -0,0 +1,95 @@ | @@ -0,0 +1,95 @@ | ||
1 | +class Projects::WikisController < Projects::ApplicationController | ||
2 | + before_filter :authorize_read_wiki! | ||
3 | + before_filter :authorize_write_wiki!, only: [:edit, :create, :history] | ||
4 | + before_filter :authorize_admin_wiki!, only: :destroy | ||
5 | + before_filter :load_gollum_wiki | ||
6 | + | ||
7 | + def pages | ||
8 | + @wiki_pages = @gollum_wiki.pages | ||
9 | + end | ||
10 | + | ||
11 | + def show | ||
12 | + @wiki = @gollum_wiki.find_page(params[:id], params[:version_id]) | ||
13 | + | ||
14 | + if @wiki | ||
15 | + render 'show' | ||
16 | + else | ||
17 | + return render('empty') unless can?(current_user, :write_wiki, @project) | ||
18 | + @wiki = WikiPage.new(@gollum_wiki) | ||
19 | + @wiki.title = params[:id] | ||
20 | + | ||
21 | + render 'edit' | ||
22 | + end | ||
23 | + end | ||
24 | + | ||
25 | + def edit | ||
26 | + @wiki = @gollum_wiki.find_page(params[:id]) | ||
27 | + end | ||
28 | + | ||
29 | + def update | ||
30 | + @wiki = @gollum_wiki.find_page(params[:id]) | ||
31 | + | ||
32 | + return render('empty') unless can?(current_user, :write_wiki, @project) | ||
33 | + | ||
34 | + if @wiki.update(content, format, message) | ||
35 | + redirect_to [@project, @wiki], notice: 'Wiki was successfully updated.' | ||
36 | + else | ||
37 | + render 'edit' | ||
38 | + end | ||
39 | + end | ||
40 | + | ||
41 | + def create | ||
42 | + @wiki = WikiPage.new(@gollum_wiki) | ||
43 | + | ||
44 | + if @wiki.create(wiki_params) | ||
45 | + redirect_to project_wiki_path(@project, @wiki), notice: 'Wiki was successfully updated.' | ||
46 | + else | ||
47 | + render action: "edit" | ||
48 | + end | ||
49 | + end | ||
50 | + | ||
51 | + def history | ||
52 | + @wiki = @gollum_wiki.find_page(params[:id]) | ||
53 | + | ||
54 | + redirect_to(project_wiki_path(@project, :home), notice: "Page not found") unless @wiki | ||
55 | + end | ||
56 | + | ||
57 | + def destroy | ||
58 | + @wiki = @gollum_wiki.find_page(params[:id]) | ||
59 | + @wiki.delete if @wiki | ||
60 | + redirect_to project_wiki_path(@project, :home), notice: "Page was successfully deleted" | ||
61 | + end | ||
62 | + | ||
63 | + def git_access | ||
64 | + end | ||
65 | + | ||
66 | + private | ||
67 | + | ||
68 | + def load_gollum_wiki | ||
69 | + @gollum_wiki = GollumWiki.new(@project, current_user) | ||
70 | + | ||
71 | + # Call #wiki to make sure the Wiki Repo is initialized | ||
72 | + @gollum_wiki.wiki | ||
73 | + rescue GollumWiki::CouldNotCreateWikiError => ex | ||
74 | + flash[:notice] = "Could not create Wiki Repository at this time. Please try again later." | ||
75 | + redirect_to @project | ||
76 | + return false | ||
77 | + end | ||
78 | + | ||
79 | + def wiki_params | ||
80 | + params[:wiki].slice(:title, :content, :format, :message) | ||
81 | + end | ||
82 | + | ||
83 | + def content | ||
84 | + params[:wiki][:content] | ||
85 | + end | ||
86 | + | ||
87 | + def format | ||
88 | + params[:wiki][:format] | ||
89 | + end | ||
90 | + | ||
91 | + def message | ||
92 | + params[:wiki][:message] | ||
93 | + end | ||
94 | + | ||
95 | +end |
app/controllers/projects_controller.rb
1 | -class ProjectsController < ProjectResourceController | 1 | +class ProjectsController < Projects::ApplicationController |
2 | skip_before_filter :project, only: [:new, :create] | 2 | skip_before_filter :project, only: [:new, :create] |
3 | skip_before_filter :repository, only: [:new, :create] | 3 | skip_before_filter :repository, only: [:new, :create] |
4 | 4 |
app/controllers/protected_branches_controller.rb
@@ -1,26 +0,0 @@ | @@ -1,26 +0,0 @@ | ||
1 | -class ProtectedBranchesController < ProjectResourceController | ||
2 | - # Authorize | ||
3 | - before_filter :authorize_read_project! | ||
4 | - before_filter :require_non_empty_project | ||
5 | - | ||
6 | - before_filter :authorize_admin_project!, only: [:destroy, :create] | ||
7 | - | ||
8 | - def index | ||
9 | - @branches = @project.protected_branches.all | ||
10 | - @protected_branch = @project.protected_branches.new | ||
11 | - end | ||
12 | - | ||
13 | - def create | ||
14 | - @project.protected_branches.create(params[:protected_branch]) | ||
15 | - redirect_to project_protected_branches_path(@project) | ||
16 | - end | ||
17 | - | ||
18 | - def destroy | ||
19 | - @project.protected_branches.find(params[:id]).destroy | ||
20 | - | ||
21 | - respond_to do |format| | ||
22 | - format.html { redirect_to project_protected_branches_path } | ||
23 | - format.js { render nothing: true } | ||
24 | - end | ||
25 | - end | ||
26 | -end |
app/controllers/raw_controller.rb
@@ -1,25 +0,0 @@ | @@ -1,25 +0,0 @@ | ||
1 | -# Controller for viewing a file's raw | ||
2 | -class RawController < ProjectResourceController | ||
3 | - include ExtractsPath | ||
4 | - | ||
5 | - # Authorize | ||
6 | - before_filter :authorize_read_project! | ||
7 | - before_filter :authorize_code_access! | ||
8 | - before_filter :require_non_empty_project | ||
9 | - | ||
10 | - def show | ||
11 | - @blob = Gitlab::Git::Blob.new(@repository, @commit.id, @ref, @path) | ||
12 | - | ||
13 | - if @blob.exists? | ||
14 | - send_data( | ||
15 | - @blob.data, | ||
16 | - type: @blob.mime_type, | ||
17 | - disposition: 'inline', | ||
18 | - filename: @blob.name | ||
19 | - ) | ||
20 | - else | ||
21 | - not_found! | ||
22 | - end | ||
23 | - end | ||
24 | -end | ||
25 | - |
app/controllers/refs_controller.rb
@@ -1,43 +0,0 @@ | @@ -1,43 +0,0 @@ | ||
1 | -class RefsController < ProjectResourceController | ||
2 | - include ExtractsPath | ||
3 | - | ||
4 | - # Authorize | ||
5 | - before_filter :authorize_read_project! | ||
6 | - before_filter :authorize_code_access! | ||
7 | - before_filter :require_non_empty_project | ||
8 | - | ||
9 | - def switch | ||
10 | - respond_to do |format| | ||
11 | - format.html do | ||
12 | - new_path = if params[:destination] == "tree" | ||
13 | - project_tree_path(@project, (@id)) | ||
14 | - elsif params[:destination] == "blob" | ||
15 | - project_blob_path(@project, (@id)) | ||
16 | - elsif params[:destination] == "graph" | ||
17 | - project_network_path(@project, @id, @options) | ||
18 | - else | ||
19 | - project_commits_path(@project, @id) | ||
20 | - end | ||
21 | - | ||
22 | - redirect_to new_path | ||
23 | - end | ||
24 | - format.js do | ||
25 | - @ref = params[:ref] | ||
26 | - define_tree_vars | ||
27 | - render "tree" | ||
28 | - end | ||
29 | - end | ||
30 | - end | ||
31 | - | ||
32 | - def logs_tree | ||
33 | - contents = @tree.entries | ||
34 | - @logs = contents.map do |content| | ||
35 | - file = params[:path] ? File.join(params[:path], content.name) : content.name | ||
36 | - last_commit = @repo.commits(@commit.id, file, 1).last | ||
37 | - { | ||
38 | - file_name: content.name, | ||
39 | - commit: last_commit | ||
40 | - } | ||
41 | - end | ||
42 | - end | ||
43 | -end |
app/controllers/repositories_controller.rb
@@ -1,41 +0,0 @@ | @@ -1,41 +0,0 @@ | ||
1 | -class RepositoriesController < ProjectResourceController | ||
2 | - # Authorize | ||
3 | - before_filter :authorize_read_project! | ||
4 | - before_filter :authorize_code_access! | ||
5 | - before_filter :require_non_empty_project | ||
6 | - | ||
7 | - def show | ||
8 | - @activities = @repository.commits_with_refs(20) | ||
9 | - end | ||
10 | - | ||
11 | - def branches | ||
12 | - @branches = @repository.branches | ||
13 | - end | ||
14 | - | ||
15 | - def tags | ||
16 | - @tags = @repository.tags | ||
17 | - end | ||
18 | - | ||
19 | - def stats | ||
20 | - @stats = Gitlab::Git::Stats.new(@repository.raw, @repository.root_ref) | ||
21 | - @graph = @stats.graph | ||
22 | - end | ||
23 | - | ||
24 | - def archive | ||
25 | - unless can?(current_user, :download_code, @project) | ||
26 | - render_404 and return | ||
27 | - end | ||
28 | - | ||
29 | - | ||
30 | - storage_path = Rails.root.join("tmp", "repositories") | ||
31 | - | ||
32 | - file_path = @repository.archive_repo(params[:ref], storage_path) | ||
33 | - | ||
34 | - if file_path | ||
35 | - # Send file to user | ||
36 | - send_file file_path | ||
37 | - else | ||
38 | - render_404 | ||
39 | - end | ||
40 | - end | ||
41 | -end |
app/controllers/services_controller.rb
@@ -1,39 +0,0 @@ | @@ -1,39 +0,0 @@ | ||
1 | -class ServicesController < ProjectResourceController | ||
2 | - # Authorize | ||
3 | - before_filter :authorize_admin_project! | ||
4 | - before_filter :service, only: [:edit, :update, :test] | ||
5 | - | ||
6 | - respond_to :html | ||
7 | - | ||
8 | - layout "project_settings" | ||
9 | - | ||
10 | - def index | ||
11 | - @project.build_missing_services | ||
12 | - @services = @project.services.reload | ||
13 | - end | ||
14 | - | ||
15 | - def edit | ||
16 | - end | ||
17 | - | ||
18 | - def update | ||
19 | - if @service.update_attributes(params[:service]) | ||
20 | - redirect_to edit_project_service_path(@project, @service.to_param) | ||
21 | - else | ||
22 | - render 'edit' | ||
23 | - end | ||
24 | - end | ||
25 | - | ||
26 | - def test | ||
27 | - data = GitPushService.new.sample_data(project, current_user) | ||
28 | - | ||
29 | - @service.execute(data) | ||
30 | - | ||
31 | - redirect_to :back | ||
32 | - end | ||
33 | - | ||
34 | - private | ||
35 | - | ||
36 | - def service | ||
37 | - @service ||= @project.services.find { |service| service.to_param == params[:id] } | ||
38 | - end | ||
39 | -end |
app/controllers/team_members_controller.rb
@@ -1,62 +0,0 @@ | @@ -1,62 +0,0 @@ | ||
1 | -class TeamMembersController < ProjectResourceController | ||
2 | - # Authorize | ||
3 | - before_filter :authorize_read_project! | ||
4 | - before_filter :authorize_admin_project!, except: [:index, :show] | ||
5 | - | ||
6 | - layout "project_settings" | ||
7 | - | ||
8 | - def index | ||
9 | - @group = @project.group | ||
10 | - @users_projects = @project.users_projects.order('project_access DESC') | ||
11 | - end | ||
12 | - | ||
13 | - def new | ||
14 | - @user_project_relation = project.users_projects.new | ||
15 | - end | ||
16 | - | ||
17 | - def create | ||
18 | - users = User.where(id: params[:user_ids].split(',')) | ||
19 | - | ||
20 | - @project.team << [users, params[:project_access]] | ||
21 | - | ||
22 | - if params[:redirect_to] | ||
23 | - redirect_to params[:redirect_to] | ||
24 | - else | ||
25 | - redirect_to project_team_index_path(@project) | ||
26 | - end | ||
27 | - end | ||
28 | - | ||
29 | - def update | ||
30 | - @user_project_relation = project.users_projects.find_by_user_id(member) | ||
31 | - @user_project_relation.update_attributes(params[:team_member]) | ||
32 | - | ||
33 | - unless @user_project_relation.valid? | ||
34 | - flash[:alert] = "User should have at least one role" | ||
35 | - end | ||
36 | - redirect_to project_team_index_path(@project) | ||
37 | - end | ||
38 | - | ||
39 | - def destroy | ||
40 | - @user_project_relation = project.users_projects.find_by_user_id(member) | ||
41 | - @user_project_relation.destroy | ||
42 | - | ||
43 | - respond_to do |format| | ||
44 | - format.html { redirect_to project_team_index_path(@project) } | ||
45 | - format.js { render nothing: true } | ||
46 | - end | ||
47 | - end | ||
48 | - | ||
49 | - def apply_import | ||
50 | - giver = Project.find(params[:source_project_id]) | ||
51 | - status = @project.team.import(giver) | ||
52 | - notice = status ? "Succesfully imported" : "Import failed" | ||
53 | - | ||
54 | - redirect_to project_team_index_path(project), notice: notice | ||
55 | - end | ||
56 | - | ||
57 | - protected | ||
58 | - | ||
59 | - def member | ||
60 | - @member ||= User.find_by_username(params[:id]) | ||
61 | - end | ||
62 | -end |
app/controllers/tree_controller.rb
@@ -1,17 +0,0 @@ | @@ -1,17 +0,0 @@ | ||
1 | -# Controller for viewing a repository's file structure | ||
2 | -class TreeController < ProjectResourceController | ||
3 | - include ExtractsPath | ||
4 | - | ||
5 | - # Authorize | ||
6 | - before_filter :authorize_read_project! | ||
7 | - before_filter :authorize_code_access! | ||
8 | - before_filter :require_non_empty_project | ||
9 | - | ||
10 | - def show | ||
11 | - respond_to do |format| | ||
12 | - format.html | ||
13 | - # Disable cache so browser history works | ||
14 | - format.js { no_cache_headers } | ||
15 | - end | ||
16 | - end | ||
17 | -end |
app/controllers/walls_controller.rb
@@ -1,20 +0,0 @@ | @@ -1,20 +0,0 @@ | ||
1 | -class WallsController < ProjectResourceController | ||
2 | - before_filter :module_enabled | ||
3 | - | ||
4 | - respond_to :js, :html | ||
5 | - | ||
6 | - def show | ||
7 | - @note = @project.notes.new | ||
8 | - | ||
9 | - respond_to do |format| | ||
10 | - format.html | ||
11 | - end | ||
12 | - end | ||
13 | - | ||
14 | - protected | ||
15 | - | ||
16 | - def module_enabled | ||
17 | - return render_404 unless @project.wall_enabled | ||
18 | - end | ||
19 | -end | ||
20 | - |
app/controllers/wikis_controller.rb
@@ -1,95 +0,0 @@ | @@ -1,95 +0,0 @@ | ||
1 | -class WikisController < ProjectResourceController | ||
2 | - before_filter :authorize_read_wiki! | ||
3 | - before_filter :authorize_write_wiki!, only: [:edit, :create, :history] | ||
4 | - before_filter :authorize_admin_wiki!, only: :destroy | ||
5 | - before_filter :load_gollum_wiki | ||
6 | - | ||
7 | - def pages | ||
8 | - @wiki_pages = @gollum_wiki.pages | ||
9 | - end | ||
10 | - | ||
11 | - def show | ||
12 | - @wiki = @gollum_wiki.find_page(params[:id], params[:version_id]) | ||
13 | - | ||
14 | - if @wiki | ||
15 | - render 'show' | ||
16 | - else | ||
17 | - return render('empty') unless can?(current_user, :write_wiki, @project) | ||
18 | - @wiki = WikiPage.new(@gollum_wiki) | ||
19 | - @wiki.title = params[:id] | ||
20 | - | ||
21 | - render 'edit' | ||
22 | - end | ||
23 | - end | ||
24 | - | ||
25 | - def edit | ||
26 | - @wiki = @gollum_wiki.find_page(params[:id]) | ||
27 | - end | ||
28 | - | ||
29 | - def update | ||
30 | - @wiki = @gollum_wiki.find_page(params[:id]) | ||
31 | - | ||
32 | - return render('empty') unless can?(current_user, :write_wiki, @project) | ||
33 | - | ||
34 | - if @wiki.update(content, format, message) | ||
35 | - redirect_to [@project, @wiki], notice: 'Wiki was successfully updated.' | ||
36 | - else | ||
37 | - render 'edit' | ||
38 | - end | ||
39 | - end | ||
40 | - | ||
41 | - def create | ||
42 | - @wiki = WikiPage.new(@gollum_wiki) | ||
43 | - | ||
44 | - if @wiki.create(wiki_params) | ||
45 | - redirect_to project_wiki_path(@project, @wiki), notice: 'Wiki was successfully updated.' | ||
46 | - else | ||
47 | - render action: "edit" | ||
48 | - end | ||
49 | - end | ||
50 | - | ||
51 | - def history | ||
52 | - @wiki = @gollum_wiki.find_page(params[:id]) | ||
53 | - | ||
54 | - redirect_to(project_wiki_path(@project, :home), notice: "Page not found") unless @wiki | ||
55 | - end | ||
56 | - | ||
57 | - def destroy | ||
58 | - @wiki = @gollum_wiki.find_page(params[:id]) | ||
59 | - @wiki.delete if @wiki | ||
60 | - redirect_to project_wiki_path(@project, :home), notice: "Page was successfully deleted" | ||
61 | - end | ||
62 | - | ||
63 | - def git_access | ||
64 | - end | ||
65 | - | ||
66 | - private | ||
67 | - | ||
68 | - def load_gollum_wiki | ||
69 | - @gollum_wiki = GollumWiki.new(@project, current_user) | ||
70 | - | ||
71 | - # Call #wiki to make sure the Wiki Repo is initialized | ||
72 | - @gollum_wiki.wiki | ||
73 | - rescue GollumWiki::CouldNotCreateWikiError => ex | ||
74 | - flash[:notice] = "Could not create Wiki Repository at this time. Please try again later." | ||
75 | - redirect_to @project | ||
76 | - return false | ||
77 | - end | ||
78 | - | ||
79 | - def wiki_params | ||
80 | - params[:wiki].slice(:title, :content, :format, :message) | ||
81 | - end | ||
82 | - | ||
83 | - def content | ||
84 | - params[:wiki][:content] | ||
85 | - end | ||
86 | - | ||
87 | - def format | ||
88 | - params[:wiki][:format] | ||
89 | - end | ||
90 | - | ||
91 | - def message | ||
92 | - params[:wiki][:message] | ||
93 | - end | ||
94 | - | ||
95 | -end |
app/helpers/commits_helper.rb
@@ -109,7 +109,7 @@ module CommitsHelper | @@ -109,7 +109,7 @@ module CommitsHelper | ||
109 | end | 109 | end |
110 | 110 | ||
111 | def commit_to_html commit | 111 | def commit_to_html commit |
112 | - escape_javascript(render 'commits/commit', commit: commit) | 112 | + escape_javascript(render 'projects/commits/commit', commit: commit) |
113 | end | 113 | end |
114 | 114 | ||
115 | def diff_line_content(line) | 115 | def diff_line_content(line) |
app/helpers/tree_helper.rb
@@ -10,13 +10,13 @@ module TreeHelper | @@ -10,13 +10,13 @@ module TreeHelper | ||
10 | tree = "" | 10 | tree = "" |
11 | 11 | ||
12 | # Render folders if we have any | 12 | # Render folders if we have any |
13 | - tree += render partial: 'tree/tree_item', collection: folders, locals: {type: 'folder'} if folders.present? | 13 | + tree += render partial: 'projects/tree/tree_item', collection: folders, locals: {type: 'folder'} if folders.present? |
14 | 14 | ||
15 | # Render files if we have any | 15 | # Render files if we have any |
16 | - tree += render partial: 'tree/blob_item', collection: files, locals: {type: 'file'} if files.present? | 16 | + tree += render partial: 'projects/tree/blob_item', collection: files, locals: {type: 'file'} if files.present? |
17 | 17 | ||
18 | # Render submodules if we have any | 18 | # Render submodules if we have any |
19 | - tree += render partial: 'tree/submodule_item', collection: submodules if submodules.present? | 19 | + tree += render partial: 'projects/tree/submodule_item', collection: submodules if submodules.present? |
20 | 20 | ||
21 | tree.html_safe | 21 | tree.html_safe |
22 | end | 22 | end |
app/views/blame/_head.html.haml
app/views/blame/show.html.haml
@@ -1,49 +0,0 @@ | @@ -1,49 +0,0 @@ | ||
1 | -= render "head" | ||
2 | - | ||
3 | -#tree-holder.tree-holder | ||
4 | - %ul.breadcrumb | ||
5 | - %li | ||
6 | - %i.icon-angle-right | ||
7 | - = link_to project_tree_path(@project, @ref) do | ||
8 | - = @project.name | ||
9 | - - tree_breadcrumbs(@tree, 6) do |link| | ||
10 | - \/ | ||
11 | - %li= link | ||
12 | - .clear | ||
13 | - | ||
14 | - .file_holder | ||
15 | - .file_title | ||
16 | - %i.icon-file | ||
17 | - %span.file_name | ||
18 | - = @blob.name | ||
19 | - %small= number_to_human_size @blob.size | ||
20 | - %span.options= render "blob/actions" | ||
21 | - .file_content.blame | ||
22 | - %table | ||
23 | - - current_line = 1 | ||
24 | - - @blame.each do |commit, lines| | ||
25 | - - commit = Commit.new(commit) | ||
26 | - %tr | ||
27 | - %td.blame-commit | ||
28 | - %span.commit | ||
29 | - = link_to commit.short_id(8), project_commit_path(@project, commit), class: "commit_short_id" | ||
30 | - | ||
31 | - = commit_author_link(commit, avatar: true, size: 16) | ||
32 | - | ||
33 | - = link_to_gfm truncate(commit.title, length: 20), project_commit_path(@project, commit.id), class: "row_title" | ||
34 | - %td.lines.blame-numbers | ||
35 | - %pre | ||
36 | - - if lines.empty? | ||
37 | - = current_line | ||
38 | - - current_line += 1 | ||
39 | - - else | ||
40 | - - lines.each do |line| | ||
41 | - = current_line | ||
42 | - \ | ||
43 | - - current_line += 1 | ||
44 | - %td.lines | ||
45 | - %pre | ||
46 | - :erb | ||
47 | - <% lines.each do |line| %> | ||
48 | - <%= line %> | ||
49 | - <% end %> |
app/views/blob/_actions.html.haml
@@ -1,12 +0,0 @@ | @@ -1,12 +0,0 @@ | ||
1 | -.btn-group.tree-btn-group | ||
2 | - -# only show edit link for text files | ||
3 | - - if @blob.text? | ||
4 | - = link_to "edit", project_edit_tree_path(@project, @id), class: "btn btn-tiny", disabled: !allowed_tree_edit? | ||
5 | - = link_to "raw", project_raw_path(@project, @id), class: "btn btn-tiny", target: "_blank" | ||
6 | - -# only show normal/blame view links for text files | ||
7 | - - if @blob.text? | ||
8 | - - if current_page? project_blame_path(@project, @id) | ||
9 | - = link_to "normal view", project_blob_path(@project, @id), class: "btn btn-tiny" | ||
10 | - - else | ||
11 | - = link_to "blame", project_blame_path(@project, @id), class: "btn btn-tiny" unless @blob.empty? | ||
12 | - = link_to "history", project_commits_path(@project, @id), class: "btn btn-tiny" |
app/views/blob/_blob.html.haml
@@ -1,32 +0,0 @@ | @@ -1,32 +0,0 @@ | ||
1 | -%ul.breadcrumb | ||
2 | - %li | ||
3 | - %i.icon-angle-right | ||
4 | - = link_to project_tree_path(@project, @ref) do | ||
5 | - = @project.path | ||
6 | - - tree_breadcrumbs(@tree, 6) do |title, path| | ||
7 | - \/ | ||
8 | - %li | ||
9 | - - if path | ||
10 | - - if path.end_with?(@path) | ||
11 | - = link_to project_blob_path(@project, path) do | ||
12 | - %span.cblue | ||
13 | - = truncate(title, length: 40) | ||
14 | - - else | ||
15 | - = link_to truncate(title, length: 40), project_tree_path(@project, path) | ||
16 | - - else | ||
17 | - = link_to title, '#' | ||
18 | - | ||
19 | -%div#tree-content-holder.tree-content-holder | ||
20 | - .file_holder | ||
21 | - .file_title | ||
22 | - %i.icon-file | ||
23 | - %span.file_name | ||
24 | - = blob.name | ||
25 | - %small= number_to_human_size blob.size | ||
26 | - %span.options= render "actions" | ||
27 | - - if blob.text? | ||
28 | - = render "text", blob: blob | ||
29 | - - elsif blob.image? | ||
30 | - = render "image", blob: blob | ||
31 | - - else | ||
32 | - = render "download", blob: blob |
app/views/blob/_download.html.haml
app/views/blob/_image.html.haml
app/views/blob/_text.html.haml
@@ -1,14 +0,0 @@ | @@ -1,14 +0,0 @@ | ||
1 | -- if gitlab_markdown?(blob.name) | ||
2 | - .file_content.wiki | ||
3 | - = preserve do | ||
4 | - = markdown(blob.data) | ||
5 | -- elsif markup?(blob.name) | ||
6 | - .file_content.wiki | ||
7 | - = raw GitHub::Markup.render(blob.name, blob.data) | ||
8 | -- else | ||
9 | - .file_content.code | ||
10 | - - unless blob.empty? | ||
11 | - %div{class: user_color_scheme_class} | ||
12 | - = raw blob.colorize(formatter: :gitlab) | ||
13 | - - else | ||
14 | - %p.nothing_here_message Empty file |
app/views/blob/show.html.haml
app/views/commit/_commit_box.html.haml
@@ -1,50 +0,0 @@ | @@ -1,50 +0,0 @@ | ||
1 | -.ui-box.ui-box-show | ||
2 | - .ui-box-head | ||
3 | - .pull-right | ||
4 | - - if @notes_count > 0 | ||
5 | - %span.btn.disabled.grouped | ||
6 | - %i.icon-comment | ||
7 | - = @notes_count | ||
8 | - .left.btn-group | ||
9 | - %a.btn.grouped.dropdown-toggle{ data: {toggle: :dropdown} } | ||
10 | - %i.icon-download-alt | ||
11 | - Download as | ||
12 | - %span.caret | ||
13 | - %ul.dropdown-menu | ||
14 | - %li= link_to "Email Patches", project_commit_path(@project, @commit, format: :patch) | ||
15 | - %li= link_to "Plain Diff", project_commit_path(@project, @commit, format: :diff) | ||
16 | - = link_to project_tree_path(@project, @commit), class: "btn btn-primary grouped" do | ||
17 | - %span Browse Code » | ||
18 | - %h3.commit-title.page_title | ||
19 | - = gfm escape_once(@commit.title) | ||
20 | - - if @commit.description.present? | ||
21 | - %pre.commit-description | ||
22 | - = gfm escape_once(@commit.description) | ||
23 | - .ui-box-body | ||
24 | - .row | ||
25 | - .span5 | ||
26 | - .author | ||
27 | - = commit_author_link(@commit, avatar: true, size: 32) | ||
28 | - authored | ||
29 | - %time{title: @commit.authored_date.stamp("Aug 21, 2011 9:23pm")} | ||
30 | - #{time_ago_in_words(@commit.authored_date)} ago | ||
31 | - - if @commit.different_committer? | ||
32 | - .committer | ||
33 | - → | ||
34 | - = commit_committer_link(@commit) | ||
35 | - committed | ||
36 | - %time{title: @commit.committed_date.stamp("Aug 21, 2011 9:23pm")} | ||
37 | - #{time_ago_in_words(@commit.committed_date)} ago | ||
38 | - .span6.pull-right | ||
39 | - .pull-right | ||
40 | - .sha-block | ||
41 | - %span.cgray commit | ||
42 | - %span.label_commit= @commit.id | ||
43 | - .clearfix | ||
44 | - .pull-right | ||
45 | - .sha-block | ||
46 | - %span.cgray= pluralize(@commit.parents.count, "parent") | ||
47 | - - @commit.parents.each do |parent| | ||
48 | - = link_to parent.id[0...10], project_commit_path(@project, parent) | ||
49 | - | ||
50 | - |
app/views/commit/huge_commit.html.haml
app/views/commit/show.html.haml
@@ -1,11 +0,0 @@ | @@ -1,11 +0,0 @@ | ||
1 | -= render "commit_box" | ||
2 | - | ||
3 | -- unless @commit.has_zero_stats? | ||
4 | - %p.pull-right.cgray | ||
5 | - This commit has | ||
6 | - %span.cgreen #{@commit.stats.additions} additions | ||
7 | - and | ||
8 | - %span.cred #{@commit.stats.deletions} deletions | ||
9 | - | ||
10 | -= render "commits/diffs", diffs: @commit.diffs | ||
11 | -= render "notes/notes_with_form" |
app/views/commits/_commit.html.haml
@@ -1,21 +0,0 @@ | @@ -1,21 +0,0 @@ | ||
1 | -%li.commit | ||
2 | - .browse_code_link_holder | ||
3 | - %p | ||
4 | - %strong= link_to "Browse Code »", project_tree_path(@project, commit), class: "right" | ||
5 | - %p | ||
6 | - = link_to commit.short_id(8), project_commit_path(@project, commit), class: "commit_short_id" | ||
7 | - = commit_author_link(commit, avatar: true, size: 24) | ||
8 | - | ||
9 | - = link_to_gfm truncate(commit.title, length: 70), project_commit_path(@project, commit.id), class: "row_title" | ||
10 | - | ||
11 | - %time.committed_ago{ datetime: commit.committed_date, title: commit.committed_date.stamp("Aug 21, 2011 9:23pm") } | ||
12 | - = time_ago_in_words(commit.committed_date) | ||
13 | - ago | ||
14 | - | ||
15 | - | ||
16 | - %span.notes_count | ||
17 | - - notes = @project.notes.for_commit_id(commit.id) | ||
18 | - - if notes.any? | ||
19 | - %span.badge.badge-info | ||
20 | - %i.icon-comment | ||
21 | - = notes.count |
app/views/commits/_commits.html.haml
@@ -1,9 +0,0 @@ | @@ -1,9 +0,0 @@ | ||
1 | -- @commits.group_by { |c| c.committed_date.to_date }.sort.reverse.each do |day, commits| | ||
2 | - %div.ui-box | ||
3 | - %h5.title | ||
4 | - %i.icon-calendar | ||
5 | - %span= day.stamp("28 Aug, 2010") | ||
6 | - | ||
7 | - .pull-right | ||
8 | - %small= pluralize(commits.count, 'commit') | ||
9 | - %ul.well-list= render commits |
app/views/commits/_diff_head.html.haml
@@ -1,26 +0,0 @@ | @@ -1,26 +0,0 @@ | ||
1 | -%ul.bordered-list | ||
2 | - - diffs.each_with_index do |diff, i| | ||
3 | - %li | ||
4 | - - if diff.deleted_file | ||
5 | - %span.deleted-file | ||
6 | - %a{href: "#diff-#{i}"} | ||
7 | - %i.icon-minus | ||
8 | - = diff.old_path | ||
9 | - - elsif diff.renamed_file | ||
10 | - %span.renamed-file | ||
11 | - %a{href: "#diff-#{i}"} | ||
12 | - %i.icon-minus | ||
13 | - = diff.old_path | ||
14 | - = "->" | ||
15 | - = diff.new_path | ||
16 | - - elsif diff.new_file | ||
17 | - %span.new-file | ||
18 | - %a{href: "#diff-#{i}"} | ||
19 | - %i.icon-plus | ||
20 | - = diff.new_path | ||
21 | - - else | ||
22 | - %span.edit-file | ||
23 | - %a{href: "#diff-#{i}"} | ||
24 | - %i.icon-adjust | ||
25 | - = diff.new_path | ||
26 | - |
app/views/commits/_diffs.html.haml
@@ -1,49 +0,0 @@ | @@ -1,49 +0,0 @@ | ||
1 | -- if @suppress_diff | ||
2 | - .alert.alert-block | ||
3 | - %p | ||
4 | - %strong Warning! Large commit with more than #{Commit::DIFF_SAFE_SIZE} files changed. | ||
5 | - %p To prevent performance issue we rejected diff information. | ||
6 | - %p | ||
7 | - But if you still want to see diff | ||
8 | - = link_to "click this link", project_commit_path(@project, @commit, force_show_diff: true), class: "underlined_link" | ||
9 | - | ||
10 | -%p.cgray | ||
11 | - Showing #{pluralize(diffs.count, "changed file")} | ||
12 | -.file-stats | ||
13 | - = render "commits/diff_head", diffs: diffs | ||
14 | - | ||
15 | -.files | ||
16 | - - unless @suppress_diff | ||
17 | - - diffs.each_with_index do |diff, i| | ||
18 | - - next if diff.diff.empty? | ||
19 | - - file = Gitlab::Git::Blob.new(@repository, @commit.id, @ref, diff.new_path) | ||
20 | - - file = Gitlab::Git::Blob.new(@repository, @commit.parent_id, @ref, diff.old_path) unless file.exists? | ||
21 | - - next unless file.exists? | ||
22 | - .file{id: "diff-#{i}"} | ||
23 | - .header | ||
24 | - - if diff.deleted_file | ||
25 | - %span= diff.old_path | ||
26 | - | ||
27 | - - if @commit.parent_ids.present? | ||
28 | - = link_to project_blob_path(@project, tree_join(@commit.parent_id, diff.new_path)), {:class => 'btn btn-tiny pull-right view-file'} do | ||
29 | - View file @ | ||
30 | - %span.commit-short-id= @commit.short_id(6) | ||
31 | - - else | ||
32 | - %span= diff.new_path | ||
33 | - - if diff.a_mode && diff.b_mode && diff.a_mode != diff.b_mode | ||
34 | - %span.file-mode= "#{diff.a_mode} → #{diff.b_mode}" | ||
35 | - | ||
36 | - = link_to project_blob_path(@project, tree_join(@commit.id, diff.new_path)), {:class => 'btn btn-tiny pull-right view-file'} do | ||
37 | - View file @ | ||
38 | - %span.commit-short-id= @commit.short_id(6) | ||
39 | - | ||
40 | - .content | ||
41 | - -# Skipp all non non-supported blobs | ||
42 | - - next unless file.respond_to?('text?') | ||
43 | - - if file.text? | ||
44 | - = render "commits/text_file", diff: diff, index: i | ||
45 | - - elsif file.image? | ||
46 | - - old_file = Gitlab::Git::Blob.new(@repository, @commit.parent_id, @ref, diff.old_path) if @commit.parent_id | ||
47 | - = render "commits/image", diff: diff, old_file: old_file, file: file, index: i | ||
48 | - - else | ||
49 | - %p.nothing_here_message No preview for this file type |
app/views/commits/_head.html.haml
@@ -1,27 +0,0 @@ | @@ -1,27 +0,0 @@ | ||
1 | -%ul.nav.nav-tabs | ||
2 | - %li= render partial: 'shared/ref_switcher', locals: {destination: 'commits'} | ||
3 | - | ||
4 | - = nav_link(controller: [:commit, :commits]) do | ||
5 | - = link_to 'Commits', project_commits_path(@project, @repository.root_ref) | ||
6 | - = nav_link(controller: :compare) do | ||
7 | - = link_to 'Compare', project_compare_index_path(@project) | ||
8 | - | ||
9 | - = nav_link(html_options: {class: branches_tab_class}) do | ||
10 | - = link_to project_repository_path(@project) do | ||
11 | - Branches | ||
12 | - %span.badge= @repository.branches.length | ||
13 | - | ||
14 | - = nav_link(controller: :repositories, action: :tags) do | ||
15 | - = link_to tags_project_repository_path(@project) do | ||
16 | - Tags | ||
17 | - %span.badge= @repository.tags.length | ||
18 | - | ||
19 | - = nav_link(controller: :repositories, action: :stats) do | ||
20 | - = link_to stats_project_repository_path(@project) do | ||
21 | - Stats | ||
22 | - | ||
23 | - | ||
24 | - - if current_controller?(:commits) && current_user.private_token | ||
25 | - %li.pull-right | ||
26 | - = link_to project_commits_path(@project, @ref, {format: :atom, private_token: current_user.private_token}), title: "Feed" do | ||
27 | - %i.icon-rss |
app/views/commits/_image.html.haml
@@ -1,63 +0,0 @@ | @@ -1,63 +0,0 @@ | ||
1 | -- if diff.renamed_file || diff.new_file || diff.deleted_file | ||
2 | - .image | ||
3 | - %span.wrap | ||
4 | - .frame{class: image_diff_class(diff)} | ||
5 | - %img{src: "data:#{file.mime_type};base64,#{Base64.encode64(file.data)}"} | ||
6 | - %p.image-info= "#{number_to_human_size file.size}" | ||
7 | -- else | ||
8 | - .image | ||
9 | - %div.two-up.view | ||
10 | - %span.wrap | ||
11 | - .frame.deleted | ||
12 | - %a{href: project_tree_path(@project, tree_join(@commit.id, diff.old_path))} | ||
13 | - %img{src: "data:#{old_file.mime_type};base64,#{Base64.encode64(old_file.data)}"} | ||
14 | - %p.image-info.hide | ||
15 | - %span.meta-filesize= "#{number_to_human_size old_file.size}" | ||
16 | - | | ||
17 | - %b W: | ||
18 | - %span.meta-width | ||
19 | - | | ||
20 | - %b H: | ||
21 | - %span.meta-height | ||
22 | - %span.wrap | ||
23 | - .frame.added | ||
24 | - %a{href: project_tree_path(@project, tree_join(@commit.id, diff.new_path))} | ||
25 | - %img{src: "data:#{file.mime_type};base64,#{Base64.encode64(file.data)}"} | ||
26 | - %p.image-info.hide | ||
27 | - %span.meta-filesize= "#{number_to_human_size file.size}" | ||
28 | - | | ||
29 | - %b W: | ||
30 | - %span.meta-width | ||
31 | - | | ||
32 | - %b H: | ||
33 | - %span.meta-height | ||
34 | - | ||
35 | - %div.swipe.view.hide | ||
36 | - .swipe-frame | ||
37 | - .frame.deleted | ||
38 | - %img{src: "data:#{old_file.mime_type};base64,#{Base64.encode64(old_file.data)}"} | ||
39 | - .swipe-wrap | ||
40 | - .frame.added | ||
41 | - %img{src: "data:#{file.mime_type};base64,#{Base64.encode64(file.data)}"} | ||
42 | - %span.swipe-bar | ||
43 | - %span.top-handle | ||
44 | - %span.bottom-handle | ||
45 | - | ||
46 | - %div.onion-skin.view.hide | ||
47 | - .onion-skin-frame | ||
48 | - .frame.deleted | ||
49 | - %img{src: "data:#{old_file.mime_type};base64,#{Base64.encode64(old_file.data)}"} | ||
50 | - .frame.added | ||
51 | - %img{src: "data:#{file.mime_type};base64,#{Base64.encode64(file.data)}"} | ||
52 | - .controls | ||
53 | - .transparent | ||
54 | - .drag-track | ||
55 | - .dragger{:style => "left: 0px;"} | ||
56 | - .opaque | ||
57 | - | ||
58 | - | ||
59 | - .view-modes.hide | ||
60 | - %ul.view-modes-menu | ||
61 | - %li.two-up{data: {mode: 'two-up'}} 2-up | ||
62 | - %li.swipe{data: {mode: 'swipe'}} Swipe | ||
63 | - %li.onion-skin{data: {mode: 'onion-skin'}} Onion skin | ||
64 | \ No newline at end of file | 0 | \ No newline at end of file |
app/views/commits/_text_file.html.haml
@@ -1,23 +0,0 @@ | @@ -1,23 +0,0 @@ | ||
1 | -- too_big = diff.diff.lines.count > 1000 | ||
2 | -- if too_big | ||
3 | - %a.supp_diff_link Diff suppressed. Click to show | ||
4 | - | ||
5 | -%table.text-file{class: "#{'hide' if too_big}"} | ||
6 | - - each_diff_line(diff, index) do |line, type, line_code, line_new, line_old| | ||
7 | - %tr.line_holder{ id: line_code, class: "#{type}" } | ||
8 | - - if type == "match" | ||
9 | - %td.old_line= "..." | ||
10 | - %td.new_line= "..." | ||
11 | - %td.line_content.matched= line | ||
12 | - - else | ||
13 | - %td.old_line | ||
14 | - = link_to raw(type == "new" ? " " : line_old), "##{line_code}", id: line_code | ||
15 | - - if @comments_allowed | ||
16 | - = render "notes/diff_note_link", line_code: line_code | ||
17 | - %td.new_line= link_to raw(type == "old" ? " " : line_new) , "##{line_code}", id: line_code | ||
18 | - %td.line_content{class: "noteable_line #{type} #{line_code}", "line_code" => line_code}= raw diff_line_content(line) | ||
19 | - | ||
20 | - - if @reply_allowed | ||
21 | - - comments = @line_notes.select { |n| n.line_code == line_code }.sort_by(&:created_at) | ||
22 | - - unless comments.empty? | ||
23 | - = render "notes/diff_notes_with_reply", notes: comments |
app/views/commits/show.atom.builder
@@ -1,23 +0,0 @@ | @@ -1,23 +0,0 @@ | ||
1 | -xml.instruct! | ||
2 | -xml.feed "xmlns" => "http://www.w3.org/2005/Atom", "xmlns:media" => "http://search.yahoo.com/mrss/" do | ||
3 | - xml.title "Recent commits to #{@project.name}:#{@ref}" | ||
4 | - xml.link :href => project_commits_url(@project, @ref, format: :atom), :rel => "self", :type => "application/atom+xml" | ||
5 | - xml.link :href => project_commits_url(@project, @ref), :rel => "alternate", :type => "text/html" | ||
6 | - xml.id project_commits_url(@project) | ||
7 | - xml.updated @commits.first.committed_date.strftime("%Y-%m-%dT%H:%M:%SZ") if @commits.any? | ||
8 | - | ||
9 | - @commits.each do |commit| | ||
10 | - xml.entry do | ||
11 | - xml.id project_commit_url(@project, :id => commit.id) | ||
12 | - xml.link :href => project_commit_url(@project, :id => commit.id) | ||
13 | - xml.title truncate(commit.title, :length => 80) | ||
14 | - xml.updated commit.committed_date.strftime("%Y-%m-%dT%H:%M:%SZ") | ||
15 | - xml.media :thumbnail, :width => "40", :height => "40", :url => gravatar_icon(commit.author_email) | ||
16 | - xml.author do |author| | ||
17 | - xml.name commit.author_name | ||
18 | - xml.email commit.author_email | ||
19 | - end | ||
20 | - xml.summary gfm(commit.description) | ||
21 | - end | ||
22 | - end | ||
23 | -end |
app/views/commits/show.html.haml
@@ -1,15 +0,0 @@ | @@ -1,15 +0,0 @@ | ||
1 | -= render "head" | ||
2 | - | ||
3 | -- if @path.present? | ||
4 | - %ul.breadcrumb | ||
5 | - = commits_breadcrumbs | ||
6 | - | ||
7 | -%div{id: dom_id(@project)} | ||
8 | - #commits-list= render "commits" | ||
9 | -.clear | ||
10 | -.loading{ style: "display:none;"} | ||
11 | - | ||
12 | -- if @commits.count == @limit | ||
13 | - :javascript | ||
14 | - CommitsList.init("#{@ref}", #{@limit}); | ||
15 | - |
app/views/commits/show.js.haml
app/views/compare/_form.html.haml
@@ -1,37 +0,0 @@ | @@ -1,37 +0,0 @@ | ||
1 | -%div | ||
2 | - - unless params[:to] | ||
3 | - %p.slead | ||
4 | - Fill input field with commit id like | ||
5 | - %code.label-branch 4eedf23 | ||
6 | - or branch/tag name like | ||
7 | - %code.label-branch master | ||
8 | - and press compare button for commits list, code diff. | ||
9 | - | ||
10 | - %br | ||
11 | - | ||
12 | - = form_tag project_compare_index_path(@project), method: :post do | ||
13 | - .clearfix | ||
14 | - .pull-left | ||
15 | - - if params[:to] && params[:from] | ||
16 | - = link_to 'switch', {from: params[:to], to: params[:from]}, {class: 'commits-compare-switch has_tooltip', title: 'Switch base of comparison'} | ||
17 | - = text_field_tag :from, params[:from], placeholder: "master", class: "xlarge" | ||
18 | - = "..." | ||
19 | - = text_field_tag :to, params[:to], placeholder: "aa8b4ef", class: "xlarge" | ||
20 | - .pull-left | ||
21 | - | ||
22 | - = submit_tag "Compare", class: "btn btn-primary wide commits-compare-btn" | ||
23 | - - if @refs_are_same | ||
24 | - .alert | ||
25 | - %span Refs are the same | ||
26 | - | ||
27 | - | ||
28 | - | ||
29 | -:javascript | ||
30 | - var availableTags = #{@project.repository.ref_names.to_json}; | ||
31 | - | ||
32 | - $("#from, #to").autocomplete({ | ||
33 | - source: availableTags, | ||
34 | - minLength: 1 | ||
35 | - }); | ||
36 | - | ||
37 | - disableButtonIfEmptyField('#to', '.commits-compare-btn'); |
app/views/compare/index.html.haml
app/views/compare/show.html.haml
@@ -1,23 +0,0 @@ | @@ -1,23 +0,0 @@ | ||
1 | -= render "commits/head" | ||
2 | - | ||
3 | -%h3.page_title | ||
4 | - Compare View | ||
5 | -%hr | ||
6 | - | ||
7 | -= render "form" | ||
8 | - | ||
9 | -- if @commits.size > 100 | ||
10 | - .alert.alert-block | ||
11 | - %p | ||
12 | - %strong Warning! This comparison include 100+ commits. | ||
13 | - %p To prevent performance issue we dont show diff information. | ||
14 | - | ||
15 | -- if @commits.present? | ||
16 | - %div.ui-box | ||
17 | - %h5.title | ||
18 | - Commits (#{@commits.count}) | ||
19 | - %ul.well-list= render Commit.decorate(@commits) | ||
20 | - | ||
21 | - - unless @diffs.empty? | ||
22 | - %h4 Diff | ||
23 | - = render "commits/diffs", diffs: @diffs |
app/views/dashboard/issues.html.haml
@@ -22,7 +22,7 @@ | @@ -22,7 +22,7 @@ | ||
22 | 22 | ||
23 | %ul.well-list.issues-list | 23 | %ul.well-list.issues-list |
24 | - group[1].each do |issue| | 24 | - group[1].each do |issue| |
25 | - = render issue | 25 | + = render 'projects/issues/issue', issue: issue |
26 | %hr | 26 | %hr |
27 | = paginate @issues, theme: "gitlab" | 27 | = paginate @issues, theme: "gitlab" |
28 | - else | 28 | - else |
app/views/deploy_keys/_deploy_key.html.haml
@@ -1,25 +0,0 @@ | @@ -1,25 +0,0 @@ | ||
1 | -%li | ||
2 | - .pull-right | ||
3 | - - if @available_keys.include?(deploy_key) | ||
4 | - = link_to enable_project_deploy_key_path(@project, deploy_key), class: 'btn btn-small', method: :put do | ||
5 | - %i.icon-plus | ||
6 | - Enable | ||
7 | - - else | ||
8 | - - if deploy_key.projects.count > 1 | ||
9 | - = link_to disable_project_deploy_key_path(@project, deploy_key), class: 'btn btn-small', method: :put do | ||
10 | - %i.icon-off | ||
11 | - Disable | ||
12 | - - else | ||
13 | - = link_to 'Remove', project_deploy_key_path(@project, deploy_key), confirm: 'You are going to remove deploy key. Are you sure?', method: :delete, class: "btn btn-remove delete-key btn-small pull-right" | ||
14 | - | ||
15 | - | ||
16 | - = link_to project_deploy_key_path(deploy_key.projects.include?(@project) ? @project : deploy_key.projects.first, deploy_key) do | ||
17 | - %i.icon-key | ||
18 | - %strong= deploy_key.title | ||
19 | - | ||
20 | - %p.light.prepend-top-10 | ||
21 | - - deploy_key.projects.map(&:name_with_namespace).each do |project_name| | ||
22 | - %span.label= project_name | ||
23 | - %small.pull-right | ||
24 | - Created #{time_ago_in_words(deploy_key.created_at)} ago | ||
25 | - |
app/views/deploy_keys/_form.html.haml
@@ -1,23 +0,0 @@ | @@ -1,23 +0,0 @@ | ||
1 | -%div | ||
2 | - = form_for [@project, @key], url: project_deploy_keys_path do |f| | ||
3 | - -if @key.errors.any? | ||
4 | - .alert.alert-error | ||
5 | - %ul | ||
6 | - - @key.errors.full_messages.each do |msg| | ||
7 | - %li= msg | ||
8 | - | ||
9 | - .clearfix | ||
10 | - = f.label :title | ||
11 | - .input= f.text_field :title | ||
12 | - .clearfix | ||
13 | - = f.label :key | ||
14 | - .input | ||
15 | - = f.text_area :key, class: [:xxlarge, :thin_area] | ||
16 | - %p.hint | ||
17 | - Paste a machine public key here. Read more about how generate it | ||
18 | - = link_to "here", help_ssh_path | ||
19 | - | ||
20 | - .actions | ||
21 | - = f.submit 'Create', class: "btn-create btn" | ||
22 | - = link_to "Cancel", project_deploy_keys_path(@project), class: "btn btn-cancel" | ||
23 | - |
app/views/deploy_keys/index.html.haml
@@ -1,30 +0,0 @@ | @@ -1,30 +0,0 @@ | ||
1 | -%p.slead | ||
2 | - Deploy keys allow read-only access to repository. They can be used for CI, staging or production servers | ||
3 | - | ||
4 | -%p | ||
5 | - You can create a deploy key or add existing one | ||
6 | - = link_to new_project_deploy_key_path(@project), class: "btn btn-primary pull-right", title: "New Deploy Key" do | ||
7 | - %i.icon-plus | ||
8 | - New Deploy Key | ||
9 | - | ||
10 | -%hr.clearfix | ||
11 | - | ||
12 | -.row | ||
13 | - .span5.enabled-keys | ||
14 | - %h5.cgreen | ||
15 | - Enabled deploy keys | ||
16 | - %small for this project | ||
17 | - %ul.bordered-list | ||
18 | - = render @enabled_keys | ||
19 | - - if @enabled_keys.blank? | ||
20 | - .light-well | ||
21 | - %p.nothing_here_message Create #{link_to 'new deploy key', new_project_deploy_key_path(@project)} or add existing one | ||
22 | - .span5.available-keys | ||
23 | - %h5 | ||
24 | - Available deploy keys | ||
25 | - %small from projects you are able to manage | ||
26 | - %ul.bordered-list | ||
27 | - = render @available_keys | ||
28 | - - if @available_keys.blank? | ||
29 | - .light-well | ||
30 | - %p.nothing_here_message All deploy keys created in projects you own will be displayed here |
app/views/deploy_keys/new.html.haml
app/views/deploy_keys/show.html.haml
@@ -1,13 +0,0 @@ | @@ -1,13 +0,0 @@ | ||
1 | -%h3.page_title | ||
2 | - Deploy key: | ||
3 | - = @key.title | ||
4 | - %small | ||
5 | - created at | ||
6 | - = @key.created_at.stamp("Aug 21, 2011") | ||
7 | -.back_link | ||
8 | - = link_to project_deploy_keys_path(@project) do | ||
9 | - ← To keys list | ||
10 | -%hr | ||
11 | -%pre= @key.key | ||
12 | -.pull-right | ||
13 | - = link_to 'Remove', project_deploy_key_path(@project, @key), confirm: 'Are you sure?', method: :delete, class: "btn-remove btn delete-key" |
app/views/edit_tree/show.html.haml
@@ -1,45 +0,0 @@ | @@ -1,45 +0,0 @@ | ||
1 | -.file-editor | ||
2 | - = form_tag(project_edit_tree_path(@project, @id), method: :put, class: "form-horizontal") do | ||
3 | - .file_holder | ||
4 | - .file_title | ||
5 | - %i.icon-file | ||
6 | - %span.file_name | ||
7 | - = @path | ||
8 | - %small | ||
9 | - on | ||
10 | - %strong= @ref | ||
11 | - %span.options | ||
12 | - .btn-group.tree-btn-group | ||
13 | - = link_to "Cancel", project_blob_path(@project, @id), class: "btn btn-tiny btn-cancel", confirm: leave_edit_message | ||
14 | - .file_content.code | ||
15 | - %pre#editor= @blob.data | ||
16 | - | ||
17 | - .control-group.commit_message-group | ||
18 | - = label_tag 'commit_message', class: "control-label" do | ||
19 | - Commit message | ||
20 | - .controls | ||
21 | - = text_area_tag 'commit_message', '', placeholder: "Update #{@blob.name}", required: true, rows: 3 | ||
22 | - .form-actions | ||
23 | - = hidden_field_tag 'last_commit', @last_commit | ||
24 | - = hidden_field_tag 'content', '', id: :file_content | ||
25 | - .commit-button-annotation | ||
26 | - = button_tag "Commit changes", class: 'btn commit-btn js-commit-button btn-primary' | ||
27 | - .message | ||
28 | - to branch | ||
29 | - %strong= @ref | ||
30 | - = link_to "Cancel", project_blob_path(@project, @id), class: "btn btn-cancel", confirm: leave_edit_message | ||
31 | - | ||
32 | -:javascript | ||
33 | - ace.config.set("modePath", "#{Gitlab::Application.config.assets.prefix}/ace-src-noconflict") | ||
34 | - var ace_mode = "#{@blob.language.try(:ace_mode)}"; | ||
35 | - var editor = ace.edit("editor"); | ||
36 | - if (ace_mode) { | ||
37 | - editor.getSession().setMode('ace/mode/' + ace_mode); | ||
38 | - } | ||
39 | - | ||
40 | - disableButtonIfEmptyField("#commit_message", ".js-commit-button"); | ||
41 | - | ||
42 | - $(".js-commit-button").click(function(){ | ||
43 | - $("#file_content").val(editor.getValue()); | ||
44 | - $(".file-editor form").submit(); | ||
45 | - }); |
app/views/graphs/show.html.haml
@@ -1,31 +0,0 @@ | @@ -1,31 +0,0 @@ | ||
1 | -.loading-graph | ||
2 | - %center | ||
3 | - .loading | ||
4 | - %h3.page_title Building repository graph. Please wait a moment. | ||
5 | - | ||
6 | -.stat-graph | ||
7 | - .header.clearfix | ||
8 | - .pull-right | ||
9 | - %select | ||
10 | - %option{:value => "commits"} Commits | ||
11 | - %option{:value => "additions"} Additions | ||
12 | - %option{:value => "deletions"} Deletions | ||
13 | - %h3#date_header.page_title | ||
14 | - %input#brush_change{:type => "hidden"} | ||
15 | - .graphs | ||
16 | - #contributors-master | ||
17 | - #contributors.clearfix | ||
18 | - %ol.contributors-list.clearfix | ||
19 | - | ||
20 | -:javascript | ||
21 | - $(".stat-graph").hide(); | ||
22 | - | ||
23 | - $.ajax({ | ||
24 | - type: "GET", | ||
25 | - url: location.href, | ||
26 | - complete: function() { | ||
27 | - $(".loading-graph").hide(); | ||
28 | - $(".stat-graph").show(); | ||
29 | - }, | ||
30 | - dataType: "script" | ||
31 | - }); |
app/views/graphs/show.js.haml
@@ -1,16 +0,0 @@ | @@ -1,16 +0,0 @@ | ||
1 | -:plain | ||
2 | - controller = new ContributorsStatGraph | ||
3 | - controller.init(#{@log}) | ||
4 | - | ||
5 | - $("select").change( function () { | ||
6 | - var field = $(this).val() | ||
7 | - controller.set_current_field(field) | ||
8 | - controller.redraw_master() | ||
9 | - controller.redraw_authors() | ||
10 | - }) | ||
11 | - | ||
12 | - $("#brush_change").change( function () { | ||
13 | - controller.change_date_header() | ||
14 | - controller.redraw_authors() | ||
15 | - }) | ||
16 | - |
app/views/groups/issues.html.haml
@@ -16,7 +16,7 @@ | @@ -16,7 +16,7 @@ | ||
16 | = link_to_project project | 16 | = link_to_project project |
17 | %ul.well-list.issues-list | 17 | %ul.well-list.issues-list |
18 | - group[1].each do |issue| | 18 | - group[1].each do |issue| |
19 | - = render issue | 19 | + = render 'projects/issues/issue', issue: issue |
20 | %hr | 20 | %hr |
21 | = paginate @issues, theme: "gitlab" | 21 | = paginate @issues, theme: "gitlab" |
22 | - else | 22 | - else |
app/views/hooks/_data_ex.html.erb
@@ -1,43 +0,0 @@ | @@ -1,43 +0,0 @@ | ||
1 | -<% data_ex_str = <<eos | ||
2 | -{ | ||
3 | - "before": "95790bf891e76fee5e1747ab589903a6a1f80f22", | ||
4 | - "after": "da1560886d4f094c3e6c9ef40349f7d38b5d27d7", | ||
5 | - "ref": "refs/heads/master", | ||
6 | - "user_id": 4, | ||
7 | - "user_name": "John Smith", | ||
8 | - "repository": { | ||
9 | - "name": "Diaspora", | ||
10 | - "url": "git@localhost:diaspora.git", | ||
11 | - "description": "", | ||
12 | - "homepage": "http://localhost/diaspora", | ||
13 | - }, | ||
14 | - "commits": [ | ||
15 | - { | ||
16 | - "id": "b6568db1bc1dcd7f8b4d5a946b0b91f9dacd7327", | ||
17 | - "message": "Update Catalan translation to e38cb41.", | ||
18 | - "timestamp": "2011-12-12T14:27:31+02:00", | ||
19 | - "url": "http://localhost/diaspora/commits/b6568db1bc1dcd7f8b4d5a946b0b91f9dacd7327", | ||
20 | - "author": { | ||
21 | - "name": "Jordi Mallach", | ||
22 | - "email": "jordi@softcatala.org", | ||
23 | - } | ||
24 | - }, | ||
25 | - // ... | ||
26 | - { | ||
27 | - "id": "da1560886d4f094c3e6c9ef40349f7d38b5d27d7", | ||
28 | - "message": "fixed readme", | ||
29 | - "timestamp": "2012-01-03T23:36:29+02:00", | ||
30 | - "url": "http://localhost/diaspora/commits/da1560886d4f094c3e6c9ef40349f7d38b5d27d7", | ||
31 | - "author": { | ||
32 | - "name": "GitLab dev user", | ||
33 | - "email": "gitlabdev@dv6700.(none)", | ||
34 | - }, | ||
35 | - }, | ||
36 | - ], | ||
37 | - "total_commits_count": 4, | ||
38 | -}; | ||
39 | -eos | ||
40 | -%> | ||
41 | -<div class="<%= user_color_scheme_class%>"> | ||
42 | - <%= raw Pygments::Lexer[:js].highlight(data_ex_str) %> | ||
43 | -</div> |
app/views/hooks/index.html.haml
@@ -1,34 +0,0 @@ | @@ -1,34 +0,0 @@ | ||
1 | -- if can? current_user, :admin_project, @project | ||
2 | - .alert.alert-info | ||
3 | - %span | ||
4 | - Post receive hooks for binding events when someone push to repository. | ||
5 | - %br | ||
6 | - Read more about web hooks | ||
7 | - %strong #{link_to "here", help_web_hooks_path, class: "vlink"} | ||
8 | - | ||
9 | -= form_for [@project, @hook], as: :hook, url: project_hooks_path(@project), html: { class: 'form-inline' } do |f| | ||
10 | - -if @hook.errors.any? | ||
11 | - .alert.alert-error | ||
12 | - - @hook.errors.full_messages.each do |msg| | ||
13 | - %p= msg | ||
14 | - .clearfix | ||
15 | - = f.label :url, "URL:" | ||
16 | - .input | ||
17 | - = f.text_field :url, class: "text_field xxlarge" | ||
18 | - | ||
19 | - = f.submit "Add Web Hook", class: "btn btn-create" | ||
20 | -%hr | ||
21 | - | ||
22 | --if @hooks.any? | ||
23 | - .ui-box | ||
24 | - %h5.title | ||
25 | - Hooks (#{@hooks.count}) | ||
26 | - %ul.well-list | ||
27 | - - @hooks.each do |hook| | ||
28 | - %li | ||
29 | - %span.badge.badge-info POST | ||
30 | - → | ||
31 | - %span.monospace= hook.url | ||
32 | - .pull-right | ||
33 | - = link_to 'Test Hook', test_project_hook_path(@project, hook), class: "btn btn-small grouped" | ||
34 | - = link_to 'Remove', project_hook_path(@project, hook), confirm: 'Are you sure?', method: :delete, class: "btn btn-remove btn-small grouped" |
app/views/issues/_filter.html.haml
@@ -1,23 +0,0 @@ | @@ -1,23 +0,0 @@ | ||
1 | -= form_tag project_issues_path(@project), method: 'get' do | ||
2 | - %fieldset | ||
3 | - %ul.nav.nav-pills.nav-stacked | ||
4 | - %li{class: ("active" if !params[:status] || params[:status].blank?)} | ||
5 | - = link_to project_issues_path(@project, status: nil) do | ||
6 | - Open | ||
7 | - %li{class: ("active" if params[:status] == 'assigned-to-me')} | ||
8 | - = link_to project_issues_path(@project, status: 'assigned-to-me') do | ||
9 | - Assigned to me | ||
10 | - %li{class: ("active" if params[:status] == 'created-by-me')} | ||
11 | - = link_to project_issues_path(@project, status: 'created-by-me') do | ||
12 | - Created by me | ||
13 | - %li{class: ("active" if params[:status] == 'closed')} | ||
14 | - = link_to project_issues_path(@project, status: 'closed') do | ||
15 | - Closed | ||
16 | - %li{class: ("active" if params[:status] == 'all')} | ||
17 | - = link_to project_issues_path(@project, status: 'all') do | ||
18 | - All | ||
19 | - | ||
20 | - %fieldset | ||
21 | - %hr | ||
22 | - = link_to "Reset", project_issues_path(@project), class: 'btn pull-right' | ||
23 | - |
app/views/issues/_form.html.haml
@@ -1,95 +0,0 @@ | @@ -1,95 +0,0 @@ | ||
1 | -%div.issue-form-holder | ||
2 | - %h3.page_title= @issue.new_record? ? "New Issue" : "Edit Issue ##{@issue.id}" | ||
3 | - = form_for [@project, @issue] do |f| | ||
4 | - -if @issue.errors.any? | ||
5 | - .alert.alert-error | ||
6 | - - @issue.errors.full_messages.each do |msg| | ||
7 | - %span= msg | ||
8 | - %br | ||
9 | - .ui-box.ui-box-show | ||
10 | - .ui-box-head | ||
11 | - .clearfix | ||
12 | - = f.label :title do | ||
13 | - %strong= "Subject *" | ||
14 | - .input | ||
15 | - = f.text_field :title, maxlength: 255, class: "xxlarge js-gfm-input", autofocus: true, required: true | ||
16 | - .ui-box-body | ||
17 | - .clearfix | ||
18 | - .issue_assignee.pull-left | ||
19 | - = f.label :assignee_id do | ||
20 | - %i.icon-user | ||
21 | - Assign to | ||
22 | - .input | ||
23 | - .pull-left | ||
24 | - = f.select(:assignee_id, @project.team.members.sort_by(&:name).map {|p| [ p.name, p.id ] }, { include_blank: "Select a user" }, {class: 'chosen'}) | ||
25 | - .pull-right | ||
26 | - | ||
27 | - = link_to 'Assign to me', '#', class: 'btn btn-small assign-to-me-link' | ||
28 | - .issue_milestone.pull-left | ||
29 | - = f.label :milestone_id do | ||
30 | - %i.icon-time | ||
31 | - Milestone | ||
32 | - .input= f.select(:milestone_id, @project.milestones.active.all.collect {|p| [ p.title, p.id ] }, { include_blank: "Select milestone" }, {class: 'chosen'}) | ||
33 | - | ||
34 | - .ui-box-bottom | ||
35 | - .clearfix | ||
36 | - = f.label :label_list do | ||
37 | - %i.icon-tag | ||
38 | - Labels | ||
39 | - .input | ||
40 | - = f.text_field :label_list, maxlength: 2000, class: "xxlarge" | ||
41 | - %p.hint Separate with comma. | ||
42 | - | ||
43 | - .clearfix | ||
44 | - = f.label :description, "Details" | ||
45 | - .input | ||
46 | - = f.text_area :description, class: "xxlarge js-gfm-input", rows: 14 | ||
47 | - %p.hint Issues are parsed with #{link_to "GitLab Flavored Markdown", help_markdown_path, target: '_blank'}. | ||
48 | - | ||
49 | - | ||
50 | - .actions | ||
51 | - - if @issue.new_record? | ||
52 | - = f.submit 'Submit new issue', class: "btn btn-create" | ||
53 | - -else | ||
54 | - = f.submit 'Save changes', class: "btn-save btn" | ||
55 | - | ||
56 | - - cancel_path = @issue.new_record? ? project_issues_path(@project) : project_issue_path(@project, @issue) | ||
57 | - = link_to "Cancel", cancel_path, class: 'btn btn-cancel' | ||
58 | - | ||
59 | - | ||
60 | - | ||
61 | - | ||
62 | -:javascript | ||
63 | - $("#issue_label_list") | ||
64 | - .bind( "keydown", function( event ) { | ||
65 | - if ( event.keyCode === $.ui.keyCode.TAB && | ||
66 | - $( this ).data( "autocomplete" ).menu.active ) { | ||
67 | - event.preventDefault(); | ||
68 | - } | ||
69 | - }) | ||
70 | - .bind( "click", function( event ) { | ||
71 | - $( this ).autocomplete("search", ""); | ||
72 | - }) | ||
73 | - .autocomplete({ | ||
74 | - minLength: 0, | ||
75 | - source: function( request, response ) { | ||
76 | - response( $.ui.autocomplete.filter( | ||
77 | - #{raw labels_autocomplete_source}, extractLast( request.term ) ) ); | ||
78 | - }, | ||
79 | - focus: function() { | ||
80 | - return false; | ||
81 | - }, | ||
82 | - select: function(event, ui) { | ||
83 | - var terms = split( this.value ); | ||
84 | - terms.pop(); | ||
85 | - terms.push( ui.item.value ); | ||
86 | - terms.push( "" ); | ||
87 | - this.value = terms.join( ", " ); | ||
88 | - return false; | ||
89 | - } | ||
90 | - }); | ||
91 | - | ||
92 | - $('.assign-to-me-link').on('click', function(e){ | ||
93 | - $('#issue_assignee_id').val("#{current_user.id}").trigger("liszt:updated"); | ||
94 | - e.preventDefault(); | ||
95 | - }); |
app/views/issues/_head.html.haml
@@ -1,10 +0,0 @@ | @@ -1,10 +0,0 @@ | ||
1 | -%ul.nav.nav-tabs | ||
2 | - = nav_link(controller: :issues) do | ||
3 | - = link_to 'Browse Issues', project_issues_path(@project), class: "tab" | ||
4 | - = nav_link(controller: :milestones) do | ||
5 | - = link_to 'Milestones', project_milestones_path(@project), class: "tab" | ||
6 | - = nav_link(controller: :labels) do | ||
7 | - = link_to 'Labels', project_labels_path(@project), class: "tab" | ||
8 | - %li.pull-right | ||
9 | - = link_to project_issues_path(@project, :atom, { private_token: current_user.private_token }) do | ||
10 | - %i.icon-rss |
app/views/issues/_issue.html.haml
@@ -1,44 +0,0 @@ | @@ -1,44 +0,0 @@ | ||
1 | -%li{ id: dom_id(issue), class: issue_css_classes(issue), url: project_issue_path(issue.project, issue) } | ||
2 | - - if controller.controller_name == 'issues' | ||
3 | - .issue-check | ||
4 | - = check_box_tag dom_id(issue,"selected"), nil, false, 'data-id' => issue.id, class: "selected_issue", disabled: !can?(current_user, :modify_issue, issue) | ||
5 | - | ||
6 | - .issue-title | ||
7 | - %span.light= "##{issue.id}" | ||
8 | - = link_to_gfm truncate(issue.title, length: 100), project_issue_path(issue.project, issue), class: "row_title" | ||
9 | - | ||
10 | - .issue-info | ||
11 | - - if issue.assignee | ||
12 | - assigned to #{link_to_member(@project, issue.assignee)} | ||
13 | - - else | ||
14 | - unassigned | ||
15 | - - if issue.votes_count > 0 | ||
16 | - = render 'votes/votes_inline', votable: issue | ||
17 | - - if issue.notes.any? | ||
18 | - %span | ||
19 | - %i.icon-comments | ||
20 | - = issue.notes.count | ||
21 | - - if issue.milestone_id? | ||
22 | - %span | ||
23 | - %i.icon-time | ||
24 | - = issue.milestone.title | ||
25 | - .pull-right | ||
26 | - %small updated #{time_ago_in_words(issue.updated_at)} ago | ||
27 | - | ||
28 | - .issue-labels | ||
29 | - - issue.labels.each do |label| | ||
30 | - %span{class: "label #{label_css_class(label.name)}"} | ||
31 | - %i.icon-tag | ||
32 | - = label.name | ||
33 | - | ||
34 | - .issue-actions | ||
35 | - - if can? current_user, :modify_issue, issue | ||
36 | - - if issue.closed? | ||
37 | - = link_to 'Reopen', project_issue_path(issue.project, issue, issue: {state_event: :reopen }, status_only: true), method: :put, class: "btn btn-small grouped reopen_issue", remote: true | ||
38 | - - else | ||
39 | - = link_to 'Close', project_issue_path(issue.project, issue, issue: {state_event: :close }, status_only: true), method: :put, class: "btn btn-small grouped close_issue", remote: true | ||
40 | - = link_to edit_project_issue_path(issue.project, issue), class: "btn btn-small edit-issue-link grouped" do | ||
41 | - %i.icon-edit | ||
42 | - Edit | ||
43 | - | ||
44 | - |
app/views/issues/_issues.html.haml
@@ -1,94 +0,0 @@ | @@ -1,94 +0,0 @@ | ||
1 | -.ui-box | ||
2 | - .title | ||
3 | - = check_box_tag "check_all_issues", nil, false, class: "check_all_issues left" | ||
4 | - .clearfix | ||
5 | - .issues_bulk_update.hide | ||
6 | - = form_tag bulk_update_project_issues_path(@project), method: :post do | ||
7 | - %span.update_issues_text Update selected issues with | ||
8 | - .left | ||
9 | - = select_tag('update[status]', options_for_select(['open', 'closed']), prompt: "Status") | ||
10 | - = select_tag('update[assignee_id]', options_from_collection_for_select(@project.team.members, "id", "name", params[:assignee_id]), prompt: "Assignee") | ||
11 | - = select_tag('update[milestone_id]', options_from_collection_for_select(issues_active_milestones, "id", "title", params[:milestone_id]), prompt: "Milestone") | ||
12 | - = hidden_field_tag 'update[issues_ids]', [] | ||
13 | - = hidden_field_tag :status, params[:status] | ||
14 | - = button_tag "Save", class: "btn update_selected_issues btn-small btn-save" | ||
15 | - .issues-filters | ||
16 | - %span Filter by | ||
17 | - .dropdown.inline.prepend-left-10 | ||
18 | - %a.dropdown-toggle.btn.btn-small{href: '#', "data-toggle" => "dropdown"} | ||
19 | - %i.icon-tags | ||
20 | - %span.light labels: | ||
21 | - - if params[:label_name].present? | ||
22 | - %strong= params[:label_name] | ||
23 | - - else | ||
24 | - Any | ||
25 | - %b.caret | ||
26 | - %ul.dropdown-menu | ||
27 | - %li | ||
28 | - = link_to project_issues_with_filter_path(@project, label_name: nil) do | ||
29 | - Any | ||
30 | - - issue_label_names.each do |label_name| | ||
31 | - %li | ||
32 | - = link_to project_issues_with_filter_path(@project, label_name: label_name) do | ||
33 | - %span{class: "label #{label_css_class(label_name)}"} | ||
34 | - %i.icon-tag | ||
35 | - = label_name | ||
36 | - .dropdown.inline.prepend-left-10 | ||
37 | - %a.dropdown-toggle.btn.btn-small{href: '#', "data-toggle" => "dropdown"} | ||
38 | - %i.icon-user | ||
39 | - %span.light assignee: | ||
40 | - - if @assignee.present? | ||
41 | - %strong= @assignee.name | ||
42 | - - elsif params[:assignee_id] == "0" | ||
43 | - Unassigned | ||
44 | - - else | ||
45 | - Any | ||
46 | - %b.caret | ||
47 | - %ul.dropdown-menu | ||
48 | - %li | ||
49 | - = link_to project_issues_with_filter_path(@project, assignee_id: nil) do | ||
50 | - Any | ||
51 | - = link_to project_issues_with_filter_path(@project, assignee_id: 0) do | ||
52 | - Unassigned | ||
53 | - - @project.team.members.sort_by(&:name).each do |user| | ||
54 | - %li | ||
55 | - = link_to project_issues_with_filter_path(@project, assignee_id: user.id) do | ||
56 | - = image_tag gravatar_icon(user.email), class: "avatar s16" | ||
57 | - = user.name | ||
58 | - | ||
59 | - .dropdown.inline.prepend-left-10 | ||
60 | - %a.dropdown-toggle.btn.btn-small{href: '#', "data-toggle" => "dropdown"} | ||
61 | - %i.icon-time | ||
62 | - %span.light milestone: | ||
63 | - - if @milestone.present? | ||
64 | - %strong= @milestone.title | ||
65 | - - elsif params[:milestone_id] == "0" | ||
66 | - Unspecified | ||
67 | - - else | ||
68 | - Any | ||
69 | - %b.caret | ||
70 | - %ul.dropdown-menu | ||
71 | - %li | ||
72 | - = link_to project_issues_with_filter_path(@project, milestone_id: nil) do | ||
73 | - Any | ||
74 | - = link_to project_issues_with_filter_path(@project, milestone_id: 0) do | ||
75 | - Unspecified | ||
76 | - - issues_active_milestones.each do |milestone| | ||
77 | - %li | ||
78 | - = link_to project_issues_with_filter_path(@project, milestone_id: milestone.id) do | ||
79 | - %strong= milestone.title | ||
80 | - %small.light= milestone.expires_at | ||
81 | - | ||
82 | - | ||
83 | - %ul.well-list.issues-list | ||
84 | - = render @issues | ||
85 | - - if @issues.blank? | ||
86 | - %li | ||
87 | - %h4.nothing_here_message Nothing to show here | ||
88 | - | ||
89 | -- if @issues.present? | ||
90 | - .pull-right | ||
91 | - %span.issue_counter #{@issues.total_count} | ||
92 | - issues for this filter | ||
93 | - | ||
94 | - = paginate @issues, remote: true, theme: "gitlab" |
app/views/issues/edit.html.haml
@@ -1 +0,0 @@ | @@ -1 +0,0 @@ | ||
1 | -= render "form" |
app/views/issues/index.atom.builder
@@ -1,23 +0,0 @@ | @@ -1,23 +0,0 @@ | ||
1 | -xml.instruct! | ||
2 | -xml.feed "xmlns" => "http://www.w3.org/2005/Atom", "xmlns:media" => "http://search.yahoo.com/mrss/" do | ||
3 | - xml.title "#{@project.name} issues" | ||
4 | - xml.link :href => project_issues_url(@project, :atom), :rel => "self", :type => "application/atom+xml" | ||
5 | - xml.link :href => project_issues_url(@project), :rel => "alternate", :type => "text/html" | ||
6 | - xml.id project_issues_url(@project) | ||
7 | - xml.updated @issues.first.created_at.strftime("%Y-%m-%dT%H:%M:%SZ") if @issues.any? | ||
8 | - | ||
9 | - @issues.each do |issue| | ||
10 | - xml.entry do | ||
11 | - xml.id project_issue_url(@project, issue) | ||
12 | - xml.link :href => project_issue_url(@project, issue) | ||
13 | - xml.title truncate(issue.title, :length => 80) | ||
14 | - xml.updated issue.created_at.strftime("%Y-%m-%dT%H:%M:%SZ") | ||
15 | - xml.media :thumbnail, :width => "40", :height => "40", :url => gravatar_icon(issue.author_email) | ||
16 | - xml.author do |author| | ||
17 | - xml.name issue.author_name | ||
18 | - xml.email issue.author_email | ||
19 | - end | ||
20 | - xml.summary issue.title | ||
21 | - end | ||
22 | - end | ||
23 | -end |
app/views/issues/index.html.haml
@@ -1,25 +0,0 @@ | @@ -1,25 +0,0 @@ | ||
1 | -= render "issues/head" | ||
2 | -.issues_content | ||
3 | - %h3.page_title | ||
4 | - Issues | ||
5 | - %span (<span class=issue_counter>#{@issues.total_count}</span>) | ||
6 | - .pull-right | ||
7 | - .span6 | ||
8 | - - if can? current_user, :write_issue, @project | ||
9 | - = link_to new_project_issue_path(@project, issue: { assignee_id: params[:assignee_id], milestone_id: params[:milestone_id]}), class: "btn btn-primary pull-right", title: "New Issue", id: "new_issue_link" do | ||
10 | - %i.icon-plus | ||
11 | - New Issue | ||
12 | - = form_tag project_issues_path(@project), method: :get, remote: true, id: "issue_search_form", class: 'pull-right' do | ||
13 | - = hidden_field_tag :status, params[:status], id: 'search_status' | ||
14 | - = hidden_field_tag :assignee_id, params[:assignee_id], id: 'search_assignee_id' | ||
15 | - = hidden_field_tag :milestone_id, params[:milestone_id], id: 'search_milestone_id' | ||
16 | - = hidden_field_tag :label_name, params[:label_name], id: 'search_label_name' | ||
17 | - = search_field_tag :issue_search, nil, { placeholder: 'Search', class: 'issue_search input-xlarge append-right-10 search-text-input' } | ||
18 | - | ||
19 | - .clearfix | ||
20 | - | ||
21 | -.row | ||
22 | - .span3 | ||
23 | - = render 'filter', entity: 'issue' | ||
24 | - .span9.issues-holder | ||
25 | - = render "issues" |
app/views/issues/index.js.haml