summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-06-11 09:40:26 +0200
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-06-11 09:40:26 +0200
commit644b6ba993ce033369bc50642caed69f3bed7f8a (patch)
treeebdcb88bb397275efb326d2763b23002923f3b03
parent190c9e9f39c6d14c2a47083fcd5d64717919d9eb (diff)
downloadgitlab-ce-644b6ba993ce033369bc50642caed69f3bed7f8a.tar.gz
Refactor accept merge request widget
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
-rw-r--r--app/models/merge_request.rb8
-rw-r--r--app/views/projects/merge_requests/_show.html.haml2
-rw-r--r--app/views/projects/merge_requests/show/_mr_accept.html.haml89
-rw-r--r--app/views/projects/merge_requests/show/_mr_ci.html.haml34
-rw-r--r--app/views/projects/merge_requests/show/_remove_source_branch.html.haml17
-rw-r--r--app/views/projects/merge_requests/show/_state_widget.html.haml50
-rw-r--r--app/views/projects/merge_requests/widget/_closed.html.haml9
-rw-r--r--app/views/projects/merge_requests/widget/_heading.html.haml34
-rw-r--r--app/views/projects/merge_requests/widget/_locked.html.haml8
-rw-r--r--app/views/projects/merge_requests/widget/_merged.html.haml26
-rw-r--r--app/views/projects/merge_requests/widget/_mr_accept.html.haml20
-rw-r--r--app/views/projects/merge_requests/widget/_open.html.haml29
-rw-r--r--app/views/projects/merge_requests/widget/_show.html.haml8
-rw-r--r--app/views/projects/merge_requests/widget/open/_accept.html.haml24
-rw-r--r--app/views/projects/merge_requests/widget/open/_archived.html.haml2
-rw-r--r--app/views/projects/merge_requests/widget/open/_check.html.haml4
-rw-r--r--app/views/projects/merge_requests/widget/open/_conflict.html.haml5
-rw-r--r--app/views/projects/merge_requests/widget/open/_mip.html.haml5
-rw-r--r--app/views/projects/merge_requests/widget/open/_missing_branch.html.haml (renamed from app/views/projects/merge_requests/show/_no_accept.html.haml)0
-rw-r--r--app/views/projects/merge_requests/widget/open/_no_satellite.html.haml3
-rw-r--r--app/views/projects/merge_requests/widget/open/_not_allowed.html.haml9
-rw-r--r--app/views/projects/merge_requests/widget/open/_nothing.html.haml8
-rw-r--r--app/views/projects/merge_requests/widget/open/_wip.html.haml9
23 files changed, 212 insertions, 191 deletions
diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb
index f1f9f23b12c..665f88a3645 100644
--- a/app/models/merge_request.rb
+++ b/app/models/merge_request.rb
@@ -405,4 +405,12 @@ class MergeRequest < ActiveRecord::Base
locked_at.nil? || locked_at < (Time.now - 1.day)
end
+
+ def has_ci?
+ source_project.ci_service && commits.any?
+ end
+
+ def branch_missing?
+ !source_branch_exists? || !target_branch_exists?
+ end
end
diff --git a/app/views/projects/merge_requests/_show.html.haml b/app/views/projects/merge_requests/_show.html.haml
index 74f8b9950cf..02a9a53d9c8 100644
--- a/app/views/projects/merge_requests/_show.html.haml
+++ b/app/views/projects/merge_requests/_show.html.haml
@@ -32,7 +32,7 @@
%li= link_to "Plain Diff", merge_request_path(@merge_request, format: :diff)
= render "projects/merge_requests/show/how_to_merge"
- = render "projects/merge_requests/show/state_widget"
+ = render "projects/merge_requests/widget/show.html.haml"
- if @commits.present?
%ul.nav.nav-tabs.merge-request-tabs
diff --git a/app/views/projects/merge_requests/show/_mr_accept.html.haml b/app/views/projects/merge_requests/show/_mr_accept.html.haml
deleted file mode 100644
index bfd4ab6f3d8..00000000000
--- a/app/views/projects/merge_requests/show/_mr_accept.html.haml
+++ /dev/null
@@ -1,89 +0,0 @@
-- unless @allowed_to_merge
- - if @project.archived?
- %p
- %strong Archived projects do not provide commit access.
- - else
- .automerge_widget.cannot_be_merged.hide
- %strong This merge request contains merge conflicts that must be resolved.
- Only those with write access to this repository can merge merge requests.
- .automerge_widget.work_in_progress.hide
- %strong This merge request is marked as Work In Progress.
- Only those with write access to this repository can merge merge requests.
- .automerge_widget.can_be_merged.hide
- %strong This request can be merged automatically.
- Only those with write access to this repository can merge merge requests.
-
-
-- if @show_merge_controls
- .automerge_widget.can_be_merged.hide
- .clearfix
- = form_for [:automerge, @project.namespace.becomes(Namespace), @project, @merge_request], remote: true, method: :post do |f|
- .accept-merge-holder.clearfix.js-toggle-container
- .accept-action
- = f.submit "Accept Merge Request", class: "btn btn-create accept_merge_request"
- - if can_remove_branch?(@merge_request.source_project, @merge_request.source_branch) && !@merge_request.for_fork?
- .accept-control.checkbox
- = label_tag :should_remove_source_branch, class: "remove_source_checkbox" do
- = check_box_tag :should_remove_source_branch
- Remove source-branch
- .accept-control
- = link_to "#", class: "modify-merge-commit-link js-toggle-button", title: "Modify merge commit message" do
- %i.fa.fa-edit
- Modify commit message
- .js-toggle-content.hide.prepend-top-20
- = render 'shared/commit_message_container', params: params,
- text: @merge_request.merge_commit_message,
- rows: 14, hint: true
-
- %br
- .light
- If you want to merge this request manually, you can use the
- %strong
- = link_to "command line", "#modal_merge_info", class: "how_to_merge_link vlink", title: "How To Merge", "data-toggle" => "modal"
-
-
- .automerge_widget.no_satellite.hide
- %p
- %span
- %strong This repository does not have a satellite. Please ask an administrator to fix this issue!
-
- .automerge_widget.cannot_be_merged.hide
- %h4
- This merge request contains merge conflicts that must be resolved.
- You can try it manually on the
- %strong
- = link_to "command line", "#modal_merge_info", class: "how_to_merge_link vlink", title: "How To Merge", "data-toggle" => "modal"
-
- %p
- %button.btn.disabled{:type => 'button'}
- %i.fa.fa-warning
- Accept Merge Request
- &nbsp;
- This happens when Git is not able to automatically resolve conflicts between branches.
-
- .automerge_widget.work_in_progress.hide
- %h4
- This merge request cannot be accepted because it is marked as Work In Progress.
-
- %p
- %button.btn.disabled{:type => 'button'}
- %i.fa.fa-warning
- Accept Merge Request
- &nbsp;
- When the merge request is ready, remove the "WIP" prefix from the title to allow it to be accepted.
-
- .automerge_widget.unchecked
- %p
- %strong
- %i.fa.fa-spinner.fa-spin
- Checking automatic merge…
-
- .automerge_widget.already_cannot_be_merged.hide
- %p
- %strong This merge request cannot be merged. Try to reload the page.
-
- .merge-in-progress.hide
- %p
- %i.fa.fa-spinner.fa-spin
- &nbsp;
- Merge is in progress. Please wait… Page will be reloaded automatically. &nbsp;
diff --git a/app/views/projects/merge_requests/show/_mr_ci.html.haml b/app/views/projects/merge_requests/show/_mr_ci.html.haml
deleted file mode 100644
index 3b1cd53df37..00000000000
--- a/app/views/projects/merge_requests/show/_mr_ci.html.haml
+++ /dev/null
@@ -1,34 +0,0 @@
-- if @commits.any?
- .ci_widget.ci-success{style: "display:none"}
- = icon("check")
- %span CI build passed
- for #{@merge_request.last_commit_short_sha}.
- = link_to "View build page", ci_build_details_path(@merge_request), :"data-no-turbolink" => "data-no-turbolink"
-
-
- .ci_widget.ci-failed{style: "display:none"}
- = icon("times")
- %span CI build failed
- for #{@merge_request.last_commit_short_sha}.
- = link_to "View build page", ci_build_details_path(@merge_request), :"data-no-turbolink" => "data-no-turbolink"
-
- - [:running, :pending].each do |status|
- .ci_widget{class: "ci-#{status}", style: "display:none"}
- = icon("clock-o")
- %span CI build #{status}
- for #{@merge_request.last_commit_short_sha}.
- = link_to "View build page", ci_build_details_path(@merge_request), :"data-no-turbolink" => "data-no-turbolink"
-
- .ci_widget
- = icon("spinner spin")
- Checking for CI status for #{@merge_request.last_commit_short_sha}
-
- .ci_widget.ci-canceled{style: "display:none"}
- = icon("times")
- %span CI build canceled
- for #{@merge_request.last_commit_short_sha}.
- = link_to "View build page", ci_build_details_path(@merge_request), :"data-no-turbolink" => "data-no-turbolink"
-
- .ci_widget.ci-error{style: "display:none"}
- = icon("times")
- %span Cannot connect to the CI server. Please check your settings and try again.
diff --git a/app/views/projects/merge_requests/show/_remove_source_branch.html.haml b/app/views/projects/merge_requests/show/_remove_source_branch.html.haml
deleted file mode 100644
index 59cb85edfce..00000000000
--- a/app/views/projects/merge_requests/show/_remove_source_branch.html.haml
+++ /dev/null
@@ -1,17 +0,0 @@
-- if @source_branch.blank?
- Source branch has been removed
-
-- elsif can_remove_branch?(@merge_request.source_project, @merge_request.source_branch) && @merge_request.merged?
- .remove_source_branch_widget
- %p Changes merged into #{@merge_request.target_branch}. You can remove source branch now
- = link_to namespace_project_branch_path(@merge_request.source_project.namespace, @merge_request.source_project, @source_branch), remote: true, method: :delete, class: "btn btn-primary btn-sm remove_source_branch" do
- %i.fa.fa-times
- Remove Source Branch
-
- .remove_source_branch_widget.failed.hide
- Failed to remove source branch '#{@merge_request.source_branch}'
-
- .remove_source_branch_in_progress.hide
- %i.fa.fa-spinner.fa-spin
- &nbsp;
- Removing source branch '#{@merge_request.source_branch}'. Please wait. Page will be automatically reloaded. &nbsp;
diff --git a/app/views/projects/merge_requests/show/_state_widget.html.haml b/app/views/projects/merge_requests/show/_state_widget.html.haml
deleted file mode 100644
index 6396232db22..00000000000
--- a/app/views/projects/merge_requests/show/_state_widget.html.haml
+++ /dev/null
@@ -1,50 +0,0 @@
-.mr-state-widget
- - if @merge_request.source_project.ci_service && @commits.any?
- .mr-widget-heading
- = render "projects/merge_requests/show/mr_ci"
- .mr-widget-body
- - if @merge_request.open?
- - if @merge_request.source_branch_exists? && @merge_request.target_branch_exists?
- = render "projects/merge_requests/show/mr_accept"
- - else
- = render "projects/merge_requests/show/no_accept"
-
- - if @merge_request.closed?
- %h4
- Rejected
- - if @merge_request.closed_event
- by #{link_to_member(@project, @merge_request.closed_event.author, avatar: true)}
- #{time_ago_with_tooltip(@merge_request.closed_event.created_at)}
- %p Changes were not merged into target branch
-
- - if @merge_request.merged?
- %h4
- Accepted
- - if @merge_request.merge_event
- by #{link_to_member(@project, @merge_request.merge_event.author, avatar: true)}
- #{time_ago_with_tooltip(@merge_request.merge_event.created_at)}
- = render "projects/merge_requests/show/remove_source_branch"
-
- - if @merge_request.locked?
- %h4
- Merge in progress...
- %p
- Merging is in progress. While merging this request is locked and cannot be closed.
-
- - unless @commits.any?
- %h4 Nothing to merge
- %p
- Nothing to merge from
- %span.label-branch #{@merge_request.source_branch}
- to
- %span.label-branch #{@merge_request.target_branch}
- %br
- Try to use different branches or push new code.
-
- - if @closes_issues.present? && @merge_request.open?
- .mr-widget-footer
- %span
- %i.fa.fa-check
- Accepting this merge request will close #{@closes_issues.size == 1 ? 'issue' : 'issues'}
- = succeed '.' do
- != gfm(issues_sentence(@closes_issues))
diff --git a/app/views/projects/merge_requests/widget/_closed.html.haml b/app/views/projects/merge_requests/widget/_closed.html.haml
new file mode 100644
index 00000000000..3561eae0324
--- /dev/null
+++ b/app/views/projects/merge_requests/widget/_closed.html.haml
@@ -0,0 +1,9 @@
+.mr-state-widget
+ = render 'heading'
+ .mr-widget-body
+ %h4
+ Rejected
+ - if @merge_request.closed_event
+ by #{link_to_member(@project, @merge_request.closed_event.author, avatar: true)}
+ #{time_ago_with_tooltip(@merge_request.closed_event.created_at)}
+ %p Changes were not merged into target branch
diff --git a/app/views/projects/merge_requests/widget/_heading.html.haml b/app/views/projects/merge_requests/widget/_heading.html.haml
new file mode 100644
index 00000000000..a1707821334
--- /dev/null
+++ b/app/views/projects/merge_requests/widget/_heading.html.haml
@@ -0,0 +1,34 @@
+- if @merge_request.has_ci?
+ .mr-widget-heading
+ .ci_widget.ci-success{style: "display:none"}
+ = icon("check")
+ %span CI build passed
+ for #{@merge_request.last_commit_short_sha}.
+ = link_to "View build page", ci_build_details_path(@merge_request), :"data-no-turbolink" => "data-no-turbolink"
+
+ .ci_widget.ci-failed{style: "display:none"}
+ = icon("times")
+ %span CI build failed
+ for #{@merge_request.last_commit_short_sha}.
+ = link_to "View build page", ci_build_details_path(@merge_request), :"data-no-turbolink" => "data-no-turbolink"
+
+ - [:running, :pending].each do |status|
+ .ci_widget{class: "ci-#{status}", style: "display:none"}
+ = icon("clock-o")
+ %span CI build #{status}
+ for #{@merge_request.last_commit_short_sha}.
+ = link_to "View build page", ci_build_details_path(@merge_request), :"data-no-turbolink" => "data-no-turbolink"
+
+ .ci_widget
+ = icon("spinner spin")
+ Checking for CI status for #{@merge_request.last_commit_short_sha}
+
+ .ci_widget.ci-canceled{style: "display:none"}
+ = icon("times")
+ %span CI build canceled
+ for #{@merge_request.last_commit_short_sha}.
+ = link_to "View build page", ci_build_details_path(@merge_request), :"data-no-turbolink" => "data-no-turbolink"
+
+ .ci_widget.ci-error{style: "display:none"}
+ = icon("times")
+ %span Cannot connect to the CI server. Please check your settings and try again.
diff --git a/app/views/projects/merge_requests/widget/_locked.html.haml b/app/views/projects/merge_requests/widget/_locked.html.haml
new file mode 100644
index 00000000000..67f841db520
--- /dev/null
+++ b/app/views/projects/merge_requests/widget/_locked.html.haml
@@ -0,0 +1,8 @@
+.mr-state-widget
+ = render 'heading'
+ .mr-widget-body
+ %h4
+ Merge in progress...
+ %p
+ Merging is in progress. While merging this request is locked and cannot be closed.
+
diff --git a/app/views/projects/merge_requests/widget/_merged.html.haml b/app/views/projects/merge_requests/widget/_merged.html.haml
new file mode 100644
index 00000000000..bd1bc660b9b
--- /dev/null
+++ b/app/views/projects/merge_requests/widget/_merged.html.haml
@@ -0,0 +1,26 @@
+.mr-state-widget
+ = render 'heading'
+ .mr-widget-body
+ %h4
+ Accepted
+ - if @merge_request.merge_event
+ by #{link_to_member(@project, @merge_request.merge_event.author, avatar: true)}
+ #{time_ago_with_tooltip(@merge_request.merge_event.created_at)}
+ %div
+ - if @source_branch.blank?
+ Source branch has been removed
+
+ - elsif can_remove_branch?(@merge_request.source_project, @merge_request.source_branch) && @merge_request.merged?
+ .remove_source_branch_widget
+ %p Changes merged into #{@merge_request.target_branch}. You can remove source branch now
+ = link_to namespace_project_branch_path(@merge_request.source_project.namespace, @merge_request.source_project, @source_branch), remote: true, method: :delete, class: "btn btn-primary btn-sm remove_source_branch" do
+ %i.fa.fa-times
+ Remove Source Branch
+
+ .remove_source_branch_widget.failed.hide
+ Failed to remove source branch '#{@merge_request.source_branch}'
+
+ .remove_source_branch_in_progress.hide
+ %i.fa.fa-spinner.fa-spin
+ &nbsp;
+ Removing source branch '#{@merge_request.source_branch}'. Please wait. Page will be automatically reloaded. &nbsp;
diff --git a/app/views/projects/merge_requests/widget/_mr_accept.html.haml b/app/views/projects/merge_requests/widget/_mr_accept.html.haml
new file mode 100644
index 00000000000..d3f7a09144e
--- /dev/null
+++ b/app/views/projects/merge_requests/widget/_mr_accept.html.haml
@@ -0,0 +1,20 @@
+- if @show_merge_controls
+ .automerge_widget.can_be_merged.hide
+ .clearfix
+
+ .automerge_widget.cannot_be_merged.hide
+
+ %p
+ %button.btn.disabled{:type => 'button'}
+ %i.fa.fa-warning
+ Accept Merge Request
+ &nbsp;
+ This happens when Git is not able to automatically resolve conflicts between branches.
+
+
+ .automerge_widget.unchecked
+
+ .automerge_widget.already_cannot_be_merged.hide
+ %p
+ %strong This merge request cannot be merged. Try to reload the page.
+
diff --git a/app/views/projects/merge_requests/widget/_open.html.haml b/app/views/projects/merge_requests/widget/_open.html.haml
new file mode 100644
index 00000000000..645ad6e9e49
--- /dev/null
+++ b/app/views/projects/merge_requests/widget/_open.html.haml
@@ -0,0 +1,29 @@
+.mr-state-widget
+ = render 'projects/merge_requests/widget/heading'
+ .mr-widget-body
+ - if @project.archived?
+ = render 'projects/merge_requests/widget/open/archived'
+ - elsif !@project.satellite.exists?
+ = render 'projects/merge_requests/widget/open/no_satellite'
+ - elsif @commits.blank?
+ = render 'projects/merge_requests/widget/open/nothing'
+ - elsif @merge_request.branch_missing?
+ = render 'projects/merge_requests/widget/open/missing_branch'
+ - elsif @merge_request.unchecked?
+ = render 'projects/merge_requests/widget/open/check'
+ - elsif @merge_request.cannot_be_merged?
+ = render 'projects/merge_requests/widget/open/conflicts'
+ - elsif @merge_request.work_in_progress?
+ = render 'projects/merge_requests/widget/open/wip'
+ - elsif !@allowed_to_merge
+ = render 'projects/merge_requests/widget/open/not_allowed'
+ - elsif @merge_request.can_be_merged?
+ = render 'projects/merge_requests/widget/open/accept'
+
+ - if @closes_issues.present?
+ .mr-widget-footer
+ %span
+ %i.fa.fa-check
+ Accepting this merge request will close #{@closes_issues.size == 1 ? 'issue' : 'issues'}
+ = succeed '.' do
+ != gfm(issues_sentence(@closes_issues))
diff --git a/app/views/projects/merge_requests/widget/_show.html.haml b/app/views/projects/merge_requests/widget/_show.html.haml
new file mode 100644
index 00000000000..da936a54aa6
--- /dev/null
+++ b/app/views/projects/merge_requests/widget/_show.html.haml
@@ -0,0 +1,8 @@
+- if @merge_request.open?
+ = render 'projects/merge_requests/widget/open'
+- elsif @merge_request.merged?
+ = render 'projects/merge_requests/widget/merged'
+- elsif @merge_request.closed?
+ = render 'projects/merge_requests/widget/closed'
+- elsif @merge_request.locked?
+ = render 'projects/merge_requests/widget/locked'
diff --git a/app/views/projects/merge_requests/widget/open/_accept.html.haml b/app/views/projects/merge_requests/widget/open/_accept.html.haml
new file mode 100644
index 00000000000..aa14b0cf21e
--- /dev/null
+++ b/app/views/projects/merge_requests/widget/open/_accept.html.haml
@@ -0,0 +1,24 @@
+= form_for [:automerge, @project.namespace.becomes(Namespace), @project, @merge_request], remote: true, method: :post do |f|
+ .accept-merge-holder.clearfix.js-toggle-container
+ .accept-action
+ = f.submit "Accept Merge Request", class: "btn btn-create accept_merge_request"
+ - if can_remove_branch?(@merge_request.source_project, @merge_request.source_branch) && !@merge_request.for_fork?
+ .accept-control.checkbox
+ = label_tag :should_remove_source_branch, class: "remove_source_checkbox" do
+ = check_box_tag :should_remove_source_branch
+ Remove source-branch
+ .accept-control
+ = link_to "#", class: "modify-merge-commit-link js-toggle-button", title: "Modify merge commit message" do
+ %i.fa.fa-edit
+ Modify commit message
+ .js-toggle-content.hide.prepend-top-20
+ = render 'shared/commit_message_container', params: params,
+ text: @merge_request.merge_commit_message,
+ rows: 14, hint: true
+
+ %br
+ .light
+ If you want to merge this request manually, you can use the
+ %strong
+ = link_to "command line", "#modal_merge_info", class: "how_to_merge_link vlink", title: "How To Merge", "data-toggle" => "modal"
+
diff --git a/app/views/projects/merge_requests/widget/open/_archived.html.haml b/app/views/projects/merge_requests/widget/open/_archived.html.haml
new file mode 100644
index 00000000000..eaf113ee568
--- /dev/null
+++ b/app/views/projects/merge_requests/widget/open/_archived.html.haml
@@ -0,0 +1,2 @@
+%p
+ %strong Archived projects do not provide commit access.
diff --git a/app/views/projects/merge_requests/widget/open/_check.html.haml b/app/views/projects/merge_requests/widget/open/_check.html.haml
new file mode 100644
index 00000000000..95a5bcd03c3
--- /dev/null
+++ b/app/views/projects/merge_requests/widget/open/_check.html.haml
@@ -0,0 +1,4 @@
+%p
+ %strong
+ %i.fa.fa-spinner.fa-spin
+ Checking automatic merge…
diff --git a/app/views/projects/merge_requests/widget/open/_conflict.html.haml b/app/views/projects/merge_requests/widget/open/_conflict.html.haml
new file mode 100644
index 00000000000..3fc294bc0b5
--- /dev/null
+++ b/app/views/projects/merge_requests/widget/open/_conflict.html.haml
@@ -0,0 +1,5 @@
+%h4
+ This merge request contains merge conflicts that must be resolved.
+ You can try it manually on the
+ %strong
+ = link_to "command line", "#modal_merge_info", class: "how_to_merge_link vlink", title: "How To Merge", "data-toggle" => "modal"
diff --git a/app/views/projects/merge_requests/widget/open/_mip.html.haml b/app/views/projects/merge_requests/widget/open/_mip.html.haml
new file mode 100644
index 00000000000..d86aaff3507
--- /dev/null
+++ b/app/views/projects/merge_requests/widget/open/_mip.html.haml
@@ -0,0 +1,5 @@
+.merge-in-progress
+ %p
+ %i.fa.fa-spinner.fa-spin
+ &nbsp;
+ Merge is in progress. Please wait… Page will be reloaded automatically. &nbsp;
diff --git a/app/views/projects/merge_requests/show/_no_accept.html.haml b/app/views/projects/merge_requests/widget/open/_missing_branch.html.haml
index 423fcd48e25..423fcd48e25 100644
--- a/app/views/projects/merge_requests/show/_no_accept.html.haml
+++ b/app/views/projects/merge_requests/widget/open/_missing_branch.html.haml
diff --git a/app/views/projects/merge_requests/widget/open/_no_satellite.html.haml b/app/views/projects/merge_requests/widget/open/_no_satellite.html.haml
new file mode 100644
index 00000000000..3718cfd8333
--- /dev/null
+++ b/app/views/projects/merge_requests/widget/open/_no_satellite.html.haml
@@ -0,0 +1,3 @@
+%p
+ %span
+ %strong This repository does not have a satellite. Please ask an administrator to fix this issue!
diff --git a/app/views/projects/merge_requests/widget/open/_not_allowed.html.haml b/app/views/projects/merge_requests/widget/open/_not_allowed.html.haml
new file mode 100644
index 00000000000..3989009c36e
--- /dev/null
+++ b/app/views/projects/merge_requests/widget/open/_not_allowed.html.haml
@@ -0,0 +1,9 @@
+.automerge_widget.cannot_be_merged.hide
+ %strong This merge request contains merge conflicts that must be resolved.
+ Only those with write access to this repository can merge merge requests.
+.automerge_widget.work_in_progress.hide
+ %strong This merge request is marked as Work In Progress.
+ Only those with write access to this repository can merge merge requests.
+.automerge_widget.can_be_merged.hide
+ %strong This request can be merged automatically.
+ Only those with write access to this repository can merge merge requests.
diff --git a/app/views/projects/merge_requests/widget/open/_nothing.html.haml b/app/views/projects/merge_requests/widget/open/_nothing.html.haml
new file mode 100644
index 00000000000..4d526576bc2
--- /dev/null
+++ b/app/views/projects/merge_requests/widget/open/_nothing.html.haml
@@ -0,0 +1,8 @@
+%h4 Nothing to merge
+%p
+ Nothing to merge from
+ %span.label-branch #{@merge_request.source_branch}
+ to
+ %span.label-branch #{@merge_request.target_branch}
+ %br
+ Try to use different branches or push new code.
diff --git a/app/views/projects/merge_requests/widget/open/_wip.html.haml b/app/views/projects/merge_requests/widget/open/_wip.html.haml
new file mode 100644
index 00000000000..9268d68ba34
--- /dev/null
+++ b/app/views/projects/merge_requests/widget/open/_wip.html.haml
@@ -0,0 +1,9 @@
+%h4
+ This merge request cannot be accepted because it is marked as Work In Progress.
+
+%p
+ %button.btn.disabled{:type => 'button'}
+ %i.fa.fa-warning
+ Accept Merge Request
+ &nbsp;
+ When the merge request is ready, remove the "WIP" prefix from the title to allow it to be accepted.