summaryrefslogtreecommitdiff
path: root/app/views
diff options
context:
space:
mode:
authorIzaak Alpert <ialpert@blackberry.com>2013-06-03 16:20:50 -0400
committerIzaak Alpert <ialpert@blackberry.com>2013-07-17 22:42:51 -0400
commit489fa5d72631505873b8c33f3a2bbd5919330a92 (patch)
tree077d5b267d1875c905d566dfe972f65507ee826b /app/views
parent3d7194f0112da12e8732df9ffe8b34fe7d0a9f6b (diff)
downloadgitlab-ce-489fa5d72631505873b8c33f3a2bbd5919330a92.tar.gz
MR on Fork multiple fixes
-Disable observers post test run -Allow db:seed_fu RAILS_ENV=test to be run more than once without error -fix diffs_in_between, was passing in the default_options for grit, but grit in this case doesn't take options, fixed the test to actually fail if the incorrect diffs are returned -make notes/commits render against proper project -MR discussion file links should reference note's project -Added tests for commit links on edit merge request -fixes edit issues (canceling an edited mr, updating an edited mr) -updates tests with checks for source code updates -still forked_merge_requests.feature (project_forked_merge_requests) test not passing (commented out -- "stable" not being set) MR API: error on bad target_project -If the target project id is specified and it is not the same as the project the request is being made on (the source), and the it isn't a fork of that project, error out, otherwise use it as the target -Fixes some busted (but hidden) test cases Conflicts: app/views/merge_requests/show/_diffs.html.haml spec/features/notes_on_merge_requests_spec.rb Change-Id: I20e595c156d0e8a63048baaead7be6330c738a05
Diffstat (limited to 'app/views')
-rw-r--r--app/views/projects/commit/show.html.haml4
-rw-r--r--app/views/projects/commits/_diffs.html.haml12
-rw-r--r--app/views/projects/compare/show.html.haml2
-rw-r--r--app/views/projects/merge_requests/_form.html.haml20
-rw-r--r--app/views/projects/merge_requests/branch_from.js.haml2
-rw-r--r--app/views/projects/merge_requests/show/_diffs.html.haml4
-rw-r--r--app/views/projects/merge_requests/show/_mr_title.html.haml2
-rw-r--r--app/views/projects/notes/_discussion.html.haml4
8 files changed, 24 insertions, 26 deletions
diff --git a/app/views/projects/commit/show.html.haml b/app/views/projects/commit/show.html.haml
index 603406202ca..9f5af0a9aab 100644
--- a/app/views/projects/commit/show.html.haml
+++ b/app/views/projects/commit/show.html.haml
@@ -7,5 +7,5 @@
and
%span.cred #{@commit.stats.deletions} deletions
-= render "projects/commits/diffs", diffs: @commit.diffs
-= render "projects/notes/notes_with_form"
+= render "projects/commits/diffs", diffs: @commit.diffs, project: @project
+= render "projects/notes/notes_with_form" \ No newline at end of file
diff --git a/app/views/projects/commits/_diffs.html.haml b/app/views/projects/commits/_diffs.html.haml
index 8e3cbff8f3e..5ba8220ebea 100644
--- a/app/views/projects/commits/_diffs.html.haml
+++ b/app/views/projects/commits/_diffs.html.haml
@@ -5,7 +5,7 @@
%p To prevent performance issue we rejected diff information.
%p
But if you still want to see diff
- = link_to "click this link", project_commit_path(@project, @commit, force_show_diff: true), class: "underlined_link"
+ = link_to "click this link", project_commit_path(project, @commit, force_show_diff: true), class: "underlined_link"
%p.cgray
Showing #{pluralize(diffs.count, "changed file")}
@@ -16,8 +16,8 @@
- unless @suppress_diff
- diffs.each_with_index do |diff, i|
- next if diff.diff.empty?
- - file = Gitlab::Git::Blob.new(@repository, @commit.id, @ref, diff.new_path)
- - file = Gitlab::Git::Blob.new(@repository, @commit.parent_id, @ref, diff.old_path) unless file.exists?
+ - file = Gitlab::Git::Blob.new(project.repository, @commit.id, @ref, diff.new_path)
+ - file = Gitlab::Git::Blob.new(project.repository, @commit.parent_id, @ref, diff.old_path) unless file.exists?
- next unless file.exists?
.file{id: "diff-#{i}"}
.header
@@ -25,7 +25,7 @@
%span= diff.old_path
- if @commit.parent_ids.present?
- = link_to project_blob_path(@project, tree_join(@commit.parent_id, diff.new_path)), {:class => 'btn btn-tiny pull-right view-file'} do
+ = link_to project_blob_path(project, tree_join(@commit.parent_id, diff.new_path)), {:class => 'btn btn-tiny pull-right view-file'} do
View file @
%span.commit-short-id= @commit.short_id(6)
- else
@@ -33,7 +33,7 @@
- if diff.a_mode && diff.b_mode && diff.a_mode != diff.b_mode
%span.file-mode= "#{diff.a_mode} → #{diff.b_mode}"
- = link_to project_blob_path(@project, tree_join(@commit.id, diff.new_path)), {:class => 'btn btn-tiny pull-right view-file'} do
+ = link_to project_blob_path(project, tree_join(@commit.id, diff.new_path)), {:class => 'btn btn-tiny pull-right view-file'} do
View file @
%span.commit-short-id= @commit.short_id(6)
@@ -43,7 +43,7 @@
- if file.text?
= render "projects/commits/text_file", diff: diff, index: i
- elsif file.image?
- - old_file = Gitlab::Git::Blob.new(@repository, @commit.parent_id, @ref, diff.old_path) if @commit.parent_id
+ - old_file = Gitlab::Git::Blob.new(project.repository, @commit.parent_id, @ref, diff.old_path) if @commit.parent_id
= render "projects/commits/image", diff: diff, old_file: old_file, file: file, index: i
- else
%p.nothing_here_message No preview for this file type
diff --git a/app/views/projects/compare/show.html.haml b/app/views/projects/compare/show.html.haml
index e18fd6cc093..3a0b056060d 100644
--- a/app/views/projects/compare/show.html.haml
+++ b/app/views/projects/compare/show.html.haml
@@ -19,4 +19,4 @@
- unless @diffs.empty?
%h4 Diff
- = render "projects/commits/diffs", diffs: @diffs
+ = render "projects/commits/diffs", diffs: @diffs, project: @project \ No newline at end of file
diff --git a/app/views/projects/merge_requests/_form.html.haml b/app/views/projects/merge_requests/_form.html.haml
index c378739c111..9941a3718de 100644
--- a/app/views/projects/merge_requests/_form.html.haml
+++ b/app/views/projects/merge_requests/_form.html.haml
@@ -1,4 +1,4 @@
-= form_for [@project, @merge_request], html: { class: "#{controller.action_name}-merge-request form-horizontal" } do |form_helper|
+= form_for [@source_project, @merge_request], html: { class: "#{controller.action_name}-merge-request form-horizontal" } do |form_helper|
-if @merge_request.errors.any?
.alert.alert-error
%ul
@@ -55,10 +55,10 @@
-else
= form_helper.submit 'Save changes', class: "btn btn-save"
- if @merge_request.new_record?
- = link_to project_merge_requests_path(@project), class: "btn btn-cancel" do
+ = link_to project_merge_requests_path(@source_project), class: "btn btn-cancel" do
Cancel
- else
- = link_to project_merge_request_path(@project, @merge_request), class: "btn btn-cancel" do
+ = link_to project_merge_request_path(@target_project, @merge_request), class: "btn btn-cancel" do
Cancel
:javascript
@@ -68,19 +68,17 @@
, target_branch = $("#merge_request_target_branch")
, target_project = $("#merge_request_target_project_id");
- $.get("#{branch_from_project_merge_requests_path(@project)}", {ref: source_branch.val() });
- $.get("#{branch_to_project_merge_requests_path(@project)}", {target_project_id: target_project.val(),ref: target_branch.val() });
+ $.get("#{branch_from_project_merge_requests_path(@source_project)}", {ref: source_branch.val() });
+ $.get("#{branch_to_project_merge_requests_path(@source_project)}", {target_project_id: target_project.val(),ref: target_branch.val() });
target_project.live("change", function() {
- $.get("#{update_branches_project_merge_requests_path(@project)}", {target_project_id: $(this).val() });
+ $.get("#{update_branches_project_merge_requests_path(@source_project)}", {target_project_id: $(this).val() });
});
source_branch.live("change", function() {
- $.get("#{branch_from_project_merge_requests_path(@project)}", {ref: $(this).val() });
+ $.get("#{branch_from_project_merge_requests_path(@source_project)}", {ref: $(this).val() });
});
target_branch.live("change", function() {
- $.get("#{branch_to_project_merge_requests_path(@project)}", {target_project_id: target_project.val(),ref: $(this).val() });
+ $.get("#{branch_to_project_merge_requests_path(@source_project)}", {target_project_id: target_project.val(),ref: $(this).val() });
});
- });
-
-
+ }); \ No newline at end of file
diff --git a/app/views/projects/merge_requests/branch_from.js.haml b/app/views/projects/merge_requests/branch_from.js.haml
index a680c708d63..294acf76c38 100644
--- a/app/views/projects/merge_requests/branch_from.js.haml
+++ b/app/views/projects/merge_requests/branch_from.js.haml
@@ -1,2 +1,2 @@
:plain
- $(".mr_source_commit").html("#{commit_to_html(@commit, @project)}");
+ $(".mr_source_commit").html("#{commit_to_html(@commit, @source_project)}");
diff --git a/app/views/projects/merge_requests/show/_diffs.html.haml b/app/views/projects/merge_requests/show/_diffs.html.haml
index 3c1d14572aa..db384eda7db 100644
--- a/app/views/projects/merge_requests/show/_diffs.html.haml
+++ b/app/views/projects/merge_requests/show/_diffs.html.haml
@@ -1,10 +1,10 @@
- if @merge_request.valid_diffs?
- = render "projects/commits/diffs", diffs: @merge_request.diffs
+ = render "projects/commits/diffs", diffs: @diffs, project: @merge_request.source_project
- elsif @merge_request.broken_diffs?
%h4.nothing_here_message
Can't load diff.
You can
- = link_to "download it", project_merge_request_path(@project, @merge_request, format: :diff), class: "vlink"
+ = link_to "download it", project_merge_request_path(@merge_request.source_project, @merge_request), format: :diff, class: "vlink"
instead.
- else
%h4.nothing_here_message Nothing to merge
diff --git a/app/views/projects/merge_requests/show/_mr_title.html.haml b/app/views/projects/merge_requests/show/_mr_title.html.haml
index 2c31c2dbf31..4c912cdbd76 100644
--- a/app/views/projects/merge_requests/show/_mr_title.html.haml
+++ b/app/views/projects/merge_requests/show/_mr_title.html.haml
@@ -21,7 +21,7 @@
= link_to 'Close', project_merge_request_path(@project, @merge_request, merge_request: {state_event: :close }), method: :put, class: "btn grouped btn-close", title: "Close merge request"
- = link_to edit_project_merge_request_path(@project, @merge_request), class: "btn grouped" do
+ = link_to edit_project_merge_request_path(@project, @merge_request), class: "btn grouped", id:"edit_merge_request" do
%i.icon-edit
Edit
diff --git a/app/views/projects/notes/_discussion.html.haml b/app/views/projects/notes/_discussion.html.haml
index 14d81bbb5ce..ae317a6c1df 100644
--- a/app/views/projects/notes/_discussion.html.haml
+++ b/app/views/projects/notes/_discussion.html.haml
@@ -10,7 +10,7 @@
Show discussion
= image_tag gravatar_icon(note.author_email), class: "avatar s32"
%div
- = link_to_member(@project, note.author, avatar: false)
+ = link_to_member(note.project, note.author, avatar: false)
- if note.for_merge_request?
- if note.diff
started a discussion on this merge request diff
@@ -23,7 +23,7 @@
discussion on this merge request diff
- elsif note.for_commit?
started a discussion on commit
- #{link_to note.noteable.short_id, project_commit_path(@project, note.noteable)}
+ #{link_to note.noteable.short_id, project_commit_path(note.project, note.noteable)}
= link_to_commit_diff_line_note(note) if note.for_diff_line?
- else
%cite.cgray started a discussion