discussion_filter_note.vue 1.3 KB
Newer Older
1
<script>
2
/* eslint-disable vue/no-v-html */
3
import { GlButton, GlIcon } from '@gitlab/ui';
4 5 6 7 8 9
import { __, sprintf } from '~/locale';

import notesEventHub from '../event_hub';

export default {
  components: {
10
    GlButton,
11
    GlIcon,
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
  },
  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">
37
    <div class="timeline-icon d-none d-lg-flex">
38
      <gl-icon name="comment" />
39 40
    </div>
    <div class="timeline-content">
41
      <div ref="timelineContent" v-html="timelineContent"></div>
42
      <div class="discussion-filter-actions mt-2">
43
        <gl-button ref="showAllActivity" variant="default" @click="selectFilter(0)">
44
          {{ __('Show all activity') }}
45 46
        </gl-button>
        <gl-button ref="showComments" variant="default" @click="selectFilter(1)">
47
          {{ __('Show comments only') }}
48
        </gl-button>
49 50 51 52
      </div>
    </div>
  </li>
</template>