summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/boards/components/modal/lists_dropdown.js.es6
blob: 96f12da37530e7f6233f500b8d1c17df3d3a86a3 (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
/* global Vue */
(() => {
  const ModalStore = gl.issueBoards.ModalStore;

  gl.issueBoards.ModalFooterListsDropdown = Vue.extend({
    data() {
      return {
        modal: ModalStore.store,
        state: gl.issueBoards.BoardsStore.state,
      };
    },
    computed: {
      selected() {
        return this.modal.selectedList;
      },
    },
    template: `
      <div class="dropdown inline">
        <button
          class="dropdown-menu-toggle"
          type="button"
          data-toggle="dropdown"
          aria-expanded="false">
          <span
            class="dropdown-label-box"
            :style="{ backgroundColor: selected.label.color }">
          </span>
          {{ selected.title }}
          <i class="fa fa-chevron-down"></i>
        </button>
        <div class="dropdown-menu dropdown-menu-selectable dropdown-menu-drop-up">
          <ul>
            <li
              v-for="list in state.lists"
              v-if="list.type == 'label'">
              <a
                href="#"
                role="button"
                :class="{ 'is-active': list.id == selected.id }"
                @click.prevent="modal.selectedList = list">
                <span
                  class="dropdown-label-box"
                  :style="{ backgroundColor: list.label.color }">
                </span>
                {{ list.title }}
              </a>
            </li>
          </ul>
        </div>
      </div>
    `,
  });
})();