Welcome to mirror list, hosted at ThFree Co, Russian Federation.

toggle_focus.js « boards « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 347deb818462f75dfe8b1792d4c354b814b8639b (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
import $ from 'jquery';
import Vue from 'vue';
import { GlIcon } from '@gitlab/ui';
import { hide } from '~/tooltips';

export default (ModalStore, boardsStore) => {
  const issueBoardsContent = document.querySelector('.content-wrapper > .js-focus-mode-board');

  return new Vue({
    el: document.getElementById('js-toggle-focus-btn'),
    components: {
      GlIcon,
    },
    data: {
      modal: ModalStore.store,
      store: boardsStore.state,
      isFullscreen: false,
    },
    methods: {
      toggleFocusMode() {
        const $el = $(this.$refs.toggleFocusModeButton);
        hide($el);

        issueBoardsContent.classList.toggle('is-focused');

        this.isFullscreen = !this.isFullscreen;
      },
    },
    template: `
      <div class="board-extra-actions">
        <a
          href="#"
          class="btn btn-default has-tooltip gl-ml-3 js-focus-mode-btn"
          data-qa-selector="focus_mode_button"
          role="button"
          aria-label="Toggle focus mode"
          title="Toggle focus mode"
          ref="toggleFocusModeButton"
          @click="toggleFocusMode">
          <gl-icon :name="isFullscreen ? 'minimize' : 'maximize'" />
        </a>
      </div>
    `,
  });
};