@mapomodule/uikit 1.0.0-alpha.32 → 1.0.0-alpha.34
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 +34 -0
- package/components/Form/defaults.js +0 -3
- package/components/Form/fields/MediaField.vue +123 -197
- package/components/Form/fields/MediaM2mField.vue +101 -204
- package/components/Form/fields/Repeater.vue +7 -5
- package/components/MediaManager/MediaBreadcrumbs.vue +44 -0
- package/components/MediaManager/MediaEditor.vue +39 -26
- package/components/MediaManager/MediaFolders.vue +156 -150
- package/components/MediaManager/MediaGallery.vue +114 -132
- package/components/MediaManager/MediaManager.vue +76 -171
- package/components/MediaManager/MediaManagerDialog.vue +26 -19
- package/components/MediaManager/MediaPreview.vue +0 -5
- package/components/MediaManager/MediaUploader.vue +3 -9
- package/package.json +3 -3
- package/translations/en-US.js +2 -1
- package/translations/it-IT.js +2 -1
|
@@ -1,242 +1,139 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div>
|
|
3
|
-
<v-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
maxWidth,
|
|
11
|
-
elevation,
|
|
12
|
-
dark,
|
|
13
|
-
light: !dark,
|
|
14
|
-
}"
|
|
2
|
+
<div class="media-m2m--wrapper">
|
|
3
|
+
<v-text-field
|
|
4
|
+
readonly
|
|
5
|
+
v-bind="$attrs"
|
|
6
|
+
@click="dialog = hasSelection ? dialog : true"
|
|
7
|
+
class="media-m2m--card rounded-0"
|
|
8
|
+
:class="{ 'media-m2m--selected': !!hasSelection }"
|
|
9
|
+
:value="hasSelection ? ' ' : ''"
|
|
15
10
|
>
|
|
16
|
-
<
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
>
|
|
26
|
-
<div v-if="pages">{{ $t("mapo.mediaM2MField.newSelection") }}</div>
|
|
27
|
-
<v-icon v-else size="80"> mdi-plus-circle-outline </v-icon>
|
|
28
|
-
</v-btn>
|
|
29
|
-
</v-col>
|
|
30
|
-
</v-row>
|
|
31
|
-
</v-card-actions>
|
|
32
|
-
|
|
33
|
-
<v-window v-model="page">
|
|
34
|
-
<v-window-item
|
|
35
|
-
class="page"
|
|
36
|
-
v-for="(pageMedias, i) in paginatedMedias"
|
|
37
|
-
:key="i"
|
|
11
|
+
<template v-slot:append>
|
|
12
|
+
<v-btn v-if="hasSelection" @click="dialog = true" tile small>{{
|
|
13
|
+
$t("mapo.mediaM2MField.editSelection")
|
|
14
|
+
}}</v-btn>
|
|
15
|
+
<v-virtual-scroll
|
|
16
|
+
v-if="hasSelection"
|
|
17
|
+
:items="model"
|
|
18
|
+
:height="model.length * 64 > 256 ? 256 : model.length * 64"
|
|
19
|
+
item-height="64"
|
|
38
20
|
>
|
|
39
|
-
<v-
|
|
40
|
-
<v-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
<v-col v-for="col in cols" :key="col">
|
|
48
|
-
<MediaField
|
|
49
|
-
v-if="pageMedias[getIndexFromGrid(row, col)]"
|
|
50
|
-
v-model="pageMedias[getIndexFromGrid(row, col)]"
|
|
51
|
-
:aspect-ratio="1"
|
|
52
|
-
:dark="dark"
|
|
53
|
-
rm-add-btn
|
|
54
|
-
@changed-media="checkMediaEdit($event, i, row, col)"
|
|
21
|
+
<template v-slot:default="{ item }">
|
|
22
|
+
<v-divider></v-divider>
|
|
23
|
+
<v-list-item class="media-m2m--item" :key="item.id">
|
|
24
|
+
<v-list-item-avatar tile>
|
|
25
|
+
<MediaPreview
|
|
26
|
+
:media="item"
|
|
27
|
+
:video-preview="!item.is_image"
|
|
28
|
+
class="media-m2m--preview"
|
|
55
29
|
/>
|
|
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
|
-
</v-btn>
|
|
82
|
-
</v-row>
|
|
83
|
-
</v-card-actions>
|
|
84
|
-
</v-card>
|
|
30
|
+
</v-list-item-avatar>
|
|
31
|
+
|
|
32
|
+
<v-list-item-content>
|
|
33
|
+
<v-list-item-title class="text--secondary">
|
|
34
|
+
{{ item.file.split("/").pop() }}
|
|
35
|
+
</v-list-item-title>
|
|
36
|
+
<v-list-item-subtitle>
|
|
37
|
+
{{ item.mime_type || "type/unknow" }},
|
|
38
|
+
{{ humanFileSize(item.size) }},
|
|
39
|
+
{{ formatDate(item.created) }}
|
|
40
|
+
</v-list-item-subtitle>
|
|
41
|
+
</v-list-item-content>
|
|
42
|
+
|
|
43
|
+
<v-list-item-action>
|
|
44
|
+
<v-btn @click.stop="removeItem(item)" small icon>
|
|
45
|
+
<v-icon class="text--secondary"> mdi-close-circle </v-icon>
|
|
46
|
+
</v-btn>
|
|
47
|
+
</v-list-item-action>
|
|
48
|
+
</v-list-item>
|
|
49
|
+
|
|
50
|
+
<v-divider></v-divider>
|
|
51
|
+
</template>
|
|
52
|
+
</v-virtual-scroll>
|
|
53
|
+
</template>
|
|
54
|
+
</v-text-field>
|
|
85
55
|
|
|
86
56
|
<media-manager-dialog
|
|
87
|
-
v-model="
|
|
57
|
+
v-model="dialog"
|
|
88
58
|
select="multi"
|
|
89
|
-
|
|
90
|
-
:light="!dark"
|
|
91
|
-
:dark="dark"
|
|
59
|
+
:selected.sync="model"
|
|
92
60
|
>
|
|
93
61
|
</media-manager-dialog>
|
|
94
62
|
</div>
|
|
95
63
|
</template>
|
|
96
64
|
|
|
97
|
-
<style
|
|
98
|
-
.v-
|
|
99
|
-
|
|
100
|
-
|
|
65
|
+
<style lang="scss">
|
|
66
|
+
.media-m2m--card.v-text-field > .v-input__control > .v-input__slot {
|
|
67
|
+
input {
|
|
68
|
+
cursor: pointer;
|
|
69
|
+
}
|
|
101
70
|
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
overflow: hidden;
|
|
105
|
-
position: relative;
|
|
106
|
-
width: 100%;
|
|
71
|
+
.v-text-field__slot {
|
|
72
|
+
cursor: default;
|
|
107
73
|
}
|
|
108
|
-
|
|
109
|
-
.
|
|
110
|
-
|
|
74
|
+
.media-m2m--selected {
|
|
75
|
+
.v-text-field__slot {
|
|
76
|
+
position: absolute !important;
|
|
77
|
+
width: 100%;
|
|
78
|
+
height: 100%;
|
|
79
|
+
cursor: default;
|
|
80
|
+
}
|
|
81
|
+
.v-input__append-inner {
|
|
82
|
+
cursor: default;
|
|
83
|
+
margin-left: 0;
|
|
84
|
+
width: 100%;
|
|
85
|
+
display: flex;
|
|
86
|
+
flex-direction: column;
|
|
87
|
+
}
|
|
88
|
+
&.media-m2m--card.v-text-field > .v-input__control > .v-input__slot input {
|
|
89
|
+
display: none;
|
|
90
|
+
}
|
|
111
91
|
}
|
|
112
92
|
</style>
|
|
113
93
|
|
|
114
94
|
<script>
|
|
95
|
+
import { humanFileSize } from "@mapomodule/utils/helpers/formatters";
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* This component is made to simplify ManyToMany and ForeignKeys associations. With this component you can modify an array selecting items from a list of checkboxes or a signle item selecting from a checkbox.
|
|
99
|
+
*/
|
|
100
|
+
|
|
115
101
|
export default {
|
|
116
102
|
name: "MediaM2mField",
|
|
117
|
-
transition: "tasks-transition",
|
|
118
103
|
data() {
|
|
119
104
|
return {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
page: 0,
|
|
123
|
-
mmdialog: false,
|
|
105
|
+
model: this.value,
|
|
106
|
+
dialog: false,
|
|
124
107
|
};
|
|
125
108
|
},
|
|
126
|
-
|
|
127
109
|
props: {
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
cols: {
|
|
133
|
-
type: Number,
|
|
134
|
-
default: 2,
|
|
135
|
-
},
|
|
136
|
-
rows: {
|
|
137
|
-
type: Number,
|
|
138
|
-
default: 2,
|
|
139
|
-
},
|
|
140
|
-
|
|
141
|
-
//reflections
|
|
142
|
-
minWidth: {
|
|
143
|
-
type: Number | String,
|
|
144
|
-
default: 300,
|
|
145
|
-
},
|
|
146
|
-
minHeight: {
|
|
147
|
-
type: Number | String,
|
|
148
|
-
default: 300,
|
|
149
|
-
},
|
|
150
|
-
height: {
|
|
151
|
-
type: Number | String,
|
|
152
|
-
},
|
|
153
|
-
width: {
|
|
154
|
-
type: Number | String,
|
|
155
|
-
},
|
|
156
|
-
maxHeight: {
|
|
157
|
-
type: Number | String,
|
|
158
|
-
},
|
|
159
|
-
maxWidth: {
|
|
160
|
-
type: Number | String,
|
|
161
|
-
},
|
|
162
|
-
|
|
163
|
-
elevation: {
|
|
164
|
-
type: Number | String,
|
|
165
|
-
default: undefined,
|
|
166
|
-
},
|
|
167
|
-
flat: {
|
|
168
|
-
type: Boolean,
|
|
169
|
-
default: false,
|
|
170
|
-
},
|
|
171
|
-
|
|
172
|
-
dark: {
|
|
173
|
-
type: Boolean,
|
|
174
|
-
default: false,
|
|
175
|
-
},
|
|
176
|
-
// This set the component status to readonly, stopping the user interaction.
|
|
177
|
-
readonly: {
|
|
178
|
-
type: Boolean,
|
|
179
|
-
default: false,
|
|
110
|
+
// V-model property. It is the attribute to be modified.
|
|
111
|
+
value: {
|
|
112
|
+
type: Array | null,
|
|
113
|
+
required: true,
|
|
180
114
|
},
|
|
181
115
|
},
|
|
182
|
-
|
|
183
|
-
model: {
|
|
184
|
-
prop: "medias",
|
|
185
|
-
event: "changed-selection",
|
|
186
|
-
},
|
|
187
|
-
|
|
188
|
-
mounted() {
|
|
189
|
-
if (this.medias) this.child_medias = this.medias;
|
|
190
|
-
},
|
|
191
|
-
|
|
192
116
|
computed: {
|
|
193
|
-
|
|
194
|
-
return this.
|
|
195
|
-
},
|
|
196
|
-
pages() {
|
|
197
|
-
return Math.ceil(this.child_medias.length / this.mediasPerPage);
|
|
198
|
-
},
|
|
199
|
-
paginatedMedias() {
|
|
200
|
-
var array = new Array(this.pages);
|
|
201
|
-
for (let i = 0; i < array.length; i++) {
|
|
202
|
-
array[i] = this.child_medias.slice(
|
|
203
|
-
i * this.mediasPerPage,
|
|
204
|
-
(i + 1) * this.mediasPerPage
|
|
205
|
-
);
|
|
206
|
-
}
|
|
207
|
-
return array;
|
|
117
|
+
hasSelection() {
|
|
118
|
+
return this.model && this.model.length > 0;
|
|
208
119
|
},
|
|
209
120
|
},
|
|
210
|
-
|
|
211
121
|
methods: {
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
update(selection) {
|
|
216
|
-
this.child_medias = [...selection];
|
|
217
|
-
this.$emit("changed-selection", [...selection]);
|
|
122
|
+
humanFileSize,
|
|
123
|
+
formatDate(val) {
|
|
124
|
+
return val && new Date(val).toLocaleString();
|
|
218
125
|
},
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
let index = this.mediasPerPage * page + this.getIndexFromGrid(row, col);
|
|
222
|
-
if (event) {
|
|
223
|
-
this.child_medias[index] = event;
|
|
224
|
-
} else {
|
|
225
|
-
this.child_medias.splice(index, 1);
|
|
226
|
-
}
|
|
227
|
-
this.update(this.child_medias);
|
|
228
|
-
},
|
|
229
|
-
next() {
|
|
230
|
-
this.page = this.page + 1 === this.length ? 0 : this.page + 1;
|
|
231
|
-
},
|
|
232
|
-
prev() {
|
|
233
|
-
this.page = this.page - 1 < 0 ? this.length - 1 : this.page - 1;
|
|
126
|
+
removeItem(media) {
|
|
127
|
+
this.model = this.model.filter(({ id }) => id != media.id);
|
|
234
128
|
},
|
|
129
|
+
editItem(media) {},
|
|
235
130
|
},
|
|
236
|
-
|
|
237
131
|
watch: {
|
|
238
|
-
|
|
239
|
-
this.
|
|
132
|
+
value(val) {
|
|
133
|
+
this.model = val;
|
|
134
|
+
},
|
|
135
|
+
model(val) {
|
|
136
|
+
this.$emit("input", val);
|
|
240
137
|
},
|
|
241
138
|
},
|
|
242
139
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="container pa-0">
|
|
3
3
|
<div class="d-flex justify-space-between">
|
|
4
|
-
<span class="repeater-label">{{ label }}:</span>
|
|
4
|
+
<span class="repeater-label text--secondary">{{ label }}:</span>
|
|
5
5
|
<v-btn v-if="collapsable" outlined tile text small @click="collapseAll">{{
|
|
6
6
|
$t("mapo.collapse")
|
|
7
7
|
}}</v-btn>
|
|
@@ -152,6 +152,7 @@
|
|
|
152
152
|
.repeater-fields {
|
|
153
153
|
display: none;
|
|
154
154
|
overflow: hidden;
|
|
155
|
+
width: 100%;
|
|
155
156
|
}
|
|
156
157
|
.expand-icon {
|
|
157
158
|
cursor: pointer;
|
|
@@ -247,7 +248,7 @@
|
|
|
247
248
|
|
|
248
249
|
<script>
|
|
249
250
|
import draggable from "vuedraggable";
|
|
250
|
-
import { getPointed } from "@mapomodule/utils/helpers/objHelpers";
|
|
251
|
+
import { getPointed, deepClone } from "@mapomodule/utils/helpers/objHelpers";
|
|
251
252
|
import { titleCase } from "@mapomodule/utils/helpers/formatters";
|
|
252
253
|
import { nameSpacedSlots } from "@mapomodule/utils/helpers/slots";
|
|
253
254
|
|
|
@@ -318,12 +319,13 @@ export default {
|
|
|
318
319
|
},
|
|
319
320
|
watch: {
|
|
320
321
|
value(val) {
|
|
321
|
-
this.items
|
|
322
|
+
if (JSON.stringify(val) === JSON.stringify(this.items)) return;
|
|
323
|
+
this.items = (val && deepClone(val)) || [];
|
|
322
324
|
if (val.length != this.collapsedStack.length)
|
|
323
325
|
this.collapsedStack = (val || []).map(() => !!this.collapsable);
|
|
324
326
|
},
|
|
325
327
|
items(val) {
|
|
326
|
-
this.$emit("input", val);
|
|
328
|
+
this.$emit("input", deepClone(val));
|
|
327
329
|
},
|
|
328
330
|
tModalOpen(val) {
|
|
329
331
|
!val && this.tModalCallback();
|
|
@@ -451,7 +453,7 @@ export default {
|
|
|
451
453
|
},
|
|
452
454
|
},
|
|
453
455
|
mounted() {
|
|
454
|
-
this.items = this.value || [];
|
|
456
|
+
this.items = (this.value && deepClone(this.value)) || [];
|
|
455
457
|
},
|
|
456
458
|
};
|
|
457
459
|
</script>
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
v-if="parentFolders && parentFolders.length"
|
|
4
|
+
class="media-breadcrumbs--wrapper"
|
|
5
|
+
>
|
|
6
|
+
<span class="mx-2 mt-1 d-flex flex-wrap align-center">
|
|
7
|
+
<span class="mb-1">
|
|
8
|
+
<v-icon @click="getRoot({ folder: null })" small>mdi-home</v-icon></span
|
|
9
|
+
>
|
|
10
|
+
<span
|
|
11
|
+
class="media-breadcrumbs--button"
|
|
12
|
+
v-for="(folder, i) in parentFolders"
|
|
13
|
+
:key="i"
|
|
14
|
+
>/<a @click="getRoot({ folder })">{{ folder.slug }}</a>
|
|
15
|
+
</span>
|
|
16
|
+
</span>
|
|
17
|
+
</div>
|
|
18
|
+
</template>
|
|
19
|
+
|
|
20
|
+
<style lang="scss" scoped>
|
|
21
|
+
.media-breadcrumbs--button {
|
|
22
|
+
padding-left: 7px;
|
|
23
|
+
color: grey;
|
|
24
|
+
a {
|
|
25
|
+
margin-left: 7px;
|
|
26
|
+
}
|
|
27
|
+
&:last-child {
|
|
28
|
+
a {
|
|
29
|
+
color: unset;
|
|
30
|
+
cursor: auto;
|
|
31
|
+
pointer-events: none;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
</style>
|
|
36
|
+
|
|
37
|
+
<script>
|
|
38
|
+
import { mapGetters, mapActions } from "vuex";
|
|
39
|
+
|
|
40
|
+
export default {
|
|
41
|
+
computed: mapGetters("mapo/media", ["parentFolders"]),
|
|
42
|
+
methods: mapActions("mapo/media", ["getRoot"]),
|
|
43
|
+
};
|
|
44
|
+
</script>
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div v-if="media">
|
|
3
|
-
<v-container class="px-md-6">
|
|
2
|
+
<div v-if="media" class="media-editor--wrapper">
|
|
4
3
|
<div class="img_overlay">
|
|
5
|
-
<v-btn class="img_overlay__button img_overlay__button--back" small icon @click="
|
|
4
|
+
<v-btn class="img_overlay__button img_overlay__button--back" small icon @click="closeEditor">
|
|
6
5
|
<v-icon>mdi-arrow-left</v-icon>
|
|
7
6
|
</v-btn>
|
|
8
7
|
<v-btn class="img_overlay__button img_overlay__button--href" small icon :href="media.file" target="_blank" >
|
|
@@ -11,11 +10,10 @@
|
|
|
11
10
|
</div>
|
|
12
11
|
<MediaPreview
|
|
13
12
|
:media="media"
|
|
14
|
-
height="400"
|
|
15
13
|
contain
|
|
16
14
|
filename
|
|
17
15
|
media-controls
|
|
18
|
-
class="elevation-2"
|
|
16
|
+
class="media-editor--preview elevation-2"
|
|
19
17
|
/>
|
|
20
18
|
<v-overlay
|
|
21
19
|
absolute
|
|
@@ -160,18 +158,25 @@
|
|
|
160
158
|
text
|
|
161
159
|
tile
|
|
162
160
|
color="error"
|
|
163
|
-
@click.stop="
|
|
161
|
+
@click.stop="confirmDelete"
|
|
164
162
|
>
|
|
165
163
|
{{ $t("mapo.delete") }}
|
|
166
164
|
</v-btn>
|
|
167
165
|
</v-btn>
|
|
168
166
|
</div>
|
|
169
167
|
</div>
|
|
170
|
-
</v-container>
|
|
171
168
|
</div>
|
|
172
169
|
</template>
|
|
173
170
|
|
|
174
171
|
<style lang="scss" scoped>
|
|
172
|
+
|
|
173
|
+
.media-editor--wrapper{
|
|
174
|
+
height: 100%;
|
|
175
|
+
display: flex;
|
|
176
|
+
flex-direction: column;
|
|
177
|
+
justify-content: space-between;
|
|
178
|
+
}
|
|
179
|
+
|
|
175
180
|
table tr td:nth-child(2) {
|
|
176
181
|
overflow-wrap: anywhere;
|
|
177
182
|
}
|
|
@@ -190,6 +195,20 @@ table tr td:nth-child(2) {
|
|
|
190
195
|
transition-timing-function: ease-out;
|
|
191
196
|
}
|
|
192
197
|
}
|
|
198
|
+
.media-editor--preview{
|
|
199
|
+
max-height: calc(100vh - 180px);
|
|
200
|
+
flex-grow: 1;
|
|
201
|
+
@media (max-width: 600px){
|
|
202
|
+
max-height: calc(100vh - 260px);
|
|
203
|
+
min-height: calc(100vh - 260px); }
|
|
204
|
+
}
|
|
205
|
+
.v-dialog .media-editor--preview{
|
|
206
|
+
max-height: calc(100vh - 510px);
|
|
207
|
+
@media (max-width: 600px){
|
|
208
|
+
max-height: calc(100vh - 375px);
|
|
209
|
+
min-height: unset;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
193
212
|
.edit_spacer {
|
|
194
213
|
flex-grow: 0;
|
|
195
214
|
transition: flex-grow 0.3s ease-out;
|
|
@@ -201,7 +220,7 @@ table tr td:nth-child(2) {
|
|
|
201
220
|
z-index: 1;
|
|
202
221
|
color: #333333 !important;
|
|
203
222
|
background: #e0e0e096;
|
|
204
|
-
top:
|
|
223
|
+
top: 30px;
|
|
205
224
|
&--back {
|
|
206
225
|
left: 10px;
|
|
207
226
|
}
|
|
@@ -213,6 +232,7 @@ table tr td:nth-child(2) {
|
|
|
213
232
|
</style>
|
|
214
233
|
<script>
|
|
215
234
|
import { humanFileSize } from "@mapomodule/utils/helpers/formatters";
|
|
235
|
+
import { mapGetters, mapActions } from "vuex"
|
|
216
236
|
|
|
217
237
|
export default {
|
|
218
238
|
name: "MediaEditor",
|
|
@@ -224,13 +244,8 @@ export default {
|
|
|
224
244
|
sameUrl: false,
|
|
225
245
|
};
|
|
226
246
|
},
|
|
227
|
-
props: {
|
|
228
|
-
value: {
|
|
229
|
-
type: Object,
|
|
230
|
-
default: () => null,
|
|
231
|
-
},
|
|
232
|
-
},
|
|
233
247
|
computed: {
|
|
248
|
+
...mapGetters("mapo/media", ["editMedia"]),
|
|
234
249
|
fileSize() {
|
|
235
250
|
return this.media && humanFileSize(this.media.size);
|
|
236
251
|
},
|
|
@@ -271,7 +286,7 @@ export default {
|
|
|
271
286
|
},
|
|
272
287
|
},
|
|
273
288
|
watch: {
|
|
274
|
-
|
|
289
|
+
editMedia(val) {
|
|
275
290
|
this.media = val;
|
|
276
291
|
this.editing = false;
|
|
277
292
|
this.newFile = null;
|
|
@@ -279,8 +294,9 @@ export default {
|
|
|
279
294
|
},
|
|
280
295
|
},
|
|
281
296
|
methods: {
|
|
297
|
+
...mapActions("mapo/media", ["closeEditor", "deleteMedia", "updateMedia"]),
|
|
282
298
|
saveMedia() {
|
|
283
|
-
|
|
299
|
+
this.updateMedia({
|
|
284
300
|
id: this.media.id,
|
|
285
301
|
name: this.media.name,
|
|
286
302
|
title: this.media.title,
|
|
@@ -289,23 +305,20 @@ export default {
|
|
|
289
305
|
file: this.newFile || undefined,
|
|
290
306
|
same_url: (this.newFile && this.sameUrl) || undefined,
|
|
291
307
|
language_code: this.$i18n.locale
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
308
|
+
}).then(() => {
|
|
309
|
+
this.newFile = null;
|
|
310
|
+
this.sameUrl = false;
|
|
311
|
+
});
|
|
296
312
|
},
|
|
297
|
-
|
|
313
|
+
confirmDelete() {
|
|
298
314
|
this.$mapo.$confirm
|
|
299
315
|
.open({
|
|
300
316
|
title: this.$t("mapo.delete"),
|
|
301
317
|
question: this.$t("mapo.mediaEditor.confirmDelete"),
|
|
302
318
|
approveButton: { text: this.$t("mapo.delete"), attrs: { color: "red", text: true } },
|
|
303
319
|
})
|
|
304
|
-
.then((res) => res && this
|
|
305
|
-
}
|
|
306
|
-
close() {
|
|
307
|
-
this.$emit("input", null);
|
|
308
|
-
},
|
|
320
|
+
.then((res) => res && this.deleteMedia(this.media));
|
|
321
|
+
}
|
|
309
322
|
},
|
|
310
323
|
};
|
|
311
324
|
</script>
|