diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-06-23 20:47:22 +0400 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-06-23 20:47:22 +0400 |
commit | 2ed7cbfba4ff3c6a4cf3e72515a0375544998de0 (patch) | |
tree | ae6d7530745c80633cd993c99f7820e1452f3e1b /app/views/projects/merge_requests | |
parent | 95791316f4037273af7b747ce1851d5f4e46933f (diff) |
Move projects controllers/views in Projects module
Diffstat (limited to 'app/views/projects/merge_requests')
24 files changed, 463 insertions, 0 deletions
diff --git a/app/views/projects/merge_requests/_filter.html.haml b/app/views/projects/merge_requests/_filter.html.haml new file mode 100644 index 00000000000..4b48306ed05 --- /dev/null +++ b/app/views/projects/merge_requests/_filter.html.haml @@ -0,0 +1,20 @@ += form_tag project_issues_path(@project), method: 'get' do + %fieldset + %ul.nav.nav-pills.nav-stacked + %li{class: ("active" if (params[:f] == 'open' || !params[:f]))} + = link_to project_merge_requests_path(@project, f: 'open', milestone_id: params[:milestone_id]) do + Open + %li{class: ("active" if params[:f] == "closed")} + = link_to project_merge_requests_path(@project, f: "closed", milestone_id: params[:milestone_id]) do + Closed + %li{class: ("active" if params[:f] == 'assigned-to-me')} + = link_to project_merge_requests_path(@project, f: 'assigned-to-me', milestone_id: params[:milestone_id]) do + Assigned To Me + %li{class: ("active" if params[:f] == 'all')} + = link_to project_merge_requests_path(@project, f: 'all', milestone_id: params[:milestone_id]) do + All + + %fieldset + %hr + = link_to "Reset", project_merge_requests_path(@project), class: 'btn pull-right' + diff --git a/app/views/projects/merge_requests/_form.html.haml b/app/views/projects/merge_requests/_form.html.haml new file mode 100644 index 00000000000..b3da15608e4 --- /dev/null +++ b/app/views/projects/merge_requests/_form.html.haml @@ -0,0 +1,79 @@ += form_for [@project, @merge_request], html: { class: "#{controller.action_name}-merge-request form-horizontal" } do |f| + -if @merge_request.errors.any? + .alert.alert-error + %ul + - @merge_request.errors.full_messages.each do |msg| + %li= msg + + %fieldset + %legend 1. Select Branches + + .row + .span5 + .mr_branch_box + %h5.cgray From (Head Branch) + .body + .padded= f.select(:source_branch, @repository.branch_names, { include_blank: "Select branch" }, {class: 'chosen span4'}) + .mr_source_commit + + .span2 + %center= image_tag "merge.png", class: 'mr_direction_tip' + .span5 + .mr_branch_box + %h5.cgray To (Base Branch) + .body + .padded= f.select(:target_branch, @repository.branch_names, { include_blank: "Select branch" }, {class: 'chosen span4'}) + .mr_target_commit + + %fieldset + %legend 2. Fill info + + .ui-box.ui-box-show + .ui-box-head + .clearfix + = f.label :title do + %strong= "Title *" + .input= f.text_field :title, class: "input-xxlarge pad js-gfm-input", maxlength: 255, rows: 5, required: true + .ui-box-body + .clearfix + .left + = f.label :assignee_id do + %i.icon-user + Assign to + .input= f.select(:assignee_id, @project.team.members.sort_by(&:name).map {|p| [ p.name, p.id ] }, { include_blank: "Select user" }, {class: 'chosen span3'}) + .left + = f.label :milestone_id do + %i.icon-time + Milestone + .input= f.select(:milestone_id, @project.milestones.active.all.map {|p| [ p.title, p.id ] }, { include_blank: "Select milestone" }, {class: 'chosen'}) + + .control-group + + .form-actions + - if @merge_request.new_record? + = f.submit 'Submit merge request', class: "btn btn-create" + -else + = f.submit 'Save changes', class: "btn btn-save" + - if @merge_request.new_record? + = link_to project_merge_requests_path(@project), class: "btn btn-cancel" do + Cancel + - else + = link_to project_merge_request_path(@project, @merge_request), class: "btn btn-cancel" do + Cancel + +:javascript + disableButtonIfEmptyField("#merge_request_title", ".btn-save"); + + var source_branch = $("#merge_request_source_branch") + , target_branch = $("#merge_request_target_branch"); + + $.get("#{branch_from_project_merge_requests_path(@project)}", {ref: source_branch.val() }); + $.get("#{branch_to_project_merge_requests_path(@project)}", {ref: target_branch.val() }); + + source_branch.live("change", function() { + $.get("#{branch_from_project_merge_requests_path(@project)}", {ref: $(this).val() }); + }); + + target_branch.live("change", function() { + $.get("#{branch_to_project_merge_requests_path(@project)}", {ref: $(this).val() }); + }); diff --git a/app/views/projects/merge_requests/_head.html.haml b/app/views/projects/merge_requests/_head.html.haml new file mode 100644 index 00000000000..35a86e6511c --- /dev/null +++ b/app/views/projects/merge_requests/_head.html.haml @@ -0,0 +1,5 @@ +.top-tabs + = link_to project_merge_requests_path(@project), class: "tab #{'active' if current_page?(project_merge_requests_path(@project)) }" do + %span + Merge Requests + diff --git a/app/views/projects/merge_requests/_merge_request.html.haml b/app/views/projects/merge_requests/_merge_request.html.haml new file mode 100644 index 00000000000..ffc6b8fda1e --- /dev/null +++ b/app/views/projects/merge_requests/_merge_request.html.haml @@ -0,0 +1,29 @@ +%li{ class: mr_css_classes(merge_request) } + .merge-request-title + %span.light= "##{merge_request.id}" + = link_to_gfm truncate(merge_request.title, length: 80), project_merge_request_path(merge_request.project, merge_request), class: "row_title" + - if merge_request.merged? + %small.pull-right + %i.icon-ok + = "MERGED" + - else + %span.pull-right + %i.icon-angle-right + = merge_request.target_branch + .merge-request-info + - if merge_request.author + authored by #{link_to_member(@project, merge_request.author)} + - if merge_request.votes_count > 0 + = render 'votes/votes_inline', votable: merge_request + - if merge_request.notes.any? + %span + %i.icon-comments + = merge_request.mr_and_commit_notes.count + - if merge_request.milestone_id? + %span + %i.icon-time + = merge_request.milestone.title + + + .pull-right + %small updated #{time_ago_in_words(merge_request.updated_at)} ago diff --git a/app/views/projects/merge_requests/_show.html.haml b/app/views/projects/merge_requests/_show.html.haml new file mode 100644 index 00000000000..987fb4bcc49 --- /dev/null +++ b/app/views/projects/merge_requests/_show.html.haml @@ -0,0 +1,37 @@ +.merge-request + = render "projects/merge_requests/show/mr_title" + = render "projects/merge_requests/show/how_to_merge" + = render "projects/merge_requests/show/mr_box" + = render "projects/merge_requests/show/mr_accept" + - if @project.gitlab_ci? + = render "projects/merge_requests/show/mr_ci" + = render "projects/merge_requests/show/commits" + + - if @commits.present? + %ul.nav.nav-tabs + %li.notes-tab{data: {action: 'notes'}} + = link_to project_merge_request_path(@project, @merge_request) do + %i.icon-comment + Discussion + %li.diffs-tab{data: {action: 'diffs'}} + = link_to diffs_project_merge_request_path(@project, @merge_request) do + %i.icon-list-alt + Diff + + .notes.tab-content.voting_notes#notes{ class: (controller.action_name == 'show') ? "" : "hide" } + = render "projects/notes/notes_with_form" + .diffs.tab-content + = render "projects/merge_requests/show/diffs" if @diffs + .status + +:javascript + var merge_request; + + merge_request = new MergeRequest({ + url_to_automerge_check: "#{automerge_check_project_merge_request_path(@project, @merge_request)}", + check_enable: #{@merge_request.unchecked? ? "true" : "false"}, + url_to_ci_check: "#{ci_status_project_merge_request_path(@project, @merge_request)}", + ci_enable: #{@project.gitlab_ci? ? "true" : "false"}, + current_status: "#{@merge_request.merge_status_name}", + action: "#{controller.action_name}" + }); diff --git a/app/views/projects/merge_requests/automerge.js.haml b/app/views/projects/merge_requests/automerge.js.haml new file mode 100644 index 00000000000..e01ff662e7d --- /dev/null +++ b/app/views/projects/merge_requests/automerge.js.haml @@ -0,0 +1,7 @@ +-if @status + :plain + location.reload(); +-else + :plain + merge_request.alreadyOrCannotBeMerged() + diff --git a/app/views/projects/merge_requests/branch_from.js.haml b/app/views/projects/merge_requests/branch_from.js.haml new file mode 100644 index 00000000000..0637fdcb72e --- /dev/null +++ b/app/views/projects/merge_requests/branch_from.js.haml @@ -0,0 +1,2 @@ +:plain + $(".mr_source_commit").html("#{commit_to_html(@commit)}"); diff --git a/app/views/projects/merge_requests/branch_to.js.haml b/app/views/projects/merge_requests/branch_to.js.haml new file mode 100644 index 00000000000..974100d1ba7 --- /dev/null +++ b/app/views/projects/merge_requests/branch_to.js.haml @@ -0,0 +1,2 @@ +:plain + $(".mr_target_commit").html("#{commit_to_html(@commit)}"); diff --git a/app/views/projects/merge_requests/commits.js.haml b/app/views/projects/merge_requests/commits.js.haml new file mode 100644 index 00000000000..923b1ea032f --- /dev/null +++ b/app/views/projects/merge_requests/commits.js.haml @@ -0,0 +1,4 @@ +:plain + merge_request.$(".commits").html("#{escape_javascript(render(partial: "commits"))}"); + + diff --git a/app/views/projects/merge_requests/diffs.html.haml b/app/views/projects/merge_requests/diffs.html.haml new file mode 100644 index 00000000000..2a5b8b1441e --- /dev/null +++ b/app/views/projects/merge_requests/diffs.html.haml @@ -0,0 +1 @@ += render "show" diff --git a/app/views/projects/merge_requests/diffs.js.haml b/app/views/projects/merge_requests/diffs.js.haml new file mode 100644 index 00000000000..2964f0ec462 --- /dev/null +++ b/app/views/projects/merge_requests/diffs.js.haml @@ -0,0 +1,2 @@ +:plain + merge_request.$(".diffs").html("#{escape_javascript(render(partial: "projects/merge_requests/show/diffs"))}"); diff --git a/app/views/projects/merge_requests/edit.html.haml b/app/views/projects/merge_requests/edit.html.haml new file mode 100644 index 00000000000..eee148994d7 --- /dev/null +++ b/app/views/projects/merge_requests/edit.html.haml @@ -0,0 +1,4 @@ +%h3.page_title + = "Edit merge request #{@merge_request.id}" +%hr += render 'form' diff --git a/app/views/projects/merge_requests/index.html.haml b/app/views/projects/merge_requests/index.html.haml new file mode 100644 index 00000000000..b9e9096e3ae --- /dev/null +++ b/app/views/projects/merge_requests/index.html.haml @@ -0,0 +1,35 @@ +- if can? current_user, :write_merge_request, @project + = link_to new_project_merge_request_path(@project), class: "pull-right btn btn-primary", title: "New Merge Request" do + %i.icon-plus + New Merge Request +%h3.page_title + Merge Requests + +%br + + +.row + .span3 + = render 'filter' + .span9 + .ui-box + .title + = form_tag project_merge_requests_path(@project), id: "merge_requests_search_form", method: :get, class: :left do + = select_tag(:assignee_id, options_from_collection_for_select([unassigned_filter] + @project.users.all, "id", "name", params[:assignee_id]), prompt: "Assignee") + = select_tag(:milestone_id, options_from_collection_for_select([unassigned_filter] + @project.milestones.order("id desc").all, "id", "title", params[:milestone_id]), prompt: "Milestone") + = hidden_field_tag :f, params[:f] + .clearfix + + %ul.well-list.mr-list + = render @merge_requests + - if @merge_requests.blank? + %li + %h4.nothing_here_message Nothing to show here + - if @merge_requests.present? + .pull-right + %span.cgray.pull-right #{@merge_requests.total_count} merge requests for this filter + + = paginate @merge_requests, theme: "gitlab" + +:javascript + $(merge_requestsPage); diff --git a/app/views/projects/merge_requests/invalid.html.haml b/app/views/projects/merge_requests/invalid.html.haml new file mode 100644 index 00000000000..c962811a3e4 --- /dev/null +++ b/app/views/projects/merge_requests/invalid.html.haml @@ -0,0 +1,17 @@ +.merge-request + = render "projects/merge_requests/show/mr_title" + = render "projects/merge_requests/show/mr_box" + + .alert.alert-error + %h5 + %i.icon-exclamation-sign + We cannot find + %span.label-branch= @merge_request.source_branch + or + %span.label-branch= @merge_request.target_branch + branches in the repository. + %p + Maybe it was removed or never pushed. + %p + Please close Merge Request or change branches with existing one + diff --git a/app/views/projects/merge_requests/new.html.haml b/app/views/projects/merge_requests/new.html.haml new file mode 100644 index 00000000000..594089995ea --- /dev/null +++ b/app/views/projects/merge_requests/new.html.haml @@ -0,0 +1,3 @@ +%h3.page_title New Merge Request +%hr += render 'form' diff --git a/app/views/projects/merge_requests/show.html.haml b/app/views/projects/merge_requests/show.html.haml new file mode 100644 index 00000000000..2a5b8b1441e --- /dev/null +++ b/app/views/projects/merge_requests/show.html.haml @@ -0,0 +1 @@ += render "show" diff --git a/app/views/projects/merge_requests/show.js.haml b/app/views/projects/merge_requests/show.js.haml new file mode 100644 index 00000000000..2ce6eb63290 --- /dev/null +++ b/app/views/projects/merge_requests/show.js.haml @@ -0,0 +1,2 @@ +:plain + merge_request.$(".notes").html("#{escape_javascript(render "notes/notes_with_form")}"); diff --git a/app/views/projects/merge_requests/show/_commits.html.haml b/app/views/projects/merge_requests/show/_commits.html.haml new file mode 100644 index 00000000000..8630f02d5d9 --- /dev/null +++ b/app/views/projects/merge_requests/show/_commits.html.haml @@ -0,0 +1,30 @@ +- if @commits.present? + .ui-box + %h5.title + %i.icon-list + Commits (#{@commits.count}) + .commits + - if @commits.count > 8 + %ul.first-commits.well-list + - @commits.first(8).each do |commit| + = render "projects/commits/commit", commit: commit + %li.bottom + 8 of #{@commits.count} commits displayed. + %strong + %a.show-all-commits Click here to show all + %ul.all-commits.hide.well-list + - @commits.each do |commit| + = render "projects/commits/commit", commit: commit + + - else + %ul.well-list + - @commits.each do |commit| + = render "projects/commits/commit", commit: commit + +- else + %h4.nothing_here_message + Nothing to merge from + %span.label-branch #{@merge_request.source_branch} + to + %span.label-branch #{@merge_request.target_branch} + %br diff --git a/app/views/projects/merge_requests/show/_diffs.html.haml b/app/views/projects/merge_requests/show/_diffs.html.haml new file mode 100644 index 00000000000..1d52e824fad --- /dev/null +++ b/app/views/projects/merge_requests/show/_diffs.html.haml @@ -0,0 +1,10 @@ +- if @merge_request.valid_diffs? + = render "projects/commits/diffs", diffs: @diffs +- 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" + instead. +- else + %h4.nothing_here_message Nothing to merge diff --git a/app/views/projects/merge_requests/show/_how_to_merge.html.haml b/app/views/projects/merge_requests/show/_how_to_merge.html.haml new file mode 100644 index 00000000000..7f1e33418de --- /dev/null +++ b/app/views/projects/merge_requests/show/_how_to_merge.html.haml @@ -0,0 +1,19 @@ +%div#modal_merge_info.modal.hide + .modal-header + %a.close{href: "#"} × + %h3 How To Merge + .modal-body + %p + %strong Step 1. + Checkout target branch and get recent objects from GitLab + %pre.dark + :preserve + git checkout #{@merge_request.target_branch} + git fetch origin + %p + %strong Step 2. + Merge source branch into target branch and push changes to GitLab + %pre.dark + :preserve + git merge origin/#{@merge_request.source_branch} + git push origin #{@merge_request.target_branch} diff --git a/app/views/projects/merge_requests/show/_mr_accept.html.haml b/app/views/projects/merge_requests/show/_mr_accept.html.haml new file mode 100644 index 00000000000..ac97f6327c0 --- /dev/null +++ b/app/views/projects/merge_requests/show/_mr_accept.html.haml @@ -0,0 +1,52 @@ +- unless @allowed_to_merge + .alert + %strong You don't have enough permissions to merge this MR + + +- if @show_merge_controls + .automerge_widget.can_be_merged{style: "display:none"} + .alert.alert-success + %span + = form_for [:automerge, @project, @merge_request], remote: true, method: :get do |f| + %p + You can accept this request automatically. + If you still want to do it manually - + %strong= link_to "click here", "#", class: "how_to_merge_link vlink", title: "How To Merge" + for instructions + .accept_group + = f.submit "Accept Merge Request", class: "btn success accept_merge_request" + - unless @project.root_ref? @merge_request.source_branch + .remove_branch_holder + = label_tag :should_remove_source_branch, class: "checkbox" do + = check_box_tag :should_remove_source_branch + Remove source-branch + .clearfix + + + .automerge_widget.no_satellite{style: "display:none"} + .alert.alert-error + %span + %strong This repository does not have satellite. Ask administrator to fix this issue + + .automerge_widget.cannot_be_merged{style: "display:none"} + .alert.alert-disabled + %span + = link_to "Show how to merge", "#", class: "how_to_merge_link btn btn-small padded", title: "How To Merge" + + %strong This request can't be merged with GitLab. You should do it manually + + .automerge_widget.unchecked + .alert + %strong + %i.icon-refresh + Checking for ability to automatically merge… + + .automerge_widget.already_cannot_be_merged{style: "display:none"} + .alert.alert-info + %strong This merge request already can not be merged. Try to reload page. + + .merge-in-progress.hide + %span.cgray + %i.icon-refresh.icon-spin + + Merge is in progress. Please wait. Page will be automatically reloaded. diff --git a/app/views/projects/merge_requests/show/_mr_box.html.haml b/app/views/projects/merge_requests/show/_mr_box.html.haml new file mode 100644 index 00000000000..594f4061c23 --- /dev/null +++ b/app/views/projects/merge_requests/show/_mr_box.html.haml @@ -0,0 +1,36 @@ +.ui-box.ui-box-show + .ui-box-head + %h4.box-title + = gfm escape_once(@merge_request.title) + - if @merge_request.merged? + .success.status_info + %i.icon-ok + Merged + - elsif @merge_request.closed? + .error.status_info Closed + + .ui-box-body + %div + %cite.cgray + Created at #{@merge_request.created_at.stamp("Aug 21, 2011")} by #{link_to_member(@project, @merge_request.author)} + - if @merge_request.assignee + \, currently assigned to #{link_to_member(@project, @merge_request.assignee)} + - if @merge_request.milestone + - milestone = @merge_request.milestone + %cite.cgray and attached to milestone + %strong= link_to_gfm truncate(milestone.title, length: 20), project_milestone_path(milestone.project, milestone) + + + - if @merge_request.closed? + .ui-box-bottom.alert-error + %span + %i.icon-remove + Closed by #{link_to_member(@project, @merge_request.closed_event.author)} + %small #{time_ago_in_words(@merge_request.closed_event.created_at)} ago. + - if @merge_request.merged? + .ui-box-bottom.alert-success + %span + %i.icon-ok + Merged by #{link_to_member(@project, @merge_request.merge_event.author)} + #{time_ago_in_words(@merge_request.merge_event.created_at)} ago. + diff --git a/app/views/projects/merge_requests/show/_mr_ci.html.haml b/app/views/projects/merge_requests/show/_mr_ci.html.haml new file mode 100644 index 00000000000..9b15c4526e9 --- /dev/null +++ b/app/views/projects/merge_requests/show/_mr_ci.html.haml @@ -0,0 +1,35 @@ +- if @commits.any? + .ci_widget.ci-success{style: "display:none"} + .alert.alert-success + %i.icon-ok + %strong CI build passed + for #{@merge_request.last_commit_short_sha}. + = link_to "Build page", ci_build_details_path(@merge_request) + + + .ci_widget.ci-failed{style: "display:none"} + .alert.alert-error + %i.icon-remove + %strong CI build failed + for #{@merge_request.last_commit_short_sha}. + = link_to "Build page", ci_build_details_path(@merge_request) + + - [:running, :pending].each do |status| + .ci_widget{class: "ci-#{status}", style: "display:none"} + .alert + %i.icon-time + %strong CI build #{status} + for #{@merge_request.last_commit_short_sha}. + = link_to "Build page", ci_build_details_path(@merge_request) + + .ci_widget + .alert + %strong + %i.icon-refresh + Checking for CI status for #{@merge_request.last_commit_short_sha} + + .ci_widget.ci-error{style: "display:none"} + .alert.alert-error + %i.icon-remove + %strong Cannot connect to CI server. Please check your setting + diff --git a/app/views/projects/merge_requests/show/_mr_title.html.haml b/app/views/projects/merge_requests/show/_mr_title.html.haml new file mode 100644 index 00000000000..24285c272a8 --- /dev/null +++ b/app/views/projects/merge_requests/show/_mr_title.html.haml @@ -0,0 +1,31 @@ +%h3.page_title + = "Merge Request ##{@merge_request.id}:" + + %span.label-branch= @merge_request.source_branch + → + %span.label-branch= @merge_request.target_branch + + %span.pull-right + - if can?(current_user, :modify_merge_request, @merge_request) + - if @merge_request.opened? + .left.btn-group + %a.btn.grouped.dropdown-toggle{ data: {toggle: :dropdown} } + %i.icon-download-alt + Download as + %span.caret + %ul.dropdown-menu + %li= link_to "Email Patches", project_merge_request_path(@project, @merge_request, format: :patch) + %li= link_to "Plain Diff", project_merge_request_path(@project, @merge_request, format: :diff) + + = 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 + %i.icon-edit + Edit + +.pull-right + .span3#votes= render 'votes/votes_block', votable: @merge_request + +.back_link + = link_to project_merge_requests_path(@project) do + ← To merge requests |