diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-05-06 17:50:33 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-05-06 17:50:33 +0300 |
commit | f78dfa6da7bde893d5a45b48355bd77b3b92aaed (patch) | |
tree | 47feb50dbe93a05acb45b58894fd0733c7e8447b | |
parent | ea6667b06ceb38b42dc673b57a1ca8682f7b709a (diff) | |
parent | c66e5751796adc979fad684ce9b71286dd43c22f (diff) |
Merge branch 'refactor-mr-form' into 'master'
Refactor mr form
* re-use issuable form for new mr page
* small UI improvements to MR compare and new pages
See merge request !616
-rw-r--r-- | app/views/projects/_aside.html.haml | 5 | ||||
-rw-r--r-- | app/views/projects/merge_requests/_new_compare.html.haml | 7 | ||||
-rw-r--r-- | app/views/projects/merge_requests/_new_submit.html.haml | 77 | ||||
-rw-r--r-- | features/steps/project/forked_merge_requests.rb | 2 | ||||
-rw-r--r-- | features/steps/project/merge_requests.rb | 2 |
5 files changed, 17 insertions, 76 deletions
diff --git a/app/views/projects/_aside.html.haml b/app/views/projects/_aside.html.haml index b3ae2569499..1865b5be8c6 100644 --- a/app/views/projects/_aside.html.haml +++ b/app/views/projects/_aside.html.haml @@ -39,6 +39,11 @@ = link_to url_for_new_issue(@project, only_path: true), title: "New Issue", class: 'btn btn-sm' do %i.fa.fa-fw.fa-exclamation-circle New issue + - if can? current_user, :write_merge_request, @project + + = link_to new_namespace_project_merge_request_path(@project.namespace, @project), class: "btn btn-sm", title: "New Merge Request" do + %i.fa.fa-plus + New Merge Request diff --git a/app/views/projects/merge_requests/_new_compare.html.haml b/app/views/projects/merge_requests/_new_compare.html.haml index 17e76059fdb..e611b23bca6 100644 --- a/app/views/projects/merge_requests/_new_compare.html.haml +++ b/app/views/projects/merge_requests/_new_compare.html.haml @@ -1,5 +1,4 @@ -%h3.page-title Compare branches for new Merge Request -%hr +%p.lead Compare branches for new Merge Request = form_for [@project.namespace.becomes(Namespace), @project, @merge_request], url: new_namespace_project_merge_request_path(@project.namespace, @project), method: :get, html: { class: "merge-request-form form-inline" } do |f| .hide.alert.alert-danger.mr-compare-errors @@ -52,8 +51,8 @@ are the same. - %hr - = f.submit 'Compare branches', class: "btn btn-primary mr-compare-btn" + %div + = f.submit 'Compare branches', class: "btn btn-new mr-compare-btn" :javascript var source_branch = $("#merge_request_source_branch") diff --git a/app/views/projects/merge_requests/_new_submit.html.haml b/app/views/projects/merge_requests/_new_submit.html.haml index 6dc883ba22b..24a9563dd4d 100644 --- a/app/views/projects/merge_requests/_new_submit.html.haml +++ b/app/views/projects/merge_requests/_new_submit.html.haml @@ -8,77 +8,14 @@ %span.pull-right = link_to 'Change branches', mr_change_branches_path(@merge_request) - -= form_for [@project.namespace.becomes(Namespace), @project, @merge_request], html: { class: "merge-request-form form-horizontal gfm-form" } do |f| +%hr += form_for [@project.namespace.becomes(Namespace), @project, @merge_request], html: { class: 'merge-request-form form-horizontal gfm-form' } do |f| .merge-request-form-info - .form-group - = f.label :title, class: 'control-label' do - %strong Title * - .col-sm-10 - = f.text_field :title, maxlength: 255, autofocus: true, class: 'form-control pad js-gfm-input', required: true - .form-group.issuable-description - = f.label :description, 'Description', class: 'control-label' - .col-sm-10 - = render layout: 'projects/md_preview', locals: { preview_class: "wiki" } do - = render 'projects/zen', f: f, attr: :description, classes: 'description form-control' - - .col-sm-12-hint - .pull-left - Parsed with - #{link_to 'Gitlab Flavored Markdown', help_page_path('markdown', 'markdown'), target: '_blank'}. - .pull-right - Attach files by dragging & dropping - or #{link_to 'selecting them', '#', class: 'markdown-selector'}. - - .clearfix - .error-alert - %hr - .form-group - .issue-assignee - = f.label :assignee_id, class: 'control-label' do - %i.fa.fa-user - Assign to - .col-sm-10 - = users_select_tag('merge_request[assignee_id]', placeholder: 'Select a user', class: 'custom-form-control', selected: @merge_request.assignee_id, project_id: @merge_request.target_project_id) - - = link_to 'Assign to me', '#', class: 'btn assign-to-me-link' - .form-group - .issue-milestone - = f.label :milestone_id, class: 'control-label' do - %i.fa.fa-clock-o - Milestone - .col-sm-10 - - if milestone_options(@merge_request).present? - = f.select(:milestone_id, milestone_options(@merge_request), {include_blank: 'Select milestone'}, {class: 'select2'}) - - else - %span.light No open milestones available. - - - if can? current_user, :admin_milestone, @merge_request.target_project - = link_to 'Create new milestone', new_namespace_project_milestone_path(@merge_request.target_project.namespace, @merge_request.target_project), target: :blank - .form-group - = f.label :label_ids, class: 'control-label' do - %i.fa.fa-tag - Labels - .col-sm-10 - - if @merge_request.target_project.labels.any? - = f.collection_select :label_ids, @merge_request.target_project.labels.all, :id, :name, {selected: @merge_request.label_ids}, multiple: true, class: 'select2' - - else - %span.light No labels yet. - - - if can? current_user, :admin_label, @merge_request.target_project - = link_to 'Create new label', new_namespace_project_label_path(@merge_request.target_project.namespace, @merge_request.target_project), target: :blank - - .form-actions - - if guide_url = contribution_guide_url(@target_project) - %p - Please review the - %strong #{link_to 'guidelines for contribution', guide_url} - to this repository. - = f.hidden_field :source_project_id - = f.hidden_field :source_branch - = f.hidden_field :target_project_id - = f.hidden_field :target_branch - = f.submit 'Submit merge request', class: 'btn btn-create' + = render 'projects/issuable_form', f: f, issuable: @merge_request + = f.hidden_field :source_project_id + = f.hidden_field :source_branch + = f.hidden_field :target_project_id + = f.hidden_field :target_branch .mr-compare.merge-request %ul.nav.nav-tabs.merge-request-tabs diff --git a/features/steps/project/forked_merge_requests.rb b/features/steps/project/forked_merge_requests.rb index 63ad90e1241..94d21d28a0c 100644 --- a/features/steps/project/forked_merge_requests.rb +++ b/features/steps/project/forked_merge_requests.rb @@ -46,7 +46,7 @@ class Spinach::Features::ProjectForkedMergeRequests < Spinach::FeatureSteps end step 'I submit the merge request' do - click_button "Submit merge request" + click_button "Submit new merge request" end step 'I follow the target commit link' do diff --git a/features/steps/project/merge_requests.rb b/features/steps/project/merge_requests.rb index bb1f9f129c0..12d4d81159e 100644 --- a/features/steps/project/merge_requests.rb +++ b/features/steps/project/merge_requests.rb @@ -77,7 +77,7 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps select "feature", from: "merge_request_target_branch" click_button "Compare branches" fill_in "merge_request_title", with: "Wiki Feature" - click_button "Submit merge request" + click_button "Submit new merge request" end step 'project "Shop" have "Bug NS-04" open merge request' do |