diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/projects/merge_requests_controller.rb | 9 | ||||
-rw-r--r-- | app/helpers/notes_helper.rb | 2 | ||||
-rw-r--r-- | app/views/projects/commit/show.html.haml | 4 | ||||
-rw-r--r-- | app/views/projects/commits/_diffs.html.haml | 12 | ||||
-rw-r--r-- | app/views/projects/compare/show.html.haml | 2 | ||||
-rw-r--r-- | app/views/projects/merge_requests/_form.html.haml | 20 | ||||
-rw-r--r-- | app/views/projects/merge_requests/branch_from.js.haml | 2 | ||||
-rw-r--r-- | app/views/projects/merge_requests/show/_diffs.html.haml | 4 | ||||
-rw-r--r-- | app/views/projects/merge_requests/show/_mr_title.html.haml | 2 | ||||
-rw-r--r-- | app/views/projects/notes/_discussion.html.haml | 4 |
10 files changed, 32 insertions, 29 deletions
diff --git a/app/controllers/projects/merge_requests_controller.rb b/app/controllers/projects/merge_requests_controller.rb index 6c5285be0a2..5bbf52beed9 100644 --- a/app/controllers/projects/merge_requests_controller.rb +++ b/app/controllers/projects/merge_requests_controller.rb @@ -50,10 +50,13 @@ class Projects::MergeRequestsController < Projects::ApplicationController @merge_request.target_project = Project.find_by_id(params[:merge_request][:target_project_id]) end @target_branches = @merge_request.target_project.nil? ? [] : @merge_request.target_project.repository.branch_names + @source_project = @merge_request.source_project @merge_request end def edit + @source_project = @merge_request.source_project + @target_project = @merge_request.target_project @target_branches = @merge_request.target_project.repository.branch_names end @@ -75,7 +78,7 @@ class Projects::MergeRequestsController < Projects::ApplicationController if @merge_request.update_attributes(params[:merge_request].merge(author_id_of_changes: current_user.id)) @merge_request.reload_code @merge_request.mark_as_unchecked - redirect_to [@project, @merge_request], notice: 'Merge request was successfully updated.' + redirect_to [@merge_request.target_project, @merge_request], notice: 'Merge request was successfully updated.' else render "edit" end @@ -104,6 +107,7 @@ class Projects::MergeRequestsController < Projects::ApplicationController def branch_from #This is always source + @source_project = @merge_request.nil? ? @project : @merge_request.source_project @commit = @repository.commit(params[:ref]) end @@ -128,13 +132,14 @@ class Projects::MergeRequestsController < Projects::ApplicationController protected + def selected_target_project ((@project.id.to_s == params[:target_project_id]) || @project.forked_project_link.nil?) ? @project : @project.forked_project_link.forked_from_project end def merge_request - @merge_request ||= @project.merge_requests.find(params[:id]) + @merge_request ||= MergeRequest.find_by_id(params[:id]) end def authorize_modify_merge_request! diff --git a/app/helpers/notes_helper.rb b/app/helpers/notes_helper.rb index a3ec4cca59d..c82a8d108b6 100644 --- a/app/helpers/notes_helper.rb +++ b/app/helpers/notes_helper.rb @@ -11,7 +11,7 @@ module NotesHelper def link_to_commit_diff_line_note(note) if note.for_commit_diff_line? - link_to "#{note.diff_file_name}:L#{note.diff_new_line}", project_commit_path(@project, note.noteable, anchor: note.line_code) + link_to "#{note.diff_file_name}:L#{note.diff_new_line}", project_commit_path(note.project, note.noteable, anchor: note.line_code) end end 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 |