@mapomodule/uikit 1.0.0-alpha.10 → 1.0.0-alpha.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +67 -0
- package/components/Detail/Detail.vue +63 -21
- package/components/Detail/DetailField.vue +17 -3
- package/components/Detail/defaults.js +1 -1
- package/components/MediaManager/MediaManager.vue +7 -6
- package/components/fields/FileField.vue +108 -0
- package/components/fields/FksField.vue +25 -5
- package/components/fields/MediaField.vue +9 -0
- package/components/fields/wygEditor/defaults.js +6 -4
- package/components/fields/wygEditor/utils/mapomedia.plugin.js +7 -6
- package/components/fields/wygEditor/wygEditor.vue +3 -0
- package/components/layout/Sidebar/Sidebar.vue +13 -32
- package/components/layout/Sidebar/SidebarFooter.vue +1 -1
- package/components/layout/Sidebar/SidebarListItem.vue +19 -1
- package/components/layout/Sidebar/SidebarProfile.vue +42 -0
- package/components/layout/routebuilder.js +2 -2
- package/defaults.js +2 -2
- package/layouts/default.vue +19 -7
- package/layouts/empty.vue +10 -0
- package/package.json +3 -3
- package/layouts/error.vue +0 -45
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,73 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [1.0.0-alpha.13](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.12...v1.0.0-alpha.13) (2022-03-01)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* added missing error messages to media field ([1489001](https://github.com/lotrekagency/mapo/commit/148900133c1671acc5a47fe994b41db07013ab2a))
|
|
12
|
+
* clean default layout ([b32e5db](https://github.com/lotrekagency/mapo/commit/b32e5db6876420a3b53bb9da4cf13c7e53fb279f))
|
|
13
|
+
* fix back button in detail page when you came from login or when you have no window history ([7881004](https://github.com/lotrekagency/mapo/commit/78810046d91d02fcfa845bcc7fce95cb011a21ae))
|
|
14
|
+
* fix detail language load ([92a2718](https://github.com/lotrekagency/mapo/commit/92a271878b9f1f2585c3dcc18749adc7c7683ae1))
|
|
15
|
+
* fix error page style ([d8753a1](https://github.com/lotrekagency/mapo/commit/d8753a1ae0a2c857cd4a5417694c17bcf9a5bb9d))
|
|
16
|
+
* fix menu route building for nested folders ([1d15b17](https://github.com/lotrekagency/mapo/commit/1d15b17e3cbb75aa92e301429f667e119ecb9334))
|
|
17
|
+
* fix sidebar menu styling for nested long menus ([ba87f59](https://github.com/lotrekagency/mapo/commit/ba87f5912db02f86c857d237b5408094b63ed164))
|
|
18
|
+
* handle media manager requests errors. ([809704b](https://github.com/lotrekagency/mapo/commit/809704b7822b7991423e108bf1b8e398c19157e9))
|
|
19
|
+
* **detail:** set current lang at mount time ([46c98a7](https://github.com/lotrekagency/mapo/commit/46c98a76a2a787e752b7fea7e2442b719338aa6f))
|
|
20
|
+
* remove logout from sidebar if no user logged in ([e9d562b](https://github.com/lotrekagency/mapo/commit/e9d562b9f6f71a01f8235caa26c24a8f6d5c0f5d))
|
|
21
|
+
* remove remaining toc plugin configuration from tinymce ([9defb47](https://github.com/lotrekagency/mapo/commit/9defb47c5da6e8b7fa87ee39943f9a66d48ca538))
|
|
22
|
+
* remove toc and imagetools plugin from tinymce ([e1d12cf](https://github.com/lotrekagency/mapo/commit/e1d12cf72cf6aa488ed4135788fecd1ffa99da43))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Features
|
|
26
|
+
|
|
27
|
+
* accept axios configuration in endpoint prop of FksField ([9dfca0b](https://github.com/lotrekagency/mapo/commit/9dfca0b5d2a488c0fdab5e8411454e7f0efe5904))
|
|
28
|
+
* added loading page before content retrieve in detail page ([4f26c03](https://github.com/lotrekagency/mapo/commit/4f26c037ab095f931a3ff430b07451de9bef504f))
|
|
29
|
+
* added login button to profile component if no user logged in ([354a25a](https://github.com/lotrekagency/mapo/commit/354a25a32164dc1d284cbe4542c65e04379b1c75))
|
|
30
|
+
* detached SidebarProfile from sidebar component ([92c2894](https://github.com/lotrekagency/mapo/commit/92c28941e6069bbc4e15775ea380c453c7267420))
|
|
31
|
+
* make all modals draggable 🛸 ([57da10d](https://github.com/lotrekagency/mapo/commit/57da10d17aa31d58e55fda5385d45d43beed8c4f))
|
|
32
|
+
* pass errors to slot bindings inDetail component ([9303b39](https://github.com/lotrekagency/mapo/commit/9303b39be40810e526ad5f89428812cd3e7b349d))
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
# [1.0.0-alpha.12](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.11...v1.0.0-alpha.12) (2022-02-16)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
### Bug Fixes
|
|
42
|
+
|
|
43
|
+
* **detail:** load v-model at mount time ([ad37268](https://github.com/lotrekagency/mapo/commit/ad3726832db1c7ae9e32c95fdeaf6d55b95224f0))
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
### Features
|
|
47
|
+
|
|
48
|
+
* added mapomedia to context menu and menubar replacing default image tool ([bb899d8](https://github.com/lotrekagency/mapo/commit/bb899d80c2f5835f1fb98fa9a0b3e3092b82951f))
|
|
49
|
+
* changed default primary color ([37c3599](https://github.com/lotrekagency/mapo/commit/37c35995cdf033a5bcbf0a0acf71e9efadf69995))
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
# [1.0.0-alpha.11](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.10...v1.0.0-alpha.11) (2022-02-12)
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
### Bug Fixes
|
|
59
|
+
|
|
60
|
+
* add lower lever errors for nested fields ([beea774](https://github.com/lotrekagency/mapo/commit/beea774e977020e4728a5c7d06b038684cb89000))
|
|
61
|
+
* fix filefield clear button ([297b8de](https://github.com/lotrekagency/mapo/commit/297b8ded8070223ef59263c7fa136843f40442af))
|
|
62
|
+
* replace model with response in detail composnent ([77d9565](https://github.com/lotrekagency/mapo/commit/77d95658332acf6f14f33921768d512dc0037c3d))
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
### Features
|
|
66
|
+
|
|
67
|
+
* added brand new FileField ([6928b86](https://github.com/lotrekagency/mapo/commit/6928b86aadb24503b39722d17878660b1f053c3d))
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
6
73
|
# [1.0.0-alpha.10](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.9...v1.0.0-alpha.10) (2022-02-11)
|
|
7
74
|
|
|
8
75
|
|
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div>
|
|
3
|
+
<div v-show="loading">
|
|
4
|
+
<v-progress-linear
|
|
5
|
+
color="primary"
|
|
6
|
+
indeterminate
|
|
7
|
+
absolute
|
|
8
|
+
style="top: 0;"
|
|
9
|
+
></v-progress-linear>
|
|
10
|
+
<span class="detail-component-loading ">
|
|
11
|
+
<v-icon size="30">mdi-timer-sand</v-icon>
|
|
12
|
+
Fetching data..
|
|
13
|
+
</span>
|
|
14
|
+
</div>
|
|
15
|
+
<div v-show="!loading">
|
|
3
16
|
<!-- Use this to override the title of the detail component. -->
|
|
4
17
|
<slot name="title" v-bind="slotBindings">
|
|
5
18
|
<!-- `<h1> "Create | Edit" + modelName </h1>` -->
|
|
@@ -93,7 +106,7 @@
|
|
|
93
106
|
<!-- Use this to override the Save button. -->
|
|
94
107
|
<slot name="button.save" v-bind="slotBindings">
|
|
95
108
|
<!-- The Save button. -->
|
|
96
|
-
<v-btn :disabled="isReadonly" class="mb-2" tile block @click="saveItem(true)">{{
|
|
109
|
+
<v-btn v-show="canGoBack" :disabled="isReadonly" class="mb-2" tile block @click="saveItem(true)">{{
|
|
97
110
|
isNew ? "Create" : "Save"
|
|
98
111
|
}}</v-btn>
|
|
99
112
|
</slot>
|
|
@@ -107,7 +120,7 @@
|
|
|
107
120
|
<!-- Use this to override the Back button. -->
|
|
108
121
|
<slot name="button.back" v-bind="slotBindings">
|
|
109
122
|
<!-- The Back button. -->
|
|
110
|
-
<v-btn class="mb-2" tile block @click="
|
|
123
|
+
<v-btn v-show="canGoBack" class="mb-2" tile block @click="back"
|
|
111
124
|
>Back</v-btn
|
|
112
125
|
>
|
|
113
126
|
</slot>
|
|
@@ -186,8 +199,21 @@
|
|
|
186
199
|
</v-row>
|
|
187
200
|
</v-form>
|
|
188
201
|
</div>
|
|
202
|
+
</div>
|
|
189
203
|
</template>
|
|
190
204
|
|
|
205
|
+
<style lang="scss" scoped>
|
|
206
|
+
.detail-component-loading {
|
|
207
|
+
position: absolute;
|
|
208
|
+
top: 50%;
|
|
209
|
+
transform: translateY(-50%);
|
|
210
|
+
width: 100%;
|
|
211
|
+
display: flex;
|
|
212
|
+
flex-direction: column;
|
|
213
|
+
justify-content: center;
|
|
214
|
+
align-items: center;
|
|
215
|
+
}
|
|
216
|
+
</style>
|
|
191
217
|
|
|
192
218
|
<script>
|
|
193
219
|
/**
|
|
@@ -199,7 +225,8 @@ export default {
|
|
|
199
225
|
data() {
|
|
200
226
|
return {
|
|
201
227
|
model: {},
|
|
202
|
-
|
|
228
|
+
modelLanguages: [],
|
|
229
|
+
currentLang: this.lang,
|
|
203
230
|
errors: null
|
|
204
231
|
};
|
|
205
232
|
},
|
|
@@ -254,12 +281,15 @@ export default {
|
|
|
254
281
|
},
|
|
255
282
|
},
|
|
256
283
|
methods: {
|
|
284
|
+
back() {
|
|
285
|
+
this.$nuxt.context?.from?.name == "login" ? this.$router.go(-3) : this.$router.back()
|
|
286
|
+
},
|
|
257
287
|
saveItem(back = false) {
|
|
258
288
|
this.errors = null;
|
|
259
289
|
this.$refs.form?.resetValidation();
|
|
260
290
|
this.crud
|
|
261
291
|
.updateOrCreate(this.model, {}, { multipart: this.multipart })
|
|
262
|
-
.then(() => back
|
|
292
|
+
.then((resp) => { back ? this.back() : this.model = resp })
|
|
263
293
|
.catch(error => {
|
|
264
294
|
this.errors =
|
|
265
295
|
(error.response.status == 400 && error.response.data) || null;
|
|
@@ -280,7 +310,7 @@ export default {
|
|
|
280
310
|
if (res) {
|
|
281
311
|
this.crud
|
|
282
312
|
.delete(this.identifier)
|
|
283
|
-
.then(() => this
|
|
313
|
+
.then(() => this.back())
|
|
284
314
|
.catch(error =>
|
|
285
315
|
this.$mapo.$snack.open({
|
|
286
316
|
message: error.response?.data?.detail || "Something whent bad, please try again later...",
|
|
@@ -349,7 +379,13 @@ export default {
|
|
|
349
379
|
}
|
|
350
380
|
}
|
|
351
381
|
},
|
|
352
|
-
|
|
382
|
+
computed: {
|
|
383
|
+
canGoBack() {
|
|
384
|
+
if (process.browser) {
|
|
385
|
+
return this.$nuxt.context?.from?.name !== "login" && window.history.length > 1 || window.history.length > 3
|
|
386
|
+
}
|
|
387
|
+
return true;
|
|
388
|
+
},
|
|
353
389
|
crud() {
|
|
354
390
|
return this.$mapo.$api.crud(this.endpoint);
|
|
355
391
|
},
|
|
@@ -385,13 +421,12 @@ export default {
|
|
|
385
421
|
return !Object.keys(this.model).length;
|
|
386
422
|
},
|
|
387
423
|
langs() {
|
|
388
|
-
return
|
|
389
|
-
this.model?.lang_info?.site_languages.map(l => l.id) || this.languages
|
|
390
|
-
);
|
|
424
|
+
return this.modelLanguages || this.languages;
|
|
391
425
|
},
|
|
392
426
|
slotBindings() {
|
|
393
427
|
return {
|
|
394
428
|
model: this.model,
|
|
429
|
+
errors: this.errors,
|
|
395
430
|
currentLang: this.currentLang,
|
|
396
431
|
crud: this.crud,
|
|
397
432
|
isNew: this.isNew,
|
|
@@ -415,8 +450,15 @@ export default {
|
|
|
415
450
|
if (this.identifier && this.identifier !== "new") {
|
|
416
451
|
this.crud.detail(this.identifier).then(res => {
|
|
417
452
|
this.model = res;
|
|
453
|
+
this.modelLanguages = this.model?.lang_info?.site_languages.map(l => l.id)
|
|
418
454
|
this.initLang();
|
|
455
|
+
}).catch(error => {
|
|
456
|
+
this.$nuxt.error({ statusCode: error.response.status, message: error.response.data?.detail || "Ops some error occurred.." })
|
|
419
457
|
});
|
|
458
|
+
} else if (this.value) {
|
|
459
|
+
this.model = this.value;
|
|
460
|
+
this.modelLanguages = this.model?.lang_info?.site_languages.map(l => l.id)
|
|
461
|
+
this.initLang();
|
|
420
462
|
}
|
|
421
463
|
}
|
|
422
464
|
};
|
|
@@ -426,7 +468,7 @@ export default {
|
|
|
426
468
|
|
|
427
469
|
## DetailConfiguration
|
|
428
470
|
|
|
429
|
-
The DetailConfiguration determines the behavior of the main form and is an `Array` of [`FieldConfiguration`](#fieldconfiguration).
|
|
471
|
+
The DetailConfiguration determines the behavior of the main form and is an `Array` of [`FieldConfiguration`](#fieldconfiguration).
|
|
430
472
|
Each field configuration represents a field of the form.
|
|
431
473
|
The configuration can also consist of an object with two keys `{ main sidenav }`.
|
|
432
474
|
Each key is an `Array` of [`FieldConfiguration`](#fieldconfiguration) and will modify a different part of the component:
|
|
@@ -436,7 +478,7 @@ Each key is an `Array` of [`FieldConfiguration`](#fieldconfiguration) and will m
|
|
|
436
478
|
|
|
437
479
|
### FieldConfiguration
|
|
438
480
|
|
|
439
|
-
The `FieldConfiguration` is a `String` containing the dottedPath of a value inside the payload we want to modify.
|
|
481
|
+
The `FieldConfiguration` is a `String` containing the dottedPath of a value inside the payload we want to modify.
|
|
440
482
|
So, for example, if we have the payload: `{ image: { name: "...", url: "..." } }` we can modify the image name using the dottedPath `"image.name"`.
|
|
441
483
|
|
|
442
484
|
The default component used to render a field of a form is a [`v-text-field`](https://vuetifyjs.com/en/components/text-fields/).
|
|
@@ -444,12 +486,12 @@ If you want more control over the generated component you can use an `Object` wi
|
|
|
444
486
|
|
|
445
487
|
|Name|Description|Type|Required|Default|
|
|
446
488
|
|---|---|---|---|---|
|
|
447
|
-
|value|The dottedPath of the value we want to modify.|`String`|`true`|-|
|
|
448
|
-
|synci18n|Determines if the field is translatable or not. If set to true the value will remain the same in all translations (untranslatable).|`Boolean`|`false`|`false`|
|
|
449
|
-
|type|Type of the field. This determines which component will be rendered. The list of possible choices can be found [here](#field-types) |`String`|`false`|`text`|
|
|
450
|
-
|accessor|[`Accessor`](#accessor) object to specify the setter and the getter of the field.|`Object`|`false`|`{set: x=>x, get: x=>x}`|
|
|
451
|
-
|attrs|The attributes that will be passed to the component.|`Object`|`false`|-|
|
|
452
|
-
|is|The component to be rendered in the form. This has a higher priority than the "type" attribute. Here you can pass in any regitered Vue component instance or name. [Learn more](https://vuejs.org/v2/guide/components.html#Dynamic-Components).|`String | VueComponent`|`false`|-|
|
|
489
|
+
|value|The dottedPath of the value we want to modify.|`String`|`true`|-|
|
|
490
|
+
|synci18n|Determines if the field is translatable or not. If set to true the value will remain the same in all translations (untranslatable).|`Boolean`|`false`|`false`|
|
|
491
|
+
|type|Type of the field. This determines which component will be rendered. The list of possible choices can be found [here](#field-types) |`String`|`false`|`text`|
|
|
492
|
+
|accessor|[`Accessor`](#accessor) object to specify the setter and the getter of the field.|`Object`|`false`|`{set: x=>x, get: x=>x}`|
|
|
493
|
+
|attrs|The attributes that will be passed to the component.|`Object`|`false`|-|
|
|
494
|
+
|is|The component to be rendered in the form. This has a higher priority than the "type" attribute. Here you can pass in any regitered Vue component instance or name. [Learn more](https://vuejs.org/v2/guide/components.html#Dynamic-Components).|`String | VueComponent`|`false`|-|
|
|
453
495
|
|
|
454
496
|
#### Accessor
|
|
455
497
|
|
|
@@ -459,7 +501,7 @@ Each function must return the processed value.
|
|
|
459
501
|
|
|
460
502
|
#### Field types
|
|
461
503
|
|
|
462
|
-
Here the list of the FieldConfiguration type association.
|
|
504
|
+
Here the list of the FieldConfiguration type association.
|
|
463
505
|
|
|
464
506
|
- `text` ==> [v-text-field](https://vuetifyjs.com/en/components/text-fields/),
|
|
465
507
|
- `select` ==> [v-select](https://vuetifyjs.com/en/components/selects/),
|
|
@@ -490,8 +532,8 @@ Here the list of the FieldConfiguration type association.
|
|
|
490
532
|
|
|
491
533
|
### FieldGroup
|
|
492
534
|
|
|
493
|
-
You can use this mixed with `FieldConfiguration` to group multiple fields in one card with a title and an icon.
|
|
494
|
-
The `FieldGroup` has the key group that is a string repreenting the name of the group and the key fields that is an `Array` of [`FieldConfiguration`](#fieldconfiguration).
|
|
535
|
+
You can use this mixed with `FieldConfiguration` to group multiple fields in one card with a title and an icon.
|
|
536
|
+
The `FieldGroup` has the key group that is a string repreenting the name of the group and the key fields that is an `Array` of [`FieldConfiguration`](#fieldconfiguration).
|
|
495
537
|
The group key can also be an `Object`. In that case it contains the name and the icon for the group `{name: "...", icon: "..."}`. For a list of all available icons, visit the official [Material Design Icons](https://materialdesignicons.com/) page.
|
|
496
538
|
|
|
497
539
|
<br><br>
|
|
@@ -572,4 +614,4 @@ export default {
|
|
|
572
614
|
|
|
573
615
|
|
|
574
616
|
|
|
575
|
-
</docs>
|
|
617
|
+
</docs>
|
|
@@ -18,7 +18,7 @@ import FksField from "@mapomodule/uikit/components/fields/FksField.vue";
|
|
|
18
18
|
import MediaM2mField from "@mapomodule/uikit/components/fields/MediaM2mField.vue";
|
|
19
19
|
import MediaField from "@mapomodule/uikit/components/fields/MediaField.vue";
|
|
20
20
|
import SeoPreview from "@mapomodule/uikit/components/fields/SeoPreview.vue";
|
|
21
|
-
|
|
21
|
+
import FileField from "@mapomodule/uikit/components/fields/FileField.vue";
|
|
22
22
|
|
|
23
23
|
import { getPointed, setPointed } from "@mapomodule/utils/helpers/objHelpers";
|
|
24
24
|
import defaults from "./defaults";
|
|
@@ -35,6 +35,7 @@ export default {
|
|
|
35
35
|
MediaM2mField,
|
|
36
36
|
MediaField,
|
|
37
37
|
SeoPreview,
|
|
38
|
+
FileField,
|
|
38
39
|
},
|
|
39
40
|
|
|
40
41
|
data() {
|
|
@@ -109,9 +110,22 @@ export default {
|
|
|
109
110
|
fieldAttrs() {
|
|
110
111
|
return {
|
|
111
112
|
label: this.label,
|
|
112
|
-
errorMessages:
|
|
113
|
+
errorMessages: this.conf.value
|
|
114
|
+
.split(".")
|
|
115
|
+
.map((_, i, a) => a.slice(0, i + 1).join("."))
|
|
116
|
+
.reduce((acc, next) => {
|
|
117
|
+
const error = getPointed(this.errors || {}, next, []);
|
|
118
|
+
if (Array.isArray(error)) {
|
|
119
|
+
acc = [...acc, ...error];
|
|
120
|
+
} else if (typeof error == "string") {
|
|
121
|
+
acc = [...acc, error];
|
|
122
|
+
}
|
|
123
|
+
return acc;
|
|
124
|
+
}, []),
|
|
113
125
|
...this.defaultAttrs.All,
|
|
114
|
-
...(this.defaultAttrs[
|
|
126
|
+
...(this.defaultAttrs[
|
|
127
|
+
this.is.replace(/-./g, (x) => x[1].toUpperCase())
|
|
128
|
+
] || {}),
|
|
115
129
|
...this.conf.attrs,
|
|
116
130
|
};
|
|
117
131
|
},
|
|
@@ -160,13 +160,14 @@ export default {
|
|
|
160
160
|
search: this.searchValue || undefined,
|
|
161
161
|
fltr: this.mime ? `mime_type=${this.mime}` : undefined,
|
|
162
162
|
};
|
|
163
|
-
|
|
164
|
-
response =
|
|
165
|
-
params
|
|
166
|
-
|
|
167
|
-
}
|
|
168
|
-
|
|
163
|
+
try {
|
|
164
|
+
response = id
|
|
165
|
+
? await this.mediaFolderCrud.detail(id, { params })
|
|
166
|
+
: await this.mediaFolderCrud.list({ params });
|
|
167
|
+
} catch (error) {
|
|
168
|
+
console.error({ code: error.response.status, response: error.response.data})
|
|
169
169
|
}
|
|
170
|
+
|
|
170
171
|
this.processResponse(response);
|
|
171
172
|
this.loading = false;
|
|
172
173
|
this.editMedia = null;
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="filefield-wrapper">
|
|
3
|
+
<v-file-input
|
|
4
|
+
v-bind="$attrs"
|
|
5
|
+
:messages="messages"
|
|
6
|
+
:value="model"
|
|
7
|
+
@change="modelSet"
|
|
8
|
+
>
|
|
9
|
+
<template v-slot:message="{ message }">
|
|
10
|
+
<span
|
|
11
|
+
v-if="message == fileUrl"
|
|
12
|
+
v-show="message"
|
|
13
|
+
class="filefield-current"
|
|
14
|
+
><b class="mr-1">Current:</b>
|
|
15
|
+
<a :href="message" target="__blank">{{ message }}</a>
|
|
16
|
+
<v-spacer></v-spacer>
|
|
17
|
+
<v-icon @click="clear" class="mb-1" small>mdi-close</v-icon>
|
|
18
|
+
</span>
|
|
19
|
+
<span v-else>
|
|
20
|
+
{{ message }}
|
|
21
|
+
</span>
|
|
22
|
+
</template>
|
|
23
|
+
</v-file-input>
|
|
24
|
+
</div>
|
|
25
|
+
</template>
|
|
26
|
+
|
|
27
|
+
<style lang="scss" scoped>
|
|
28
|
+
.filefield-current {
|
|
29
|
+
max-width: 100%;
|
|
30
|
+
white-space: nowrap;
|
|
31
|
+
display: flex;
|
|
32
|
+
a {
|
|
33
|
+
overflow: hidden;
|
|
34
|
+
text-overflow: ellipsis;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
</style>
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
<script>
|
|
41
|
+
/**
|
|
42
|
+
* This component is made to simplify Many To Many associations. With this component you can modify an array selecting items from a list of checkboxes.
|
|
43
|
+
*/
|
|
44
|
+
|
|
45
|
+
export default {
|
|
46
|
+
name: "FileField",
|
|
47
|
+
data() {
|
|
48
|
+
return {
|
|
49
|
+
file: null,
|
|
50
|
+
fileUrl: null,
|
|
51
|
+
};
|
|
52
|
+
},
|
|
53
|
+
props: {
|
|
54
|
+
// V-model property. It is the file.
|
|
55
|
+
value: {
|
|
56
|
+
type: Object | Array | null,
|
|
57
|
+
required: true,
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
computed: {
|
|
61
|
+
isString() {
|
|
62
|
+
return typeof this.model == "string";
|
|
63
|
+
},
|
|
64
|
+
model: {
|
|
65
|
+
get() {
|
|
66
|
+
return this.file;
|
|
67
|
+
},
|
|
68
|
+
set(val) {
|
|
69
|
+
if (!val || typeof val == "string") this.fileUrl = val;
|
|
70
|
+
if (!val || val instanceof File) this.file = val;
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
messages() {
|
|
74
|
+
const messages =
|
|
75
|
+
typeof this.$attrs.messages == "string"
|
|
76
|
+
? [this.$attrs.messages]
|
|
77
|
+
: this.$attrs.messages || [];
|
|
78
|
+
this.fileUrl &&
|
|
79
|
+
!messages.includes(this.fileUrl) &&
|
|
80
|
+
messages.push(this.fileUrl);
|
|
81
|
+
return messages;
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
watch: {
|
|
85
|
+
value(val) {
|
|
86
|
+
this.model = val;
|
|
87
|
+
},
|
|
88
|
+
model(val) {
|
|
89
|
+
this.$emit("input", val);
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
methods: {
|
|
93
|
+
clear() {
|
|
94
|
+
this.fileUrl = null;
|
|
95
|
+
this.file = null;
|
|
96
|
+
this.model = null;
|
|
97
|
+
this.$emit("input", null);
|
|
98
|
+
},
|
|
99
|
+
modelSet(val) {
|
|
100
|
+
if (!val) {
|
|
101
|
+
this.$emit("input", this.fileUrl);
|
|
102
|
+
} else {
|
|
103
|
+
this.model = val;
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
};
|
|
108
|
+
</script>
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<v-autocomplete
|
|
2
|
+
<v-autocomplete
|
|
3
|
+
v-bind="fieldAttrs"
|
|
4
|
+
v-model="model"
|
|
5
|
+
:items="options"
|
|
6
|
+
></v-autocomplete>
|
|
3
7
|
</template>
|
|
4
8
|
|
|
5
9
|
<script>
|
|
@@ -26,7 +30,7 @@ export default {
|
|
|
26
30
|
type: Array,
|
|
27
31
|
default: () => [],
|
|
28
32
|
},
|
|
29
|
-
endpoint: String,
|
|
33
|
+
endpoint: String | Object,
|
|
30
34
|
},
|
|
31
35
|
computed: {
|
|
32
36
|
fieldAttrs() {
|
|
@@ -36,6 +40,22 @@ export default {
|
|
|
36
40
|
...this.$attrs,
|
|
37
41
|
};
|
|
38
42
|
},
|
|
43
|
+
crudConfig() {
|
|
44
|
+
switch (typeof this.endpoint) {
|
|
45
|
+
case "string":
|
|
46
|
+
return {
|
|
47
|
+
url: this.endpoint,
|
|
48
|
+
conf: null,
|
|
49
|
+
};
|
|
50
|
+
case "object":
|
|
51
|
+
return {
|
|
52
|
+
url: this.endpoint.url,
|
|
53
|
+
conf: this.endpoint.conf,
|
|
54
|
+
};
|
|
55
|
+
default:
|
|
56
|
+
return { url: "", conf: null };
|
|
57
|
+
}
|
|
58
|
+
},
|
|
39
59
|
},
|
|
40
60
|
watch: {
|
|
41
61
|
items(val) {
|
|
@@ -49,10 +69,10 @@ export default {
|
|
|
49
69
|
},
|
|
50
70
|
},
|
|
51
71
|
mounted() {
|
|
52
|
-
if (this.
|
|
72
|
+
if (this.crudConfig.url) {
|
|
53
73
|
this.$mapo.$api
|
|
54
|
-
.crud(this.
|
|
55
|
-
.list()
|
|
74
|
+
.crud(this.crudConfig.url)
|
|
75
|
+
.list(this.crudConfig.conf)
|
|
56
76
|
.then((res) => (this.options = res));
|
|
57
77
|
}
|
|
58
78
|
},
|
|
@@ -104,6 +104,11 @@
|
|
|
104
104
|
|
|
105
105
|
</div>
|
|
106
106
|
</v-hover>
|
|
107
|
+
<v-messages
|
|
108
|
+
v-model="errorMessages"
|
|
109
|
+
color="error"
|
|
110
|
+
class="mt-2"
|
|
111
|
+
/>
|
|
107
112
|
</div>
|
|
108
113
|
</template>
|
|
109
114
|
|
|
@@ -128,6 +133,10 @@ export default {
|
|
|
128
133
|
type: String,
|
|
129
134
|
default: () => "",
|
|
130
135
|
},
|
|
136
|
+
errorMessages: {
|
|
137
|
+
type: String | Array,
|
|
138
|
+
default: () => []
|
|
139
|
+
},
|
|
131
140
|
rmAddBtn: {
|
|
132
141
|
type: Boolean,
|
|
133
142
|
default: false,
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
var useDarkMode = false;
|
|
2
2
|
|
|
3
3
|
export default {
|
|
4
|
-
plugins: 'mapomedia preview paste importcss searchreplace autolink directionality code visualblocks visualchars fullscreen image link media template codesample table charmap hr pagebreak nonbreaking anchor
|
|
4
|
+
plugins: 'mapomedia preview paste importcss searchreplace autolink directionality code visualblocks visualchars fullscreen image link media template codesample table charmap hr pagebreak nonbreaking anchor insertdatetime advlist lists wordcount textpattern noneditable help charmap quickbars emoticons',
|
|
5
5
|
// imagetools_cors_hosts: ['picsum.photos'],
|
|
6
6
|
menubar: 'file edit view insert format tools table help',
|
|
7
|
-
|
|
7
|
+
menu: { insert: { title: 'Insert', items: 'link mapomedia media template codesample inserttable | charmap emoticons hr | pagebreak nonbreaking anchor | insertdatetime' } },
|
|
8
|
+
toolbar: 'undo redo | bold italic underline strikethrough | fontselect fontsizeselect formatselect | alignleft aligncenter alignright alignjustify | outdent indent | numlist bullist | forecolor backcolor removeformat | pagebreak | charmap emoticons | fullscreen preview | mapomedia media template link anchor codesample | ltr rtl',
|
|
8
9
|
toolbar_sticky: true,
|
|
9
10
|
image_advtab: true,
|
|
10
11
|
// link_list: [
|
|
@@ -45,10 +46,11 @@ export default {
|
|
|
45
46
|
template_mdate_format: '[Date Modified (MDATE): %m/%d/%Y : %H:%M:%S]',
|
|
46
47
|
height: 400,
|
|
47
48
|
image_caption: true,
|
|
48
|
-
|
|
49
|
+
quickbars_insert_toolbar: 'mapomedia quicktable',
|
|
50
|
+
quickbars_selection_toolbar: 'bold italic | quicklink h2 h3 blockquote mapomedia quicktable',
|
|
49
51
|
noneditable_noneditable_class: 'mceNonEditable',
|
|
50
52
|
toolbar_mode: 'sliding',
|
|
51
|
-
contextmenu: 'link
|
|
53
|
+
contextmenu: 'link mapomedia table',
|
|
52
54
|
skin: useDarkMode ? 'oxide-dark' : 'oxide',
|
|
53
55
|
content_css: useDarkMode ? 'dark' : 'default',
|
|
54
56
|
content_style: 'body { font-family:Helvetica,Arial,sans-serif; font-size:14px }'
|
|
@@ -1,24 +1,25 @@
|
|
|
1
1
|
export default function (callback) {
|
|
2
2
|
const pluginmanager = window.tinymce.util.Tools.resolve('tinymce.PluginManager');
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
const pluginname = "mapomedia"
|
|
4
|
+
pluginmanager.add(pluginname, function (editor, url) {
|
|
5
|
+
const conf = {
|
|
5
6
|
icon: 'image',
|
|
6
|
-
|
|
7
|
+
tooltip: 'Insert image/video/audio/docs',
|
|
7
8
|
onAction: () => callback().then(html => {
|
|
8
9
|
editor.focus();
|
|
9
10
|
editor.undoManager.transact(() => editor.selection.setContent(html))
|
|
10
11
|
editor.selection.setCursorLocation();
|
|
11
12
|
editor.nodeChanged();
|
|
12
13
|
}).catch(() => null)
|
|
13
|
-
}
|
|
14
|
+
}
|
|
14
15
|
editor.addCommand('mceMapoMedia', () => callback().then(html => {
|
|
15
16
|
editor.focus();
|
|
16
17
|
editor.undoManager.transact(() => editor.selection.setContent(html))
|
|
17
18
|
editor.selection.setCursorLocation();
|
|
18
19
|
editor.nodeChanged();
|
|
19
20
|
}).catch(() => null))
|
|
20
|
-
editor.ui.registry.addButton(
|
|
21
|
-
editor.ui.registry.addMenuItem(...conf);
|
|
21
|
+
editor.ui.registry.addButton(pluginname, conf);
|
|
22
|
+
editor.ui.registry.addMenuItem(pluginname, { text: "Mapo Media...", ...conf });
|
|
22
23
|
return {
|
|
23
24
|
getMetadata: function () {
|
|
24
25
|
return {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<v-navigation-drawer
|
|
3
|
-
v-model="
|
|
3
|
+
v-model="drawer"
|
|
4
4
|
:mini-variant.sync="miniVariant"
|
|
5
5
|
width="300"
|
|
6
6
|
:clipped="this.$store.getters['mapo/app/clipped']"
|
|
@@ -9,20 +9,7 @@
|
|
|
9
9
|
>
|
|
10
10
|
<div class="menu_container">
|
|
11
11
|
<div>
|
|
12
|
-
<
|
|
13
|
-
<v-list-item-avatar v-if="avatar">
|
|
14
|
-
<v-img :src="avatar"></v-img>
|
|
15
|
-
</v-list-item-avatar>
|
|
16
|
-
<v-list-item-icon v-else>
|
|
17
|
-
<v-icon>mdi-account</v-icon>
|
|
18
|
-
</v-list-item-icon>
|
|
19
|
-
<v-list-item-title>{{
|
|
20
|
-
this.$mapo.$auth.user.username
|
|
21
|
-
}}</v-list-item-title>
|
|
22
|
-
<v-btn icon @click.stop="miniVariant = !miniVariant">
|
|
23
|
-
<v-icon>mdi-chevron-left</v-icon>
|
|
24
|
-
</v-btn>
|
|
25
|
-
</v-list-item>
|
|
12
|
+
<SidebarProfile />
|
|
26
13
|
<v-divider></v-divider>
|
|
27
14
|
</div>
|
|
28
15
|
<div class="menu_container">
|
|
@@ -48,13 +35,8 @@
|
|
|
48
35
|
// @vuese
|
|
49
36
|
export default {
|
|
50
37
|
name: "Sidebar",
|
|
51
|
-
data() {
|
|
52
|
-
return {
|
|
53
|
-
miniVariant: false
|
|
54
|
-
};
|
|
55
|
-
},
|
|
56
38
|
computed: {
|
|
57
|
-
|
|
39
|
+
drawer: {
|
|
58
40
|
get() {
|
|
59
41
|
return this.$store.getters["mapo/app/drawer"];
|
|
60
42
|
},
|
|
@@ -62,19 +44,18 @@ export default {
|
|
|
62
44
|
if (this.$store.getters["mapo/app/drawer"] !== value)
|
|
63
45
|
this.$store.dispatch("mapo/app/toggleSidebarDrawer");
|
|
64
46
|
return value;
|
|
65
|
-
}
|
|
47
|
+
},
|
|
66
48
|
},
|
|
67
|
-
|
|
68
|
-
|
|
49
|
+
miniVariant: {
|
|
50
|
+
get() {
|
|
51
|
+
return this.$store.getters["mapo/app/minivariant"];
|
|
52
|
+
},
|
|
53
|
+
set(value) {
|
|
54
|
+
if (this.$store.getters["mapo/app/minivariant"] !== value)
|
|
55
|
+
this.$store.dispatch("mapo/app/toggleSidebarMinivariant");
|
|
56
|
+
return value;
|
|
57
|
+
},
|
|
69
58
|
},
|
|
70
|
-
avatar() {
|
|
71
|
-
return this.$mapo.$auth.user.avatar;
|
|
72
|
-
}
|
|
73
59
|
},
|
|
74
|
-
methods: {
|
|
75
|
-
drawerReverse() {
|
|
76
|
-
return (this.drawer = !this.drawer);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
60
|
};
|
|
80
61
|
</script>
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
/>
|
|
15
15
|
</v-list>
|
|
16
16
|
<v-divider></v-divider>
|
|
17
|
-
<v-list-item dense class="logout__button" link @click.native="logout">
|
|
17
|
+
<v-list-item v-if="$mapo.$auth.user.isLoggedIn" dense class="logout__button" link @click.native="logout">
|
|
18
18
|
<v-list-item-icon>
|
|
19
19
|
<v-icon>mdi-logout</v-icon>
|
|
20
20
|
</v-list-item-icon>
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
>
|
|
24
24
|
</v-list-item>
|
|
25
25
|
|
|
26
|
-
<div :style="indent" v-if="childrens.length && expanded && !forceCollapse">
|
|
26
|
+
<div class="child-menu" :style="indent" v-if="childrens.length && expanded && !forceCollapse">
|
|
27
27
|
<SidebarListItem
|
|
28
28
|
v-for="(item, i) in childrens"
|
|
29
29
|
:key="i"
|
|
@@ -76,6 +76,19 @@
|
|
|
76
76
|
z-index: -1;
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
|
+
.child-menu {
|
|
80
|
+
position: relative;
|
|
81
|
+
&::after {
|
|
82
|
+
content: "";
|
|
83
|
+
position: absolute;
|
|
84
|
+
width: 0px;
|
|
85
|
+
height: 100%;
|
|
86
|
+
top: -9px;
|
|
87
|
+
margin-left: -4px;
|
|
88
|
+
border-left: solid 3px #acacac;
|
|
89
|
+
z-index: -1;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
79
92
|
}
|
|
80
93
|
.spider-menu.child:last-child {
|
|
81
94
|
.v-list-item__icon {
|
|
@@ -86,6 +99,11 @@
|
|
|
86
99
|
border-bottom-left-radius: 3px;
|
|
87
100
|
}
|
|
88
101
|
}
|
|
102
|
+
.child-menu{
|
|
103
|
+
&::after {
|
|
104
|
+
height: 0px;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
89
107
|
}
|
|
90
108
|
</style>
|
|
91
109
|
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<v-list-item>
|
|
3
|
+
<v-list-item-avatar v-if="avatar">
|
|
4
|
+
<v-img :src="avatar"></v-img>
|
|
5
|
+
</v-list-item-avatar>
|
|
6
|
+
<v-list-item-icon v-else>
|
|
7
|
+
<v-icon>mdi-account</v-icon>
|
|
8
|
+
</v-list-item-icon>
|
|
9
|
+
<v-list-item-title>
|
|
10
|
+
<span v-if="isLoggedIn">
|
|
11
|
+
{{ username }}
|
|
12
|
+
</span>
|
|
13
|
+
<NuxtLink v-else to="/login"> Login </NuxtLink>
|
|
14
|
+
</v-list-item-title>
|
|
15
|
+
<v-btn icon @click.stop="toggleMiniVariant">
|
|
16
|
+
<v-icon>mdi-chevron-left</v-icon>
|
|
17
|
+
</v-btn>
|
|
18
|
+
</v-list-item>
|
|
19
|
+
</template>
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
<script>
|
|
23
|
+
// @vuese
|
|
24
|
+
export default {
|
|
25
|
+
computed: {
|
|
26
|
+
username() {
|
|
27
|
+
return this.isLoggedIn ? this.$mapo.$auth.user.username : "";
|
|
28
|
+
},
|
|
29
|
+
avatar() {
|
|
30
|
+
return this.$mapo.$auth.user.avatar;
|
|
31
|
+
},
|
|
32
|
+
isLoggedIn() {
|
|
33
|
+
return this.$mapo.$auth.user.isLoggedIn;
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
methods: {
|
|
37
|
+
toggleMiniVariant() {
|
|
38
|
+
this.$store.dispatch("mapo/app/toggleSidebarMinivariant");
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
</script>
|
|
@@ -22,7 +22,7 @@ function buildRoutes(routes, defaultIcon) {
|
|
|
22
22
|
|
|
23
23
|
function nestReduce(array, defaultIcon) {
|
|
24
24
|
return array.reduce((stack, route) => {
|
|
25
|
-
const names = route.relPath.split("/");
|
|
25
|
+
const names = (route.relPath || "").split("/");
|
|
26
26
|
if (names.length === 1) {
|
|
27
27
|
stack.push(route);
|
|
28
28
|
} else {
|
|
@@ -31,7 +31,7 @@ function nestReduce(array, defaultIcon) {
|
|
|
31
31
|
if (pIndex === -1) {
|
|
32
32
|
const label = (route.meta && route.meta.parentLabel) || name
|
|
33
33
|
const icon = (route.meta && route.meta.parentIcon) || getDefaultIcon({ route, label }, defaultIcon)
|
|
34
|
-
stack.push({ name, label, icon, childrens: [] });
|
|
34
|
+
stack.push({ name, label, icon, relPath: name, childrens: [] });
|
|
35
35
|
pIndex = stack.length - 1;
|
|
36
36
|
}
|
|
37
37
|
stack[pIndex].childrens.push(
|
package/defaults.js
CHANGED
|
@@ -6,7 +6,7 @@ export default {
|
|
|
6
6
|
dark: true,
|
|
7
7
|
themes: {
|
|
8
8
|
dark: {
|
|
9
|
-
primary: '#
|
|
9
|
+
primary: '#51beaa',
|
|
10
10
|
accent: colors.grey.darken3,
|
|
11
11
|
secondary: colors.amber.darken3,
|
|
12
12
|
info: colors.teal.lighten1,
|
|
@@ -15,7 +15,7 @@ export default {
|
|
|
15
15
|
success: colors.green.accent3
|
|
16
16
|
},
|
|
17
17
|
light: {
|
|
18
|
-
primary: '#
|
|
18
|
+
primary: '#51beaa',
|
|
19
19
|
accent: colors.indigo.accent1,
|
|
20
20
|
secondary: colors.amber.accent2,
|
|
21
21
|
info: colors.teal.lighten1,
|
package/layouts/default.vue
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<v-app>
|
|
3
3
|
<Sidebar />
|
|
4
|
-
<Topbar
|
|
4
|
+
<Topbar />
|
|
5
5
|
<v-main>
|
|
6
6
|
<nuxt />
|
|
7
7
|
<root-components />
|
|
@@ -9,13 +9,25 @@
|
|
|
9
9
|
</v-app>
|
|
10
10
|
</template>
|
|
11
11
|
|
|
12
|
+
<style lang="scss">
|
|
13
|
+
.v-main__wrap {
|
|
14
|
+
.__nuxt-error-page {
|
|
15
|
+
background: transparent;
|
|
16
|
+
.error {
|
|
17
|
+
background: transparent !important;
|
|
18
|
+
svg {
|
|
19
|
+
// fill: #ff5252 !important;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
</style>
|
|
12
25
|
|
|
13
26
|
<script>
|
|
27
|
+
import initDraggable from "@mapomodule/utils/plugins/v-draggable-modals";
|
|
14
28
|
export default {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
};
|
|
19
|
-
}
|
|
29
|
+
mounted() {
|
|
30
|
+
initDraggable();
|
|
31
|
+
},
|
|
20
32
|
};
|
|
21
|
-
</script>
|
|
33
|
+
</script>
|
package/layouts/empty.vue
CHANGED
package/package.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mapomodule/uikit",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.13",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "This is part of Mapo nuxt module. Injects Mapo ui components in the nuxt component discovery system.",
|
|
6
6
|
"author": "bnznamco <gabriele.baldi.01@gmail.com>",
|
|
7
7
|
"repository": "https://github.com/lotrekagency/mapo",
|
|
8
8
|
"main": "./module.js",
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@mapomodule/utils": "^1.0.0-alpha.
|
|
10
|
+
"@mapomodule/utils": "^1.0.0-alpha.13",
|
|
11
11
|
"@nuxtjs/vuetify": "^1.12.1"
|
|
12
12
|
},
|
|
13
13
|
"publishConfig": {
|
|
14
14
|
"access": "public"
|
|
15
15
|
},
|
|
16
|
-
"gitHead": "
|
|
16
|
+
"gitHead": "b0fac0f5ebde4c65cc5347dbb841392dc04ef5e8"
|
|
17
17
|
}
|
package/layouts/error.vue
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<v-app>
|
|
3
|
-
<h1 v-if="error.statusCode === 404">
|
|
4
|
-
{{ pageNotFound }}
|
|
5
|
-
</h1>
|
|
6
|
-
<h1 v-else>
|
|
7
|
-
{{ otherError }}
|
|
8
|
-
</h1>
|
|
9
|
-
<NuxtLink to="/">
|
|
10
|
-
Home page
|
|
11
|
-
</NuxtLink>
|
|
12
|
-
<root-components />
|
|
13
|
-
</v-app>
|
|
14
|
-
</template>
|
|
15
|
-
|
|
16
|
-
<script>
|
|
17
|
-
export default {
|
|
18
|
-
layout: 'empty',
|
|
19
|
-
props: {
|
|
20
|
-
error: {
|
|
21
|
-
type: Object,
|
|
22
|
-
default: null
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
|
-
data () {
|
|
26
|
-
return {
|
|
27
|
-
pageNotFound: '404 Not Found',
|
|
28
|
-
otherError: 'An error occurred'
|
|
29
|
-
}
|
|
30
|
-
},
|
|
31
|
-
head () {
|
|
32
|
-
const title =
|
|
33
|
-
this.error.statusCode === 404 ? this.pageNotFound : this.otherError
|
|
34
|
-
return {
|
|
35
|
-
title
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
</script>
|
|
40
|
-
|
|
41
|
-
<style scoped>
|
|
42
|
-
h1 {
|
|
43
|
-
font-size: 20px;
|
|
44
|
-
}
|
|
45
|
-
</style>
|