Commit 33d15843 authored by Jacob Schatz's avatar Jacob Schatz Committed by Eric Eastwood

Use classObj as computed property for icons.

parent ac3a5767
...@@ -33,6 +33,15 @@ const RepoFile = { ...@@ -33,6 +33,15 @@ const RepoFile = {
canShowFile() { canShowFile() {
return !this.loading.tree || this.hasFiles; return !this.loading.tree || this.hasFiles;
}, },
fileIcon() {
let classObj = {
'fa-spinner' : this.file.loading,
'fa-spin' : this.file.loading,
[this.file.icon] : !this.file.loading,
};
return classObj;
}
}, },
methods: { methods: {
...@@ -48,8 +57,7 @@ export default RepoFile; ...@@ -48,8 +57,7 @@ export default RepoFile;
<template> <template>
<tr class="file" v-if="canShowFile" :class="{'active': activeFile.url === file.url}" @click.prevent="linkClicked(file)"> <tr class="file" v-if="canShowFile" :class="{'active': activeFile.url === file.url}" @click.prevent="linkClicked(file)">
<td> <td>
<i class="fa file-icon" v-if="!file.loading" :class="file.icon" :style="{'margin-left': file.level * 10 + 'px'}"></i> <i class="fa fa-fw" :class="fileIcon" :style="{'margin-left': file.level * 10 + 'px'}"></i>
<i class="fa fa-spinner fa-spin" v-if="file.loading" :style="{'margin-left': file.level * 10 + 'px'}"></i>
<a :href="file.url" class="repo-file-name" :title="file.url">{{file.name}}</a> <a :href="file.url" class="repo-file-name" :title="file.url">{{file.name}}</a>
</td> </td>
......
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