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 {
data.shortCommitSha = data.commit_sha.slice(0, 7);
data.commitMesage = data.commit_message;
data.commitMessage = data.commit_message;
this.setParallelLines(data);
this.setInlineLines(data);
@ -284,4 +284,12 @@ window.MergeConflictDataProvider = class MergeConflictDataProvider {
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) {
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') {
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') {
new_state += "/" + action;
}

View file

@ -107,10 +107,11 @@
.commit-message-container.form-group
.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
%button{type: 'button', class: 'btn btn-cancel'}
Cancel
/ %button{type: 'button', class: 'btn btn-cancel'}
/ Cancel