summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/sidebar/components/lock/edit_form.vue
blob: bc32e974bc379b00b993f9a16b6b0ca6c5deb773 (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
<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,
      },

      toggleForm: {
        required: true,
        type: Function,
      },

      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 open">
    <div class="dropdown-menu sidebar-item-warning-message">
      <p
        class="text"
        v-if="isLocked"
        v-html="unlockWarning">
      </p>

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

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