summaryrefslogtreecommitdiffstats
path: root/src/App.vue
blob: fd0db47d2586c65570eeb149e8c8b73f48df34f0 (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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
<template>
	<div id="content" class="app-vueexample">
		<div id="app-navigation">
			<app-navigation :menu="menu">
				<template slot="settings-content">Example settings</template>
			</app-navigation>
		</div>
		<div id="app-content">
			<div class="vueexample__container">
				<h3>Nextcloud app example with vue components</h3>
			</div>
		</div>
	</div>
</template>

<script>
	import {
		PopoverMenu,
		AppNavigation
	} from 'vue-components';

	export default {
		name: 'App',
		components: {
			PopoverMenu, AppNavigation
		},
		data: function () {
			return {
				isOpen: false,
				// example popover in the content
				menuPopover: [
					{
						icon: 'icon-delete',
						text: 'Delete item',
						action: () => {
							alert('Deleted!');
						}
					},
					{
						icon: 'icon-user',
						text: 'Nextcloud website',
						action: () => {},
						href: 'https://nextcloud.com'
					},
					{
						icon: 'icon-details',
						longtext: 'Add item',
						action: () => {
							alert('details');
						}
					}
				]
			};
		},
		computed: {
			// App navigation
			menu: function () {
				let defaultCategories = [
					{
						id: 'app-category-your-apps',
						classes: [],
						href: '#',
						icon: 'icon-category-installed',
						text: t('settings', 'Your apps'),
					},
					{
						caption: true,
						text: t('vueexample', 'Section'),
					},
					{
						id: 'app-category-enabled',
						classes: [],
						icon: 'icon-category-enabled',
						href: '#',
						utils: {
							actions: [{
								icon: 'icon-delete',
								text: t('settings', 'Remove group'),
								action: function () {
									console.log('remove')
								}
							}]
						},
						text: t('settings', 'Active apps'),
					},
					{
						id: 'app-category-enabled',
						classes: [],
						icon: 'icon-category-enabled',
						href: '#',
						utils: {
							counter: 123,
							actions: [
								{
									icon: 'icon-delete',
									text: t('settings', 'Remove group'),
									action: function () {
										console.log('remove')
									}
								},
								{
									icon: 'icon-delete',
									text: t('settings', 'Remove group'),
									action: function () {
										console.log('remove')
									}
								}
							]
						},
						text: t('settings', 'Active apps'),
					},
					{
						id: 'app-category-disabled',
						classes: [],
						icon: 'icon-category-disabled',
						href: '#',
						undo: true,
						text: t('settings', 'Disabled apps'),
					}
				];
				return {
					items: defaultCategories,
					loading: false
				}
			}
		}
	}
</script>