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

wiki_more_dropdown.vue « components « wikis « shared « pages « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 18b11d46bcaf75d3ee59540f7b0cca44c5e7de20 (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
55
56
57
58
<script>
import { GlDisclosureDropdown } from '@gitlab/ui';
import { s__, __ } from '~/locale';
import printMarkdownDom from '~/lib/print_markdown_dom';

export default {
  components: {
    GlDisclosureDropdown,
  },
  inject: ['print', 'history'],
  computed: {
    dropdownItems() {
      const items = [];

      if (this.history) {
        items.push({
          text: s__('Wiki|Page history'),
          href: this.history,
          extraAttrs: {
            'data-testid': 'page-history-button',
          },
        });
      }

      if (this.print) {
        items.push({
          text: __('Print as PDF'),
          action: this.printPage,
          extraAttrs: {
            'data-testid': 'page-print-button',
          },
        });
      }

      return items;
    },
  },
  methods: {
    printPage() {
      printMarkdownDom({
        target: document.querySelector(this.print.target),
        title: this.print.title,
        stylesheet: this.print.stylesheet,
      });
    },
  },
};
</script>
<template>
  <gl-disclosure-dropdown
    :items="dropdownItems"
    icon="ellipsis_v"
    category="tertiary"
    placement="right"
    no-caret
    data-testid="wiki-more-dropdown"
  />
</template>