gitlab-org--gitlab-foss/app/assets/javascripts/repo/repo_tab.js

29 lines
675 B
JavaScript
Raw Normal View History

2017-06-30 17:44:48 -04:00
import RepoHelper from './repo_helper'
let RepoTab = {
template: `
<li>
2017-07-02 18:17:53 -04:00
<a href='#' @click.prevent='xClicked(tab)' v-if='!tab.loading'>
<i class='fa fa-times' :class="{'fa-times':saved, 'dot-circle-o': !saved}"></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,
},
methods: {
tabClicked(file) {
RepoHelper.setActiveFile(file);
},
xClicked(file) {
RepoHelper.removeFromOpenedFiles(file);
}
}
};
export default RepoTab;