Commit 3098e7a4 authored by Ciro Santilli's avatar Ciro Santilli

Factor commit message textareas.

parent b0349915
...@@ -15,7 +15,7 @@ class MergeRequest ...@@ -15,7 +15,7 @@ class MergeRequest
modal = $('#modal_merge_info').modal(show: false) modal = $('#modal_merge_info').modal(show: false)
disableButtonIfEmptyField '#merge_commit_message', '.accept_merge_request' disableButtonIfEmptyField '#commit_message', '.accept_merge_request'
# Local jQuery finder # Local jQuery finder
......
...@@ -122,7 +122,7 @@ class Projects::MergeRequestsController < Projects::ApplicationController ...@@ -122,7 +122,7 @@ class Projects::MergeRequestsController < Projects::ApplicationController
if @merge_request.open? && @merge_request.can_be_merged? if @merge_request.open? && @merge_request.can_be_merged?
@merge_request.should_remove_source_branch = params[:should_remove_source_branch] @merge_request.should_remove_source_branch = params[:should_remove_source_branch]
@merge_request.automerge!(current_user, params[:merge_commit_message]) @merge_request.automerge!(current_user, params[:commit_message])
@status = true @status = true
else else
@status = false @status = false
......
...@@ -10,12 +10,8 @@ ...@@ -10,12 +10,8 @@
.modal-body .modal-body
= form_tag project_blob_path(@project, @id), method: :delete, class: 'form-horizontal' do = form_tag project_blob_path(@project, @id), method: :delete, class: 'form-horizontal' do
.form-group.commit_message-group = render 'shared/commit_message_container', params: params,
= label_tag 'commit_message', class: "control-label" do placeholder: 'Removed this file because...'
Commit message
.col-sm-10
= render 'shared/commit_message_container', {textarea: text_area_tag('commit_message',
params[:commit_message], placeholder: "Removed this file because...", required: true, rows: 3, class: 'form-control')}
.form-group .form-group
.col-sm-2 .col-sm-2
.col-sm-10 .col-sm-10
......
...@@ -21,13 +21,8 @@ ...@@ -21,13 +21,8 @@
.center .center
%h2 %h2
%i.icon-spinner.icon-spin %i.icon-spinner.icon-spin
= render 'shared/commit_message_container', params: params,
.form-group.commit_message-group placeholder: "Update #{@blob.name}"
= label_tag 'commit_message', class: "control-label" do
Commit message
.col-sm-10
= render 'shared/commit_message_container', {textarea: text_area_tag('commit_message', '',
placeholder: "Update #{@blob.name}", required: true, rows: 3, class: 'form-control')}
.form-actions .form-actions
= hidden_field_tag 'last_commit', @last_commit = hidden_field_tag 'last_commit', @last_commit
= hidden_field_tag 'content', '', id: "file-content" = hidden_field_tag 'content', '', id: "file-content"
......
...@@ -22,15 +22,9 @@ ...@@ -22,15 +22,9 @@
%strong= link_to "modify merge commit message", "#", class: "modify-merge-commit-link js-toggle-button", title: "Modify merge commit message" %strong= link_to "modify merge commit message", "#", class: "modify-merge-commit-link js-toggle-button", title: "Modify merge commit message"
before accepting merge request before accepting merge request
.js-toggle-content.hide .js-toggle-content.hide
.form-group = render 'shared/commit_message_container', params: params,
= label_tag :merge_commit_message, "Commit message", class: 'control-label' text: @merge_request.merge_commit_message,
.col-sm-10 rows: 14, hint: true
= render 'shared/commit_message_container', {textarea: text_area_tag(:merge_commit_message,
@merge_request.merge_commit_message, class: "form-control js-gfm-input", rows: 14, required: true)}
%p.hint
Try to keep the first line under 52 characters
and the others under 72.
.accept-group .accept-group
.pull-left .pull-left
= f.submit "Accept Merge Request", class: "btn btn-create accept_merge_request" = f.submit "Accept Merge Request", class: "btn btn-create accept_merge_request"
......
...@@ -19,15 +19,8 @@ ...@@ -19,15 +19,8 @@
Encoding Encoding
.col-sm-10 .col-sm-10
= select_tag :encoding, options_for_select([ "base64", "text" ], "text"), class: 'form-control' = select_tag :encoding, options_for_select([ "base64", "text" ], "text"), class: 'form-control'
= render 'shared/commit_message_container', params: params,
.form-group.commit_message-group placeholder: 'Add new file'
= label_tag 'commit_message', class: "control-label" do
Commit message
.col-sm-10
= render 'shared/commit_message_container', {textarea: text_area_tag('commit_message',
params[:commit_message], placeholder: 'Add new file',
required: true, rows: 3, class: 'form-control')}
.file-holder .file-holder
.file-title .file-title
%i.icon-file %i.icon-file
......
.commit-message-container .form-group.commit_message-group
.max-width-marker = label_tag 'commit_message', class: 'control-label' do
= textarea Commit message
.col-sm-10
.commit-message-container
.max-width-marker
= text_area_tag 'commit_message',
(params[:commit_message] || local_assigns[:text]),
class: 'form-control', placeholder: local_assigns[:placeholder],
required: true, rows: (local_assigns[:rows] || 3)
- if local_assigns[:hint]
%p.hint
Try to keep the first line under 52 characters
and the others under 72.
...@@ -154,7 +154,7 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps ...@@ -154,7 +154,7 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
step 'I modify merge commit message' do step 'I modify merge commit message' do
find('.modify-merge-commit-link').click find('.modify-merge-commit-link').click
fill_in 'merge_commit_message', with: "wow such merge" fill_in 'commit_message', with: 'wow such merge'
end end
step 'merge request "Bug NS-05" is mergeable' do step 'merge request "Bug NS-05" is mergeable' do
......
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