2017-07-14 21:54:51 -04:00
|
|
|
import RepoHelper from './repo_helper';
|
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
|
|
|
template: `
|
|
|
|
<li>
|
2017-07-02 18:17:53 -04:00
|
|
|
<a href='#' @click.prevent='xClicked(tab)' v-if='!tab.loading'>
|
2017-07-17 09:15:35 -04:00
|
|
|
<i class='fa' :class="changedClass"></i>
|
2017-06-30 17:44:48 -04:00
|
|
|
</a>
|
2017-07-02 18:17:53 -04:00
|
|
|
<a href='#' v-if='!tab.loading' :title='tab.url' @click.prevent='tabClicked(tab)'>{{tab.name}}</a>
|
|
|
|
<i v-if='tab.loading' class='fa fa-spinner fa-spin'></i>
|
2017-06-30 17:44:48 -04:00
|
|
|
</li>
|
|
|
|
`,
|
|
|
|
props: {
|
|
|
|
name: 'repo-tab',
|
|
|
|
tab: Object,
|
|
|
|
saved: true,
|
|
|
|
},
|
|
|
|
|
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: {
|
|
|
|
tabClicked(file) {
|
|
|
|
RepoHelper.setActiveFile(file);
|
|
|
|
},
|
|
|
|
|
|
|
|
xClicked(file) {
|
2017-07-17 09:44:19 -04:00
|
|
|
if (file.changed) return;
|
2017-06-30 17:44:48 -04:00
|
|
|
RepoHelper.removeFromOpenedFiles(file);
|
2017-07-14 21:54:51 -04:00
|
|
|
},
|
|
|
|
},
|
2017-06-30 17:44:48 -04:00
|
|
|
};
|
2017-07-14 21:54:51 -04:00
|
|
|
export default RepoTab;
|