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
|
<script>
import { GlButton, GlTooltipDirective } from '@gitlab/ui';
import { s__ } from '~/locale';
import { BV_HIDE_TOOLTIP } from '~/lib/utils/constants';
import AbuseCategorySelector from '~/abuse_reports/components/abuse_category_selector.vue';
export default {
name: 'ReportAbuseButton',
components: {
GlButton,
AbuseCategorySelector,
},
directives: {
GlTooltip: GlTooltipDirective,
},
inject: ['reportedUserId', 'reportedFromUrl'],
i18n: {
reportAbuse: s__('ReportAbuse|Report abuse to administrator'),
},
data() {
return {
open: false,
};
},
computed: {
buttonTooltipText() {
return this.$options.i18n.reportAbuse;
},
},
methods: {
toggleDrawer(open) {
this.open = open;
},
hideTooltips() {
this.$root.$emit(BV_HIDE_TOOLTIP);
},
},
};
</script>
<template>
<span>
<gl-button
v-gl-tooltip="buttonTooltipText"
category="primary"
:aria-label="buttonTooltipText"
icon="error"
@click="toggleDrawer(true)"
@mouseout="hideTooltips"
/>
<abuse-category-selector
:reported-user-id="reportedUserId"
:reported-from-url="reportedFromUrl"
:show-drawer="open"
@close-drawer="toggleDrawer(false)"
/>
</span>
</template>
|