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

More formatting fixes and eslint

parent 67a6b171
......@@ -2,7 +2,6 @@
/* global Flash */
import Store from '../stores/repo_store';
import RepoMixin from '../mixins/repo_mixin';
import Helper from '../helpers/repo_helper';
import Service from '../services/repo_service';
const RepoCommitSection = {
......
......@@ -11,8 +11,11 @@ export default {
},
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: {
editCancelClicked() {
......@@ -35,8 +38,18 @@ export default {
</script>
<template>
<button class="btn btn-default" type="button" @click.prevent="editCancelClicked" v-if="showButton">
<i class="fa fa-pencil" v-if="!editMode"></i>
<span>{{buttonLabel}}</span>
<button
v-if="showButton"
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>
</template>
......@@ -8,32 +8,32 @@ const RepoEditor = {
data: () => Store,
destroyed() {
if(Helper.monacoInstance){
if (Helper.monacoInstance) {
Helper.monacoInstance.destroy();
}
},
mounted() {
Service.getRaw(this.activeFile.raw_path)
.then((rawResponse) => {
Store.blobRaw = rawResponse.data;
Store.activeFile.plain = rawResponse.data;
const monacoInstance = Helper.monaco.editor.create(this.$el, {
model: null,
readOnly: false,
contextmenu: false,
});
.then((rawResponse) => {
Store.blobRaw = rawResponse.data;
Store.activeFile.plain = rawResponse.data;
const monacoInstance = Helper.monaco.editor.create(this.$el, {
model: null,
readOnly: false,
contextmenu: false,
});
Helper.monacoInstance = monacoInstance;
Helper.monacoInstance = monacoInstance;
this.addMonacoEvents();
this.addMonacoEvents();
Helper.setMonacoModelFromLanguage();
this.showHide();
Helper.setMonacoModelFromLanguage();
}).catch(Helper.loadingError);
this.showHide();
})
.catch(Helper.loadingError);
},
methods: {
......@@ -50,19 +50,17 @@ const RepoEditor = {
Helper.monacoInstance.onKeyUp(this.onMonacoEditorKeysPressed.bind(this));
},
onMonacoEditorKeysPressed() {
Store.setActiveFileContents(Helper.monacoInstance.getValue());
},
onMonacoEditorMouseUp(e) {
if(!e.target.position) return;
if (!e.target.position) return;
const lineNumber = e.target.position.lineNumber;
if (e.target.element.classList.contains('line-numbers')) {
location.hash = `L${lineNumber}`;
Store.activeLine = lineNumber;
Helper.monacoInstance.setPosition({
lineNumber: this.activeLine,
column: 1,
......
......@@ -35,21 +35,20 @@ const RepoFile = {
},
fileIcon() {
let classObj = {
'fa-spinner' : this.file.loading,
'fa-spin' : this.file.loading,
[this.file.icon] : !this.file.loading,
const classObj = {
'fa-spinner fa-spin': this.file.loading,
[this.file.icon]: !this.file.loading,
};
return classObj;
},
fileIndentation() {
return {'margin-left': this.file.level * 10 + 'px'};
return { 'margin-left': `${this.file.level * 10}px` };
},
activeFileClass() {
return {'active': this.activeFile.url === this.file.url};
}
return { active: this.activeFile.url === this.file.url };
},
},
methods: {
......@@ -63,20 +62,44 @@ export default RepoFile;
</script>
<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>
<i 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>
<i
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 v-if="!isMini" class="hidden-sm hidden-xs">
<td
v-if="!isMini"
class="hidden-sm hidden-xs">
<div class="commit-message">
<a :href="file.lastCommitUrl">{{file.lastCommitMessage}}</a>
<a :href="file.lastCommitUrl">
{{file.lastCommitMessage}}
</a>
</div>
</td>
<td v-if="!isMini" class="hidden-xs">
<span class="commit-update" :title="tooltipTitle(file.lastCommitUpdate)">{{timeFormated(file.lastCommitUpdate)}}</span>
<td
v-if="!isMini"
class="hidden-xs">
<span
class="commit-update"
:title="tooltipTitle(file.lastCommitUpdate)">
{{timeFormated(file.lastCommitUpdate)}}
</span>
</td>
</tr>
</template>
......@@ -21,7 +21,7 @@ const RepoLoadingFile = {
computed: {
showGhostLines() {
return this.loading.tree && !this.hasFiles;
}
},
},
methods: {
......
......@@ -14,7 +14,7 @@ const RepoPreviousDirectory = {
computed: {
colSpanCondition() {
return this.isMini ? undefined : 3;
}
},
},
methods: {
......@@ -29,7 +29,9 @@ export default RepoPreviousDirectory;
<template>
<tr class="prev-directory">
<td :colspan="colSpanCondition" @click.prevent="linkClicked(prevUrl)">
<td
:colspan="colSpanCondition"
@click.prevent="linkClicked(prevUrl)">
<a :href="prevUrl">..</a>
</td>
</tr>
......
......@@ -92,7 +92,6 @@ const RepoHelper = {
return RepoHelper.mergeNewListToOldList(newListSorted, currentList, inDirectory, indexOfFile);
},
// 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
// appear like they are because of the margin.
......@@ -280,7 +279,7 @@ const RepoHelper = {
return Store.openedFiles.find(openedFile => Store.activeFile.url === openedFile.url);
},
loadingError(e) {
loadingError() {
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