summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/notes/components/discussion_filter_note.vue
blob: 8dc4b43d69ab4af5294cc9fac119db0365d72421 (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
<script>
import { GlButton } from '@gitlab/ui';
import Icon from '~/vue_shared/components/icon.vue';
import { __, sprintf } from '~/locale';

import notesEventHub from '../event_hub';

export default {
  components: {
    GlButton,
    Icon,
  },
  computed: {
    timelineContent() {
      return sprintf(
        __(
          "You're only seeing %{startTag}other activity%{endTag} in the feed. To add a comment, switch to one of the following options.",
        ),
        {
          startTag: `<b>`,
          endTag: `</b>`,
        },
        false,
      );
    },
  },
  methods: {
    selectFilter(value) {
      notesEventHub.$emit('dropdownSelect', value);
    },
  },
};
</script>

<template>
  <li class="timeline-entry note note-wrapper discussion-filter-note js-discussion-filter-note">
    <div class="timeline-icon d-none d-lg-flex">
      <icon name="comment" />
    </div>
    <div class="timeline-content">
      <div ref="timelineContent" v-html="timelineContent"></div>
      <div class="discussion-filter-actions mt-2">
        <gl-button ref="showAllActivity" variant="default" @click="selectFilter(0)">
          {{ __('Show all activity') }}
        </gl-button>
        <gl-button ref="showComments" variant="default" @click="selectFilter(1)">
          {{ __('Show comments only') }}
        </gl-button>
      </div>
    </div>
  </li>
</template>