summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/sidebar/components/lock/edit_form.vue
blob: 4906dad22e1f4829d0c6408c8fd1171b813d558c (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
<script>
import editFormButtons from './edit_form_buttons.vue';
import issuableMixin from '../../../vue_shared/mixins/issuable';
import { __, sprintf } from '../../../locale';

export default {
  components: {
    editFormButtons,
  },
  mixins: [issuableMixin],
  props: {
    isLocked: {
      required: true,
      type: Boolean,
    },

    updateLockedAttribute: {
      required: true,
      type: Function,
    },
  },
  computed: {
    lockWarning() {
      return sprintf(
        __(
          'Lock this %{issuableDisplayName}? Only <strong>project members</strong> will be able to comment.',
        ),
        { issuableDisplayName: this.issuableDisplayName },
      );
    },
    unlockWarning() {
      return sprintf(
        __(
          'Unlock this %{issuableDisplayName}? <strong>Everyone</strong> will be able to comment.',
        ),
        { issuableDisplayName: this.issuableDisplayName },
      );
    },
  },
};
</script>

<template>
  <div class="dropdown show">
    <div class="dropdown-menu sidebar-item-warning-message">
      <p
        v-if="isLocked"
        class="text"
        v-html="unlockWarning">
      </p>

      <p
        v-else
        class="text"
        v-html="lockWarning">
      </p>

      <edit-form-buttons
        :is-locked="isLocked"
        :update-locked-attribute="updateLockedAttribute"
      />
    </div>
  </div>
</template>