Commit 8b6a075e authored by Fatih Acet's avatar Fatih Acet

Implement commit in merge conflicts UI.

parent c2295fbd
...@@ -26,7 +26,7 @@ window.MergeConflictDataProvider = class MergeConflictDataProvider { ...@@ -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 { ...@@ -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
}
}
} }
...@@ -22,6 +22,9 @@ window.MergeConflictResolver = class MergeConflictResolver { ...@@ -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 { ...@@ -54,4 +57,11 @@ window.MergeConflictResolver = class MergeConflictResolver {
} }
} }
commit() {
$.post('./resolve_conflicts', this.dataProvider.getCommitData())
.always( (data) => {
console.log(data)
})
}
} }
...@@ -81,7 +81,7 @@ ...@@ -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;
} }
......
...@@ -107,10 +107,11 @@ ...@@ -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
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