summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/boards/components/modal/tabs.js.es6
blob: 2730893df76dd5b7a19ca94cd05e5470f1b32782 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/* global Vue */
(() => {
  const ModalStore = gl.issueBoards.ModalStore;

  window.gl = window.gl || {};
  window.gl.issueBoards = window.gl.issueBoards || {};

  gl.issueBoards.ModalTabs = Vue.extend({
    data() {
      return ModalStore.globalStore;
    },
    methods: {
      changeTab(tab) {
        this.activeTab = tab;
      },
    },
    computed: {
      selectedCount() {
        return ModalStore.selectedCount();
      },
    },
    destroyed() {
      this.activeTab = 'all';
    },
    template: `
      <div class="top-area">
        <ul class="nav-links issues-state-filters">
          <li :class="{ 'active': activeTab == 'all' }">
            <a
              href="#"
              role="button"
              @click.prevent="changeTab('all')">
              <span>All issues</span>
              <span class="badge">
                {{ issues.length }}
              </span>
            </a>
          </li>
          <li :class="{ 'active': activeTab == 'selected' }">
            <a
              href="#"
              role="button"
              @click.prevent="changeTab('selected')">
              <span>Selected issues</span>
              <span class="badge">
                {{ selectedCount }}
              </span>
            </a>
          </li>
        </ul>
      </div>
    `,
  });
})();