Implement commit in merge conflicts UI.

This commit is contained in:
Fatih Acet 2016-08-02 15:16:21 +03:00
parent c2295fbdf8
commit 8b6a075e6f
4 changed files with 25 additions and 6 deletions

View file

@ -26,7 +26,7 @@ window.MergeConflictDataProvider = class MergeConflictDataProvider {
} }
else { else {
data.shortCommitSha = data.commit_sha.slice(0, 7); data.shortCommitSha = data.commit_sha.slice(0, 7);
data.commitMesage = data.commit_message; data.commitMessage = data.commit_message;
this.setParallelLines(data); this.setParallelLines(data);
this.setInlineLines(data); this.setInlineLines(data);
@ -284,4 +284,12 @@ window.MergeConflictDataProvider = class MergeConflictDataProvider {
vueInstance.conflictsData.errorMessage = 'Something went wrong!'; vueInstance.conflictsData.errorMessage = 'Something went wrong!';
} }
getCommitData() {
return {
commitMessage: this.vueInstance.conflictsData.commitMessage,
sections: this.vueInstance.resolutionData
}
}
} }

View file

@ -22,6 +22,9 @@ window.MergeConflictResolver = class MergeConflictResolver {
}, },
handleViewTypeChange(newType) { handleViewTypeChange(newType) {
that.dataProvider.updateViewType(newType); that.dataProvider.updateViewType(newType);
},
commit() {
that.commit();
} }
} }
}) })
@ -54,4 +57,11 @@ window.MergeConflictResolver = class MergeConflictResolver {
} }
} }
commit() {
$.post('./resolve_conflicts', this.dataProvider.getCommitData())
.always( (data) => {
console.log(data)
})
}
} }

View file

@ -81,7 +81,7 @@
if (action === 'show') { if (action === 'show') {
action = 'notes'; action = 'notes';
} }
new_state = this._location.pathname.replace(/\/(commits|diffs|builds|conflicts)(\.html)?\/?$/, ''); new_state = this._location.pathname.replace(/\/(commits|diffs|builds)(\.html)?\/?$/, '');
if (action !== 'notes') { if (action !== 'notes') {
new_state += "/" + action; new_state += "/" + action;
} }

View file

@ -107,10 +107,11 @@
.commit-message-container.form-group .commit-message-container.form-group
.max-width-marker .max-width-marker
%textarea.form-control.js-commit-message{":disabled" => "!allResolved"} {{{conflictsData.commitMessage}}} %textarea.form-control.js-commit-message{":disabled" => "!allResolved", "v-model" => "conflictsData.commitMessage"}
{{{conflictsData.commitMessage}}}
%button{type: 'button', class: 'btn btn-success js-submit-button', ":disabled" => "!allResolved"} %button{type: 'button', class: 'btn btn-success js-submit-button', ":disabled" => "!allResolved", "@click" => "commit()"}
Commit conflict resolution Commit conflict resolution
%button{type: 'button', class: 'btn btn-cancel'} / %button{type: 'button', class: 'btn btn-cancel'}
Cancel / Cancel