2017-07-20 11:20:48 -04:00
|
|
|
<script>
|
2017-08-06 10:53:59 -04:00
|
|
|
import Store from '../stores/repo_store';
|
2017-06-30 17:44:48 -04:00
|
|
|
|
2017-07-14 21:54:51 -04:00
|
|
|
const RepoTab = {
|
2017-06-30 17:44:48 -04:00
|
|
|
props: {
|
2017-07-20 11:37:52 -04:00
|
|
|
tab: {
|
|
|
|
type: Object,
|
|
|
|
required: true,
|
|
|
|
},
|
2017-06-30 17:44:48 -04:00
|
|
|
},
|
|
|
|
|
2017-07-17 09:15:35 -04:00
|
|
|
computed: {
|
|
|
|
changedClass() {
|
|
|
|
const tabChangedObj = {
|
|
|
|
'fa-times': !this.tab.changed,
|
2017-07-17 09:44:19 -04:00
|
|
|
'fa-circle': this.tab.changed,
|
2017-07-17 09:15:35 -04:00
|
|
|
};
|
2017-07-17 09:44:19 -04:00
|
|
|
return tabChangedObj;
|
|
|
|
},
|
2017-07-17 09:15:35 -04:00
|
|
|
},
|
|
|
|
|
2017-06-30 17:44:48 -04:00
|
|
|
methods: {
|
2017-08-06 10:53:59 -04:00
|
|
|
tabClicked: Store.setActiveFiles,
|
2017-06-30 17:44:48 -04:00
|
|
|
|
|
|
|
xClicked(file) {
|
2017-07-17 09:44:19 -04:00
|
|
|
if (file.changed) return;
|
2017-07-30 13:34:53 -04:00
|
|
|
this.$emit('xclicked', file);
|
2017-07-14 21:54:51 -04:00
|
|
|
},
|
|
|
|
},
|
2017-06-30 17:44:48 -04:00
|
|
|
};
|
2017-07-20 11:20:48 -04:00
|
|
|
|
2017-07-14 21:54:51 -04:00
|
|
|
export default RepoTab;
|
2017-07-20 11:20:48 -04:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<li>
|
2017-07-21 14:40:42 -04:00
|
|
|
<a href="#" class="close" @click.prevent="xClicked(tab)" v-if="!tab.loading">
|
2017-07-20 11:20:48 -04:00
|
|
|
<i class="fa" :class="changedClass"></i>
|
|
|
|
</a>
|
|
|
|
|
2017-07-23 12:11:06 -04:00
|
|
|
<a href="#" class="repo-tab" v-if="!tab.loading" :title="tab.url" @click.prevent="tabClicked(tab)">{{tab.name}}</a>
|
2017-07-20 11:20:48 -04:00
|
|
|
|
|
|
|
<i v-if="tab.loading" class="fa fa-spinner fa-spin"></i>
|
|
|
|
</li>
|
|
|
|
</template>
|