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
65
66
|
<script>
import { GlDropdown, GlDropdownSectionHeader, GlDropdownItem, GlDropdownDivider } from '@gitlab/ui';
import { s__ } from '~/locale';
const objectiveActionItems = [
{
title: s__('OKR|New objective'),
eventName: 'showCreateObjectiveForm',
},
{
title: s__('OKR|Existing objective'),
eventName: 'showAddObjectiveForm',
},
];
const keyResultActionItems = [
{
title: s__('OKR|New key result'),
eventName: 'showCreateKeyResultForm',
},
{
title: s__('OKR|Existing key result'),
eventName: 'showAddKeyResultForm',
},
];
export default {
keyResultActionItems,
objectiveActionItems,
components: {
GlDropdown,
GlDropdownSectionHeader,
GlDropdownItem,
GlDropdownDivider,
},
methods: {
change({ eventName }) {
this.$emit(eventName);
},
},
};
</script>
<template>
<gl-dropdown :text="__('Add')" size="small" right>
<gl-dropdown-section-header>{{ __('Objective') }}</gl-dropdown-section-header>
<gl-dropdown-item
v-for="item in $options.objectiveActionItems"
:key="item.eventName"
@click="change(item)"
>
{{ item.title }}
</gl-dropdown-item>
<gl-dropdown-divider />
<gl-dropdown-section-header>{{ __('Key result') }}</gl-dropdown-section-header>
<gl-dropdown-item
v-for="item in $options.keyResultActionItems"
:key="item.eventName"
@click="change(item)"
>
{{ item.title }}
</gl-dropdown-item>
</gl-dropdown>
</template>
|