Commit d884c210 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'create-merge-request-view' into 'master'

Create merge request view

Updated the create merge request view to use the horizontal form layout, and added tabs for commits and changes.
Also updated commits layout to use the same as the projects commits layout.

Screenshots: [Before](https://gitlab.com/uploads/stephanvl/gitlab-ce/892d1bf4c0/Screenshot_from_2014-12-29_20_33_19.png) - [After](https://gitlab.com/uploads/stephanvl/gitlab-ce/508b3100c7/Screenshot_from_2014-12-29_20_34_40.png)

Fixes #923

See merge request !270
parents 7e6030e4 4fe699fd
...@@ -9,63 +9,93 @@ ...@@ -9,63 +9,93 @@
%span.pull-right %span.pull-right
= link_to 'Change branches', new_project_merge_request_path(@project) = link_to 'Change branches', new_project_merge_request_path(@project)
= form_for [@project, @merge_request], html: { class: "merge-request-form gfm-form" } do |f| = form_for [@project, @merge_request], html: { class: "merge-request-form form-horizontal gfm-form" } do |f|
.panel.panel-default .merge-request-form-info
.panel-body
.form-group
.light
= f.label :title do
Title *
= f.text_field :title, class: "form-control input-lg js-gfm-input", maxlength: 255, rows: 5, required: true
.form-group .form-group
.light = f.label :title, class: 'control-label' do
= f.label :description, "Description" %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' do = render layout: 'projects/md_preview' do
= render 'projects/zen', f: f, attr: :description, = render 'projects/zen', f: f, attr: :description, classes: 'description form-control'
classes: 'description form-control'
.clearfix.hint .col-sm-12-hint
.pull-left Description is parsed with #{link_to "GitLab Flavored Markdown", help_page_path("markdown", "markdown"), target: '_blank'}. .pull-left
.pull-right Attach images (JPG, PNG, GIF) by dragging & dropping or #{link_to "selecting them", '#', class: 'markdown-selector' }. Parsed with
#{link_to 'Gitlab Flavored Markdown', help_page_path('markdown', 'markdown'), target: '_blank'}.
.pull-right
Attach images (JPG, PNG, GIF) by dragging & dropping
or #{link_to 'selecting them', '#', class: 'markdown-selector'}.
.clearfix
.error-alert .error-alert
%hr
.form-group .form-group
.issue-assignee .issue-assignee
= f.label :assignee_id do = f.label :assignee_id, class: 'control-label' do
%i.fa.fa-user %i.fa.fa-user
Assign to Assign to
%div .col-sm-10
= project_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) = project_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' = link_to 'Assign to me', '#', class: 'btn assign-to-me-link'
.form-group .form-group
.issue-milestone .issue-milestone
= f.label :milestone_id do = f.label :milestone_id, class: 'control-label' do
%i.fa.fa-clock-o %i.fa.fa-clock-o
Milestone Milestone
%div= f.select(:milestone_id, milestone_options(@merge_request), { include_blank: "Select milestone" }, {class: 'select2'}) .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_project_milestone_path(@merge_request.target_project), target: :blank
.form-group .form-group
= f.label :label_ids do = f.label :label_ids, class: 'control-label' do
%i.fa.fa-tag %i.fa.fa-tag
Labels Labels
%div .col-sm-10
= f.collection_select :label_ids, @merge_request.target_project.labels.all, :id, :name, { selected: @merge_request.label_ids }, multiple: true, class: 'select2' - 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_project_label_path(@merge_request.target_project), target: :blank
.panel-footer .form-actions
- if contribution_guide_url(@target_project) - if contribution_guide_url(@target_project)
%p %p
Please review the Please review the
%strong #{link_to "guidelines for contribution", contribution_guide_url(@target_project)} %strong #{link_to 'guidelines for contribution', contribution_guide_url(@target_project)}
to this repository. to this repository.
= f.hidden_field :source_project_id = f.hidden_field :source_project_id
= f.hidden_field :source_branch
= f.hidden_field :target_project_id = f.hidden_field :target_project_id
= f.hidden_field :target_branch = f.hidden_field :target_branch
= f.hidden_field :source_branch = f.submit 'Submit merge request', class: 'btn btn-create'
= f.submit 'Submit merge request', class: "btn btn-create"
.mr-compare .mr-compare.merge-request
= render "projects/commits/commit_list" %ul.nav.nav-tabs.merge-request-tabs
%li.commits-tab{data: {action: 'commits'}}
= link_to url_for(params) do
%i.fa.fa-history
Commits
%span.badge= @commits.size
%li.diffs-tab{data: {action: 'diffs'}}
= link_to url_for(params) do
%i.fa.fa-list-alt
Changes
%span.badge= @diffs.size
%h4 Changes .commits.tab-content
= render "projects/commits/commits"
.diffs.tab-content
- if @diffs.present? - if @diffs.present?
= render "projects/diffs/diffs", diffs: @diffs, project: @project = render "projects/diffs/diffs", diffs: @diffs, project: @project
- elsif @commits.size > MergeRequestDiff::COMMITS_SAFE_SIZE - elsif @commits.size > MergeRequestDiff::COMMITS_SAFE_SIZE
...@@ -74,10 +104,9 @@ ...@@ -74,10 +104,9 @@
%p To preserve performance the line changes are not shown. %p To preserve performance the line changes are not shown.
- else - else
.bs-callout.bs-callout-danger .bs-callout.bs-callout-danger
%h4 This comparison includes huge diff. %h4 This comparison includes a huge diff.
%p To preserve performance the line changes are not shown. %p To preserve performance the line changes are not shown.
:javascript :javascript
$('.assign-to-me-link').on('click', function(e){ $('.assign-to-me-link').on('click', function(e){
$('#merge_request_assignee_id').val("#{current_user.id}").trigger("change"); $('#merge_request_assignee_id').val("#{current_user.id}").trigger("change");
...@@ -85,3 +114,9 @@ ...@@ -85,3 +114,9 @@
}); });
window.project_image_path_upload = "#{upload_image_project_path @project}"; window.project_image_path_upload = "#{upload_image_project_path @project}";
:javascript
var merge_request
merge_request = new MergeRequest({
action: 'commits'
});
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment