Commit 3168b2d9 authored by Eric Eastwood's avatar Eric Eastwood

More formatting fixes and eslint

parent 67a6b171
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
/* global Flash */ /* global Flash */
import Store from '../stores/repo_store'; import Store from '../stores/repo_store';
import RepoMixin from '../mixins/repo_mixin'; import RepoMixin from '../mixins/repo_mixin';
import Helper from '../helpers/repo_helper';
import Service from '../services/repo_service'; import Service from '../services/repo_service';
const RepoCommitSection = { const RepoCommitSection = {
......
...@@ -11,8 +11,11 @@ export default { ...@@ -11,8 +11,11 @@ export default {
}, },
showButton() { showButton() {
return this.isCommitable && !this.activeFile.render_error && !this.binary && this.openedFiles.length; return this.isCommitable &&
} !this.activeFile.render_error &&
!this.binary &&
this.openedFiles.length;
},
}, },
methods: { methods: {
editCancelClicked() { editCancelClicked() {
...@@ -35,8 +38,18 @@ export default { ...@@ -35,8 +38,18 @@ export default {
</script> </script>
<template> <template>
<button class="btn btn-default" type="button" @click.prevent="editCancelClicked" v-if="showButton"> <button
<i class="fa fa-pencil" v-if="!editMode"></i> v-if="showButton"
<span>{{buttonLabel}}</span> class="btn btn-default"
type="button"
@click.prevent="editCancelClicked">
<i
v-if="!editMode"
class="fa fa-pencil"
aria-hidden="true">
</i>
<span>
{{buttonLabel}}
</span>
</button> </button>
</template> </template>
...@@ -8,7 +8,7 @@ const RepoEditor = { ...@@ -8,7 +8,7 @@ const RepoEditor = {
data: () => Store, data: () => Store,
destroyed() { destroyed() {
if(Helper.monacoInstance){ if (Helper.monacoInstance) {
Helper.monacoInstance.destroy(); Helper.monacoInstance.destroy();
} }
}, },
...@@ -32,8 +32,8 @@ const RepoEditor = { ...@@ -32,8 +32,8 @@ const RepoEditor = {
Helper.setMonacoModelFromLanguage(); Helper.setMonacoModelFromLanguage();
this.showHide(); this.showHide();
})
}).catch(Helper.loadingError); .catch(Helper.loadingError);
}, },
methods: { methods: {
...@@ -50,14 +50,12 @@ const RepoEditor = { ...@@ -50,14 +50,12 @@ const RepoEditor = {
Helper.monacoInstance.onKeyUp(this.onMonacoEditorKeysPressed.bind(this)); Helper.monacoInstance.onKeyUp(this.onMonacoEditorKeysPressed.bind(this));
}, },
onMonacoEditorKeysPressed() { onMonacoEditorKeysPressed() {
Store.setActiveFileContents(Helper.monacoInstance.getValue()); Store.setActiveFileContents(Helper.monacoInstance.getValue());
}, },
onMonacoEditorMouseUp(e) { onMonacoEditorMouseUp(e) {
if(!e.target.position) return; if (!e.target.position) return;
const lineNumber = e.target.position.lineNumber; const lineNumber = e.target.position.lineNumber;
if (e.target.element.classList.contains('line-numbers')) { if (e.target.element.classList.contains('line-numbers')) {
location.hash = `L${lineNumber}`; location.hash = `L${lineNumber}`;
......
...@@ -35,21 +35,20 @@ const RepoFile = { ...@@ -35,21 +35,20 @@ const RepoFile = {
}, },
fileIcon() { fileIcon() {
let classObj = { const classObj = {
'fa-spinner' : this.file.loading, 'fa-spinner fa-spin': this.file.loading,
'fa-spin' : this.file.loading, [this.file.icon]: !this.file.loading,
[this.file.icon] : !this.file.loading,
}; };
return classObj; return classObj;
}, },
fileIndentation() { fileIndentation() {
return {'margin-left': this.file.level * 10 + 'px'}; return { 'margin-left': `${this.file.level * 10}px` };
}, },
activeFileClass() { activeFileClass() {
return {'active': this.activeFile.url === this.file.url}; return { active: this.activeFile.url === this.file.url };
} },
}, },
methods: { methods: {
...@@ -63,20 +62,44 @@ export default RepoFile; ...@@ -63,20 +62,44 @@ export default RepoFile;
</script> </script>
<template> <template>
<tr class="file" v-if="canShowFile" :class="activeFileClass" @click.prevent="linkClicked(file)"> <tr
v-if="canShowFile"
class="file"
:class="activeFileClass"
@click.prevent="linkClicked(file)">
<td> <td>
<i class="fa fa-fw file-icon" :class="fileIcon" :style="fileIndentation" aria-label="file icon"></i> <i
<a :href="file.url" class="repo-file-name" :title="file.url">{{file.name}}</a> class="fa fa-fw file-icon"
:class="fileIcon"
:style="fileIndentation"
aria-label="file icon">
</i>
<a
:href="file.url"
class="repo-file-name"
:title="file.url">
{{file.name}}
</a>
</td> </td>
<td v-if="!isMini" class="hidden-sm hidden-xs"> <td
v-if="!isMini"
class="hidden-sm hidden-xs">
<div class="commit-message"> <div class="commit-message">
<a :href="file.lastCommitUrl">{{file.lastCommitMessage}}</a> <a :href="file.lastCommitUrl">
{{file.lastCommitMessage}}
</a>
</div> </div>
</td> </td>
<td v-if="!isMini" class="hidden-xs"> <td
<span class="commit-update" :title="tooltipTitle(file.lastCommitUpdate)">{{timeFormated(file.lastCommitUpdate)}}</span> v-if="!isMini"
class="hidden-xs">
<span
class="commit-update"
:title="tooltipTitle(file.lastCommitUpdate)">
{{timeFormated(file.lastCommitUpdate)}}
</span>
</td> </td>
</tr> </tr>
</template> </template>
...@@ -21,7 +21,7 @@ const RepoLoadingFile = { ...@@ -21,7 +21,7 @@ const RepoLoadingFile = {
computed: { computed: {
showGhostLines() { showGhostLines() {
return this.loading.tree && !this.hasFiles; return this.loading.tree && !this.hasFiles;
} },
}, },
methods: { methods: {
......
...@@ -14,7 +14,7 @@ const RepoPreviousDirectory = { ...@@ -14,7 +14,7 @@ const RepoPreviousDirectory = {
computed: { computed: {
colSpanCondition() { colSpanCondition() {
return this.isMini ? undefined : 3; return this.isMini ? undefined : 3;
} },
}, },
methods: { methods: {
...@@ -29,7 +29,9 @@ export default RepoPreviousDirectory; ...@@ -29,7 +29,9 @@ export default RepoPreviousDirectory;
<template> <template>
<tr class="prev-directory"> <tr class="prev-directory">
<td :colspan="colSpanCondition" @click.prevent="linkClicked(prevUrl)"> <td
:colspan="colSpanCondition"
@click.prevent="linkClicked(prevUrl)">
<a :href="prevUrl">..</a> <a :href="prevUrl">..</a>
</td> </td>
</tr> </tr>
......
...@@ -92,7 +92,6 @@ const RepoHelper = { ...@@ -92,7 +92,6 @@ const RepoHelper = {
return RepoHelper.mergeNewListToOldList(newListSorted, currentList, inDirectory, indexOfFile); return RepoHelper.mergeNewListToOldList(newListSorted, currentList, inDirectory, indexOfFile);
}, },
// within the get new merged list this does the merging of the current list of files // within the get new merged list this does the merging of the current list of files
// and the new list of files. The files are never "in" another directory they just // and the new list of files. The files are never "in" another directory they just
// appear like they are because of the margin. // appear like they are because of the margin.
...@@ -280,7 +279,7 @@ const RepoHelper = { ...@@ -280,7 +279,7 @@ const RepoHelper = {
return Store.openedFiles.find(openedFile => Store.activeFile.url === openedFile.url); return Store.openedFiles.find(openedFile => Store.activeFile.url === openedFile.url);
}, },
loadingError(e) { loadingError() {
Flash('Unable to load this content at this time.'); Flash('Unable to load this content at this time.');
}, },
}; };
......
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