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

editor_mode_dropdown.vue « components « ide « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: dec8aa61838b402ae7591e53990e30301429f219 (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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<script>
import { GlButton } from '@gitlab/ui';
import { __, sprintf } from '~/locale';
import { viewerTypes } from '../constants';

export default {
  components: {
    GlButton,
  },
  props: {
    viewer: {
      type: String,
      required: true,
    },
    mergeRequestId: {
      type: Number,
      required: true,
    },
  },
  computed: {
    mergeReviewLine() {
      return sprintf(__('Reviewing (merge request !%{mergeRequestId})'), {
        mergeRequestId: this.mergeRequestId,
      });
    },
  },
  methods: {
    changeMode(mode) {
      this.$emit('click', mode);
    },
  },
  viewerTypes,
};
</script>

<template>
  <div class="dropdown">
    <gl-button variant="link" data-toggle="dropdown">{{ __('Edit') }}</gl-button>
    <div class="dropdown-menu dropdown-menu-selectable dropdown-open-left">
      <ul>
        <li>
          <a
            :class="{
              'is-active': viewer === $options.viewerTypes.mr,
            }"
            href="#"
            @click.prevent="changeMode($options.viewerTypes.mr)"
          >
            <strong class="dropdown-menu-inner-title"> {{ mergeReviewLine }} </strong>
            <span class="dropdown-menu-inner-content">
              {{ __('Compare changes with the merge request target branch') }}
            </span>
          </a>
        </li>
        <li>
          <a
            :class="{
              'is-active': viewer === $options.viewerTypes.diff,
            }"
            href="#"
            @click.prevent="changeMode($options.viewerTypes.diff)"
          >
            <strong class="dropdown-menu-inner-title">{{ __('Reviewing') }}</strong>
            <span class="dropdown-menu-inner-content">
              {{ __('Compare changes with the last commit') }}
            </span>
          </a>
        </li>
      </ul>
    </div>
  </div>
</template>