Disable commit button if commit message textarea empty.
This commit is contained in:
parent
a1d0b0398b
commit
14888a398c
2 changed files with 10 additions and 5 deletions
|
@ -237,8 +237,14 @@ class MergeConflictDataProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
isAllResolved() {
|
isReadyToCommit() {
|
||||||
return !this.vueInstance.isSubmitting && this.getConflictsCount() === this.getResolvedCount();
|
const { conflictsData, isSubmitting } = this.vueInstance
|
||||||
|
const allResolved = this.getConflictsCount() === this.getResolvedCount();
|
||||||
|
const hasCommitMessage = $.trim(conflictsData.commitMessage).length;
|
||||||
|
|
||||||
|
return !isSubmitting && hasCommitMessage && allResolved;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
getCommitButtonText() {
|
getCommitButtonText() {
|
||||||
const initial = 'Commit conflict resolution';
|
const initial = 'Commit conflict resolution';
|
||||||
|
|
|
@ -6,11 +6,10 @@
|
||||||
|
|
||||||
.commit-message-container.form-group
|
.commit-message-container.form-group
|
||||||
.max-width-marker
|
.max-width-marker
|
||||||
%textarea.form-control.js-commit-message{":disabled" => "!allResolved", "v-model" => "conflictsData.commitMessage"}
|
%textarea.form-control.js-commit-message{"v-model" => "conflictsData.commitMessage"}
|
||||||
{{{conflictsData.commitMessage}}}
|
{{{conflictsData.commitMessage}}}
|
||||||
|
|
||||||
%button{type: "button", class: "btn btn-success js-submit-button", ":disabled" => "!allResolved", "@click" => "commit()"}
|
%button{type: "button", class: "btn btn-success js-submit-button", ":disabled" => "!readyToCommit", "@click" => "commit()"}
|
||||||
%a.fa.fa-spin.fa-spinner{":class" => "{'hidden': !isSubmitting}"}
|
|
||||||
%span {{commitButtonText}}
|
%span {{commitButtonText}}
|
||||||
|
|
||||||
= link_to "Cancel", namespace_project_merge_request_path(@merge_request.project.namespace, @merge_request.project, @merge_request), class: "btn btn-cancel"
|
= link_to "Cancel", namespace_project_merge_request_path(@merge_request.project.namespace, @merge_request.project, @merge_request), class: "btn btn-cancel"
|
||||||
|
|
Loading…
Reference in a new issue