Commit 67a6b171 authored by Eric Eastwood's avatar Eric Eastwood

Format and remove unused cruft

parent 0c8c9543
......@@ -17,7 +17,6 @@ const RepoCommitSection = {
},
branchPaths() {
const branch = this.currentBranch;
return this.changedFiles.map(f => f.path);
},
......@@ -33,15 +32,12 @@ const RepoCommitSection = {
methods: {
makeCommit() {
// see https://docs.gitlab.com/ce/api/commits.html#create-a-commit-with-multiple-files-and-actions
const branch = Store.currentBranch;
const commitMessage = this.commitMessage;
const actions = this.changedFiles.map(f => {
return {
action: 'update',
file_path: f.path,
content: f.newContent,
};
});
const actions = this.changedFiles.map(f => ({
action: 'update',
file_path: f.path,
content: f.newContent,
}));
const payload = {
branch: Store.targetBranch,
commit_message: commitMessage,
......@@ -54,10 +50,9 @@ const RepoCommitSection = {
resetCommitState() {
this.submitCommitsLoading = false;
this.changedFiles = [];
// this.openedFiles = [];
this.commitMessage = '';
this.editMode = false;
window.scrollTo(0,0);
window.scrollTo(0, 0);
},
},
};
......@@ -66,35 +61,68 @@ export default RepoCommitSection;
</script>
<template>
<div id="commit-area" v-if="showCommitable">
<form class="form-horizontal" @submit.prevent="makeCommit">
<div
v-if="showCommitable"
id="commit-area">
<form
class="form-horizontal"
@submit.prevent="makeCommit">
<fieldset>
<div class="form-group">
<label class="col-md-4 control-label staged-files">Staged files ({{changedFiles.length}})</label>
<label class="col-md-4 control-label staged-files">
Staged files ({{changedFiles.length}})
</label>
<div class="col-md-6">
<ul class="list-unstyled changed-files">
<li v-for="file in branchPaths" :key="file.id">
<span class="help-block">{{file}}</span>
<span class="help-block">
{{file}}
</span>
</li>
</ul>
</div>
</div>
<div class="form-group">
<label class="col-md-4 control-label" for="commit-message">Commit message</label>
<label
class="col-md-4 control-label"
for="commit-message">
Commit message
</label>
<div class="col-md-6">
<textarea class="form-control" id="commit-message" name="commit-message" v-model="commitMessage"></textarea>
<textarea
id="commit-message"
class="form-control"
name="commit-message"
v-model="commitMessage">
</textarea>
</div>
</div>
<div class="form-group target-branch">
<label class="col-md-4 control-label" for="target-branch">Target branch</label>
<label
class="col-md-4 control-label"
for="target-branch">
Target branch
</label>
<div class="col-md-6">
<span class="help-block">{{targetBranch}}</span>
<span class="help-block">
{{targetBranch}}
</span>
</div>
</div>
<div class="col-md-offset-4 col-md-6">
<button type="submit" :disabled="cantCommitYet" class="btn btn-success submit-commit">
<i class="fa fa-spinner fa-spin" v-if="submitCommitsLoading" aria-hidden="true" aria-label="loading"></i>
<span class="commit-summary">Commit {{changedFiles.length}} {{filePluralize}}</span>
<button
type="submit"
:disabled="cantCommitYet"
class="btn btn-success submit-commit">
<i
v-if="submitCommitsLoading"
class="fa fa-spinner fa-spin"
aria-hidden="true"
aria-label="loading">
</i>
<span class="commit-summary">
Commit {{changedFiles.length}} {{filePluralize}}
</span>
</button>
</div>
</fieldset>
......
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