From ea7bf7eda44db68b6a8aadfff3afe8117a510989 Mon Sep 17 00:00:00 2001 From: jurre Date: Thu, 22 Dec 2016 19:45:36 +0100 Subject: Show a custom WIP help message for MR's with WIP commits --- app/views/projects/merge_requests/_new_submit.html.haml | 2 +- app/views/shared/issuable/_form.html.haml | 3 ++- app/views/shared/issuable/form/_title.html.haml | 4 ++++ 3 files changed, 7 insertions(+), 2 deletions(-) (limited to 'app') diff --git a/app/views/projects/merge_requests/_new_submit.html.haml b/app/views/projects/merge_requests/_new_submit.html.haml index 34ead6427e0..36c6e7a8dad 100644 --- a/app/views/projects/merge_requests/_new_submit.html.haml +++ b/app/views/projects/merge_requests/_new_submit.html.haml @@ -11,7 +11,7 @@ = link_to 'Change branches', mr_change_branches_path(@merge_request) %hr = form_for [@project.namespace.becomes(Namespace), @project, @merge_request], html: { class: 'merge-request-form form-horizontal common-note-form js-requires-input js-quick-submit' } do |f| - = render 'shared/issuable/form', f: f, issuable: @merge_request + = render 'shared/issuable/form', f: f, issuable: @merge_request, commits: @commits = f.hidden_field :source_project_id = f.hidden_field :source_branch = f.hidden_field :target_project_id diff --git a/app/views/shared/issuable/_form.html.haml b/app/views/shared/issuable/_form.html.haml index dcc1f3ba676..c0e8a498316 100644 --- a/app/views/shared/issuable/_form.html.haml +++ b/app/views/shared/issuable/_form.html.haml @@ -1,4 +1,5 @@ - form = local_assigns.fetch(:f) +- commits = local_assigns[:commits] - project = @target_project || @project = form_errors(issuable) @@ -14,7 +15,7 @@ = form.label :title, class: 'control-label' = render 'shared/issuable/form/template_selector', issuable: issuable - = render 'shared/issuable/form/title', issuable: issuable, form: form + = render 'shared/issuable/form/title', issuable: issuable, form: form, has_wip_commits: commits && commits.detect(&:work_in_progress?) = render 'shared/issuable/form/description', issuable: issuable, form: form diff --git a/app/views/shared/issuable/form/_title.html.haml b/app/views/shared/issuable/form/_title.html.haml index 83efdc7c8f7..64826d41d60 100644 --- a/app/views/shared/issuable/form/_title.html.haml +++ b/app/views/shared/issuable/form/_title.html.haml @@ -1,4 +1,5 @@ - issuable = local_assigns.fetch(:issuable) +- has_wip_commits = local_assigns.fetch(:has_wip_commits) - form = local_assigns.fetch(:form) - no_issuable_templates = issuable_templates(issuable).empty? - div_class = no_issuable_templates ? 'col-sm-10' : 'col-sm-7 col-lg-8' @@ -18,6 +19,9 @@ %strong Work In Progress merge request to be merged when it's ready. .js-no-wip-explanation + - if has_wip_commits + It looks like you have some WIP commits in this branch. + %br %a.js-toggle-wip{ href: '', tabindex: -1 } Start the title with %code WIP: -- cgit v1.2.1