@mapomodule/uikit 1.0.0-alpha.6 → 1.0.0-alpha.60

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.
Files changed (231) hide show
  1. package/CHANGELOG.md +953 -0
  2. package/components/ConfirmDialog.vue +58 -37
  3. package/components/Detail/Detail.vue +421 -271
  4. package/components/Detail/DetailLangSwitch.vue +9 -2
  5. package/components/DropArea.vue +63 -56
  6. package/components/Form/Form.vue +218 -0
  7. package/components/Form/FormField.vue +216 -0
  8. package/components/Form/FormGroup.vue +146 -0
  9. package/components/Form/FormTabs.vue +188 -0
  10. package/components/Form/defaults.js +98 -0
  11. package/components/Form/fields/ColorField.vue +79 -0
  12. package/components/{fields → Form/fields}/DateField.vue +20 -11
  13. package/components/Form/fields/DateTimeField.vue +271 -0
  14. package/components/Form/fields/EnhancedMediaField.vue +224 -0
  15. package/components/Form/fields/FileField.vue +125 -0
  16. package/components/Form/fields/FksField.vue +115 -0
  17. package/components/Form/fields/MediaField.vue +159 -0
  18. package/components/Form/fields/MediaM2mField.vue +149 -0
  19. package/components/Form/fields/Repeater.vue +618 -0
  20. package/components/{fields → Form/fields}/SeoPreview.vue +10 -10
  21. package/components/Form/fields/TimeField.vue +154 -0
  22. package/components/Form/fields/mapField/leaflet.injector.js +39 -0
  23. package/components/Form/fields/mapField/mapField.vue +350 -0
  24. package/components/Form/fields/wygEditor/defaults.js +25 -0
  25. package/components/{fields/TinyMce → Form/fields/wygEditor}/utils/mapomedia.plugin.js +7 -6
  26. package/components/Form/fields/wygEditor/wygEditor.vue +285 -0
  27. package/components/Form/fields/wygEditorCKE/defaults.js +103 -0
  28. package/components/Form/fields/wygEditorCKE/utils/ckeditor.injector.js +29 -0
  29. package/components/Form/fields/wygEditorCKE/wygEditorCKE.vue +270 -0
  30. package/components/LangSwitcher.vue +44 -0
  31. package/components/List/List.vue +34 -17
  32. package/components/List/ListActions.vue +22 -4
  33. package/components/List/ListFilters.vue +48 -10
  34. package/components/List/ListHead.vue +11 -3
  35. package/components/List/ListQuickEdit.vue +124 -64
  36. package/components/List/ListTable.vue +118 -18
  37. package/components/Login.vue +17 -7
  38. package/components/LogoutButton.vue +43 -28
  39. package/components/MediaManager/MediaBreadcrumbs.vue +45 -0
  40. package/components/MediaManager/MediaEditor.vue +297 -120
  41. package/components/MediaManager/MediaFileChanger.vue +78 -0
  42. package/components/MediaManager/MediaFolders.vue +224 -116
  43. package/components/MediaManager/MediaGallery.vue +224 -145
  44. package/components/MediaManager/MediaManager.vue +125 -159
  45. package/components/MediaManager/MediaManagerDialog.vue +36 -31
  46. package/components/MediaManager/MediaPreview.vue +258 -0
  47. package/components/MediaManager/MediaUploader.vue +91 -90
  48. package/components/MenuManager/MenuManager.vue +332 -0
  49. package/components/MenuManager/MenuNodeEditor.vue +270 -0
  50. package/components/MenuManager/MenuTreeview.vue +237 -0
  51. package/components/MenuManager/MenuTreeviewNode.vue +208 -0
  52. package/components/PagePreview.vue +58 -0
  53. package/components/SnackBar.vue +5 -7
  54. package/components/ThemeToggle.vue +13 -0
  55. package/components/layout/Sidebar/Sidebar.vue +48 -39
  56. package/components/layout/Sidebar/SidebarList.vue +11 -4
  57. package/components/layout/Sidebar/SidebarListItem.vue +113 -13
  58. package/components/layout/Sidebar/SidebarProfile.vue +42 -0
  59. package/components/layout/Sidebar/SidebarTitle.vue +45 -0
  60. package/components/layout/Topbar/Topbar.vue +11 -9
  61. package/components/layout/routebuilder.js +2 -2
  62. package/defaults/i18n.js +37 -0
  63. package/defaults/vuetify.js +34 -0
  64. package/layouts/default.vue +35 -11
  65. package/layouts/empty.vue +10 -0
  66. package/module.js +7 -5
  67. package/package.json +6 -4
  68. package/pages/index.vue +19 -17
  69. package/static/mapo/ckeditor/plugins/image2/dev/assets/image1.jpg +0 -0
  70. package/static/mapo/ckeditor/plugins/image2/dev/assets/image2.jpg +0 -0
  71. package/static/mapo/ckeditor/plugins/image2/dev/contents.css +35 -0
  72. package/static/mapo/ckeditor/plugins/image2/dev/image2.html +338 -0
  73. package/static/mapo/ckeditor/plugins/image2/dialogs/image2.js +557 -0
  74. package/static/mapo/ckeditor/plugins/image2/icons/hidpi/image.png +0 -0
  75. package/static/mapo/ckeditor/plugins/image2/icons/image.png +0 -0
  76. package/static/mapo/ckeditor/plugins/image2/lang/af.js +21 -0
  77. package/static/mapo/ckeditor/plugins/image2/lang/ar.js +21 -0
  78. package/static/mapo/ckeditor/plugins/image2/lang/az.js +21 -0
  79. package/static/mapo/ckeditor/plugins/image2/lang/bg.js +21 -0
  80. package/static/mapo/ckeditor/plugins/image2/lang/bn.js +21 -0
  81. package/static/mapo/ckeditor/plugins/image2/lang/bs.js +21 -0
  82. package/static/mapo/ckeditor/plugins/image2/lang/ca.js +21 -0
  83. package/static/mapo/ckeditor/plugins/image2/lang/cs.js +21 -0
  84. package/static/mapo/ckeditor/plugins/image2/lang/cy.js +21 -0
  85. package/static/mapo/ckeditor/plugins/image2/lang/da.js +21 -0
  86. package/static/mapo/ckeditor/plugins/image2/lang/de-ch.js +21 -0
  87. package/static/mapo/ckeditor/plugins/image2/lang/de.js +21 -0
  88. package/static/mapo/ckeditor/plugins/image2/lang/el.js +21 -0
  89. package/static/mapo/ckeditor/plugins/image2/lang/en-au.js +21 -0
  90. package/static/mapo/ckeditor/plugins/image2/lang/en-ca.js +21 -0
  91. package/static/mapo/ckeditor/plugins/image2/lang/en-gb.js +21 -0
  92. package/static/mapo/ckeditor/plugins/image2/lang/en.js +21 -0
  93. package/static/mapo/ckeditor/plugins/image2/lang/eo.js +21 -0
  94. package/static/mapo/ckeditor/plugins/image2/lang/es-mx.js +21 -0
  95. package/static/mapo/ckeditor/plugins/image2/lang/es.js +21 -0
  96. package/static/mapo/ckeditor/plugins/image2/lang/et.js +21 -0
  97. package/static/mapo/ckeditor/plugins/image2/lang/eu.js +21 -0
  98. package/static/mapo/ckeditor/plugins/image2/lang/fa.js +21 -0
  99. package/static/mapo/ckeditor/plugins/image2/lang/fi.js +21 -0
  100. package/static/mapo/ckeditor/plugins/image2/lang/fo.js +21 -0
  101. package/static/mapo/ckeditor/plugins/image2/lang/fr-ca.js +21 -0
  102. package/static/mapo/ckeditor/plugins/image2/lang/fr.js +21 -0
  103. package/static/mapo/ckeditor/plugins/image2/lang/gl.js +21 -0
  104. package/static/mapo/ckeditor/plugins/image2/lang/gu.js +21 -0
  105. package/static/mapo/ckeditor/plugins/image2/lang/he.js +21 -0
  106. package/static/mapo/ckeditor/plugins/image2/lang/hi.js +21 -0
  107. package/static/mapo/ckeditor/plugins/image2/lang/hr.js +21 -0
  108. package/static/mapo/ckeditor/plugins/image2/lang/hu.js +21 -0
  109. package/static/mapo/ckeditor/plugins/image2/lang/id.js +21 -0
  110. package/static/mapo/ckeditor/plugins/image2/lang/is.js +21 -0
  111. package/static/mapo/ckeditor/plugins/image2/lang/it.js +21 -0
  112. package/static/mapo/ckeditor/plugins/image2/lang/ja.js +21 -0
  113. package/static/mapo/ckeditor/plugins/image2/lang/ka.js +21 -0
  114. package/static/mapo/ckeditor/plugins/image2/lang/km.js +21 -0
  115. package/static/mapo/ckeditor/plugins/image2/lang/ko.js +21 -0
  116. package/static/mapo/ckeditor/plugins/image2/lang/ku.js +21 -0
  117. package/static/mapo/ckeditor/plugins/image2/lang/lt.js +21 -0
  118. package/static/mapo/ckeditor/plugins/image2/lang/lv.js +21 -0
  119. package/static/mapo/ckeditor/plugins/image2/lang/mk.js +21 -0
  120. package/static/mapo/ckeditor/plugins/image2/lang/mn.js +21 -0
  121. package/static/mapo/ckeditor/plugins/image2/lang/ms.js +21 -0
  122. package/static/mapo/ckeditor/plugins/image2/lang/nb.js +21 -0
  123. package/static/mapo/ckeditor/plugins/image2/lang/nl.js +21 -0
  124. package/static/mapo/ckeditor/plugins/image2/lang/no.js +21 -0
  125. package/static/mapo/ckeditor/plugins/image2/lang/oc.js +21 -0
  126. package/static/mapo/ckeditor/plugins/image2/lang/pl.js +21 -0
  127. package/static/mapo/ckeditor/plugins/image2/lang/pt-br.js +21 -0
  128. package/static/mapo/ckeditor/plugins/image2/lang/pt.js +21 -0
  129. package/static/mapo/ckeditor/plugins/image2/lang/ro.js +21 -0
  130. package/static/mapo/ckeditor/plugins/image2/lang/ru.js +21 -0
  131. package/static/mapo/ckeditor/plugins/image2/lang/si.js +21 -0
  132. package/static/mapo/ckeditor/plugins/image2/lang/sk.js +21 -0
  133. package/static/mapo/ckeditor/plugins/image2/lang/sl.js +21 -0
  134. package/static/mapo/ckeditor/plugins/image2/lang/sq.js +21 -0
  135. package/static/mapo/ckeditor/plugins/image2/lang/sr-latn.js +21 -0
  136. package/static/mapo/ckeditor/plugins/image2/lang/sr.js +21 -0
  137. package/static/mapo/ckeditor/plugins/image2/lang/sv.js +21 -0
  138. package/static/mapo/ckeditor/plugins/image2/lang/th.js +21 -0
  139. package/static/mapo/ckeditor/plugins/image2/lang/tr.js +21 -0
  140. package/static/mapo/ckeditor/plugins/image2/lang/tt.js +21 -0
  141. package/static/mapo/ckeditor/plugins/image2/lang/ug.js +21 -0
  142. package/static/mapo/ckeditor/plugins/image2/lang/uk.js +21 -0
  143. package/static/mapo/ckeditor/plugins/image2/lang/vi.js +21 -0
  144. package/static/mapo/ckeditor/plugins/image2/lang/zh-cn.js +21 -0
  145. package/static/mapo/ckeditor/plugins/image2/lang/zh.js +21 -0
  146. package/static/mapo/ckeditor/plugins/image2/plugin.js +1798 -0
  147. package/static/mapo/ckeditor/plugins/image2/samples/assets/image1.jpg +0 -0
  148. package/static/mapo/ckeditor/plugins/image2/samples/assets/image2.jpg +0 -0
  149. package/static/mapo/ckeditor/plugins/image2/samples/image2.html +68 -0
  150. package/static/mapo/ckeditor/skins/moono/dev/icons16.png +0 -0
  151. package/static/mapo/ckeditor/skins/moono/dev/icons16.svg +2374 -0
  152. package/static/mapo/ckeditor/skins/moono/dev/icons32.png +0 -0
  153. package/static/mapo/ckeditor/skins/moono/dev/icons32.svg +2722 -0
  154. package/static/mapo/ckeditor/skins/moono/dev/locations.json +144 -0
  155. package/static/mapo/ckeditor/skins/moono/dialog.css +5 -0
  156. package/static/mapo/ckeditor/skins/moono/dialog_ie.css +5 -0
  157. package/static/mapo/ckeditor/skins/moono/dialog_ie7.css +5 -0
  158. package/static/mapo/ckeditor/skins/moono/dialog_ie8.css +5 -0
  159. package/static/mapo/ckeditor/skins/moono/dialog_iequirks.css +5 -0
  160. package/static/mapo/ckeditor/skins/moono/editor.css +5 -0
  161. package/static/mapo/ckeditor/skins/moono/editor_gecko.css +5 -0
  162. package/static/mapo/ckeditor/skins/moono/editor_ie.css +5 -0
  163. package/static/mapo/ckeditor/skins/moono/editor_ie7.css +5 -0
  164. package/static/mapo/ckeditor/skins/moono/editor_ie8.css +5 -0
  165. package/static/mapo/ckeditor/skins/moono/editor_iequirks.css +5 -0
  166. package/static/mapo/ckeditor/skins/moono/icons.png +0 -0
  167. package/static/mapo/ckeditor/skins/moono/icons_hidpi.png +0 -0
  168. package/static/mapo/ckeditor/skins/moono/images/anchor.png +0 -0
  169. package/static/mapo/ckeditor/skins/moono/images/arrow.png +0 -0
  170. package/static/mapo/ckeditor/skins/moono/images/close.png +0 -0
  171. package/static/mapo/ckeditor/skins/moono/images/hidpi/anchor.png +0 -0
  172. package/static/mapo/ckeditor/skins/moono/images/hidpi/close.png +0 -0
  173. package/static/mapo/ckeditor/skins/moono/images/hidpi/lock-open.png +0 -0
  174. package/static/mapo/ckeditor/skins/moono/images/hidpi/lock.png +0 -0
  175. package/static/mapo/ckeditor/skins/moono/images/hidpi/refresh.png +0 -0
  176. package/static/mapo/ckeditor/skins/moono/images/lock-open.png +0 -0
  177. package/static/mapo/ckeditor/skins/moono/images/lock.png +0 -0
  178. package/static/mapo/ckeditor/skins/moono/images/refresh.png +0 -0
  179. package/static/mapo/ckeditor/skins/moono/images/spinner.gif +0 -0
  180. package/static/mapo/ckeditor/skins/moono/readme.md +49 -0
  181. package/static/mapo/ckeditor/skins/moono/skin.js +10 -0
  182. package/static/mapo/ckeditor/skins/moono-dark/dialog.css +5 -0
  183. package/static/mapo/ckeditor/skins/moono-dark/dialog_ie.css +5 -0
  184. package/static/mapo/ckeditor/skins/moono-dark/dialog_ie7.css +5 -0
  185. package/static/mapo/ckeditor/skins/moono-dark/dialog_ie8.css +5 -0
  186. package/static/mapo/ckeditor/skins/moono-dark/dialog_iequirks.css +5 -0
  187. package/static/mapo/ckeditor/skins/moono-dark/editor.css +5 -0
  188. package/static/mapo/ckeditor/skins/moono-dark/editor_gecko.css +5 -0
  189. package/static/mapo/ckeditor/skins/moono-dark/editor_ie.css +5 -0
  190. package/static/mapo/ckeditor/skins/moono-dark/editor_ie7.css +5 -0
  191. package/static/mapo/ckeditor/skins/moono-dark/editor_ie8.css +5 -0
  192. package/static/mapo/ckeditor/skins/moono-dark/editor_iequirks.css +5 -0
  193. package/static/mapo/ckeditor/skins/moono-dark/icons.png +0 -0
  194. package/static/mapo/ckeditor/skins/moono-dark/icons_hidpi.png +0 -0
  195. package/static/mapo/ckeditor/skins/moono-dark/images/arrow.png +0 -0
  196. package/static/mapo/ckeditor/skins/moono-dark/images/close.png +0 -0
  197. package/static/mapo/ckeditor/skins/moono-dark/images/hidpi/close.png +0 -0
  198. package/static/mapo/ckeditor/skins/moono-dark/images/hidpi/lock-open.png +0 -0
  199. package/static/mapo/ckeditor/skins/moono-dark/images/hidpi/lock.png +0 -0
  200. package/static/mapo/ckeditor/skins/moono-dark/images/hidpi/refresh.png +0 -0
  201. package/static/mapo/ckeditor/skins/moono-dark/images/lock-open.png +0 -0
  202. package/static/mapo/ckeditor/skins/moono-dark/images/lock.png +0 -0
  203. package/static/mapo/ckeditor/skins/moono-dark/images/refresh.png +0 -0
  204. package/static/mapo/ckeditor/skins/moono-dark/readme.md +51 -0
  205. package/static/mapo/ckeditor/skins/moono-dark/skin.js +5 -0
  206. package/static/mapo/tinymce-skins/mapo-dark/content.inline.min.css +7 -0
  207. package/static/mapo/tinymce-skins/mapo-dark/content.min.css +7 -0
  208. package/static/mapo/tinymce-skins/mapo-dark/content.mobile.min.css +7 -0
  209. package/static/mapo/tinymce-skins/mapo-dark/skin.min.css +7 -0
  210. package/static/mapo/tinymce-skins/mapo-dark/skin.mobile.min.css +7 -0
  211. package/static/mapo/tinymce-skins/mapo-light/content.inline.min.css +7 -0
  212. package/static/mapo/tinymce-skins/mapo-light/content.min.css +7 -0
  213. package/static/mapo/tinymce-skins/mapo-light/content.mobile.min.css +7 -0
  214. package/static/mapo/tinymce-skins/mapo-light/skin.min.css +7 -0
  215. package/static/mapo/tinymce-skins/mapo-light/skin.mobile.min.css +7 -0
  216. package/translations/en-US.js +177 -0
  217. package/translations/it-IT.js +180 -0
  218. package/LICENSE.md +0 -20
  219. package/components/Detail/DetailField.vue +0 -132
  220. package/components/Detail/defaults.js +0 -55
  221. package/components/fields/M2mField.vue +0 -95
  222. package/components/fields/MediaField.vue +0 -195
  223. package/components/fields/MediaM2mField.vue +0 -238
  224. package/components/fields/TinyMce/TinyMce.vue +0 -180
  225. package/components/fields/TinyMce/defaults.js +0 -55
  226. package/components/layout/Sidebar/SidebarFooter.vue +0 -70
  227. package/defaults.js +0 -29
  228. package/layouts/error.vue +0 -45
  229. /package/components/{fields/TinyMce → Form/fields/wygEditor}/utils/events.js +0 -0
  230. /package/components/{fields/TinyMce/utils/script.injector.js → Form/fields/wygEditor/utils/tinymce.injector.js} +0 -0
  231. /package/static/{favicon.ico → mapo/favicon.ico} +0 -0
@@ -1,163 +1,340 @@
1
1
  <template>
2
- <div v-if="media">
3
- <div class="d-flex align-center justify-space-between">
4
- <v-btn class="ma-2" @click="close" icon>
2
+ <div v-if="media" class="media-editor--wrapper">
3
+ <div class="img_overlay">
4
+ <v-btn
5
+ class="img_overlay__button img_overlay__button--back"
6
+ small
7
+ icon
8
+ @click="closeEditor"
9
+ >
5
10
  <v-icon>mdi-arrow-left</v-icon>
6
11
  </v-btn>
7
- <span class="subtitle-2">{{ fileName }}</span>
8
- <div></div>
9
- </div>
10
- <v-container class="px-6">
11
- <v-img
12
- :src="media.file"
13
- :lazy-src="media.thumbnail"
14
- max-height="300"
15
- contain
16
- aspect-ratio="1"
17
- class="grey lighten-2 mb-4 elevation-2"
12
+ <v-btn
13
+ class="img_overlay__button img_overlay__button--href"
14
+ small
15
+ icon
16
+ :href="media.file"
17
+ target="_blank"
18
18
  >
19
- <template v-slot:placeholder>
20
- <v-row class="fill-height ma-0" align="center" justify="center">
21
- <v-progress-circular
22
- indeterminate
23
- color="grey lighten-5"
24
- ></v-progress-circular>
25
- </v-row>
26
- </template>
27
- </v-img>
28
- <v-row class="flex-md-row-reverse">
29
- <v-col md="6" cols="12" class="info-media">
30
- <table class="text-caption fill-height pb-md-10">
31
- <tr>
32
- <td class="pr-3"><b>Filename:</b></td>
33
- <td>{{ fileName }}</td>
34
- </tr>
35
- <tr>
36
- <td class="pr-3"><b>Extension:</b></td>
37
- <td>{{ extension }}</td>
38
- </tr>
39
- <tr>
40
- <td class="pr-3"><b>Created:</b></td>
41
- <td>{{ dateCreated }}</td>
42
- </tr>
43
- <tr>
44
- <td class="pr-3"><b>Size:</b></td>
45
- <td>{{ fileSize }}</td>
46
- </tr>
47
- <tr>
48
- <td class="pr-3"><b>Url:</b></td>
49
- <td>
50
- <a :href="media.file" target="_blank">{{ media.file }}</a>
51
- </td>
52
- </tr>
53
- <tr>
54
- <td class="pr-3"><b>Linked models:</b></td>
55
- <td>{{ media.liks }}</td>
56
- </tr>
57
- </table>
58
- </v-col>
59
- <v-col md="6" cols="12">
60
- <v-row>
61
- <v-col sm="6" md="12" cols="12">
62
- <v-text-field
63
- dense
64
- v-model="media.name"
65
- label="Name"
66
- ></v-text-field>
67
- </v-col>
68
- <v-col sm="6" md="12" cols="12">
69
- <v-text-field
70
- dense
71
- v-model="media.title"
72
- label="Title"
73
- ></v-text-field>
74
- </v-col>
75
- <v-col sm="6" md="12" cols="12">
76
- <v-text-field
77
- dense
78
- v-model="media.description"
79
- label="Description"
80
- ></v-text-field>
81
- </v-col>
82
- <v-col sm="6" md="12" cols="12">
83
- <v-text-field
84
- dense
85
- v-model="media.alt_text"
86
- label="Alt name"
87
- ></v-text-field>
88
- </v-col>
89
- </v-row>
90
- <div class="d-flex justify-end">
91
- <v-btn text color="primary" @click="saveMedia">
92
- <v-icon left> mdi-upload </v-icon>
93
- save
94
- </v-btn>
95
- <v-btn text color="error" @click="deleteMedia">
96
- <v-icon left> mdi-delete </v-icon>
97
- delete
98
- </v-btn>
99
- </div>
100
- </v-col>
101
- </v-row>
102
- </v-container>
19
+ <v-icon>mdi-open-in-new</v-icon>
20
+ </v-btn>
21
+ </div>
22
+ <MediaPreview
23
+ :media="media"
24
+ contain
25
+ filename
26
+ media-controls
27
+ class="media-editor--preview elevation-2"
28
+ />
29
+ <v-overlay absolute v-model="editing" @click="editing = false"></v-overlay>
30
+ <div class="dialog">
31
+ <div class="dialog__container">
32
+ <v-card
33
+ flat
34
+ tile
35
+ class="dialog__content overflow-y-auto"
36
+ :class="{ 'py-0': !editing }"
37
+ :max-height="editing ? height : '0px'"
38
+ >
39
+ <v-card-text class="flex-grow-0">
40
+ <v-row class="flex-md-row-reverse">
41
+ <v-col md="6" cols="12" class="info-media">
42
+ <table class="text-caption fill-height pb-md-10">
43
+ <tr>
44
+ <td class="pr-3">
45
+ <b>{{ $t("mapo.fileName") }}:</b>
46
+ </td>
47
+ <td>{{ fileName }}</td>
48
+ </tr>
49
+ <tr>
50
+ <td class="pr-3">
51
+ <b>{{ $t("mapo.mime") }}:</b>
52
+ </td>
53
+ <td>{{ media.mime_type }}</td>
54
+ </tr>
55
+ <tr>
56
+ <td class="pr-3">
57
+ <b>{{ $t("mapo.created") }}:</b>
58
+ </td>
59
+ <td>{{ dateCreated }}</td>
60
+ </tr>
61
+ <tr>
62
+ <td class="pr-3">
63
+ <b>{{ $t("mapo.size") }}:</b>
64
+ </td>
65
+ <td>{{ fileSize }}</td>
66
+ </tr>
67
+ <tr>
68
+ <td class="pr-3"><b>URL:</b></td>
69
+ <td>
70
+ <a :href="media.file" target="_blank">{{ media.file }}</a>
71
+ </td>
72
+ </tr>
73
+ <tr>
74
+ <td class="pr-3">
75
+ <b>{{ $t("mapo.linkedModels") }}:</b>
76
+ </td>
77
+ <td>
78
+ <ul>
79
+ <li v-for="link in media.links" :key="link.id">
80
+ <b>{{ link.model }} (id:{{ link.id }})</b> - {{ link.name }}
81
+ </li>
82
+ </ul>
83
+ </td>
84
+ </tr>
85
+ </table>
86
+ </v-col>
87
+ <v-col md="6" cols="12">
88
+ <v-row>
89
+ <v-col cols="12">
90
+ <DetailLangSwitch
91
+ :langs="languages"
92
+ v-model="currentLang"
93
+ no-route-change
94
+ />
95
+ </v-col>
96
+ </v-row>
97
+ <Form
98
+ v-model="media"
99
+ class="menu-node-editor--form"
100
+ :currentLang="currentLang"
101
+ :languages="languages"
102
+ :fields="fields"
103
+ :moreSlotBindings="slotBindings"
104
+ :readonly="!canEdit"
105
+ />
106
+ <MediaFileChanger class="mt-6" :file.sync="newFile" :maintain-url.sync="sameUrl" :accept="accept" />
107
+ </v-col>
108
+ </v-row>
109
+ </v-card-text>
110
+ </v-card>
111
+ <v-btn
112
+ tile
113
+ depressed
114
+ width="100%"
115
+ :class="{ 'pr-0': editing }"
116
+ @click="editing = !editing"
117
+ >
118
+ <span>{{ canEdit ? $t("mapo.edit") : $t("mapo.mediaEditor.details") }}</span>
119
+ <v-icon :style="rotate">mdi-chevron-up</v-icon>
120
+ <div class="edit_spacer" :class="{ 'flex-grow-1': editing }"></div>
121
+ <v-btn v-if="editing && canEdit" text tile color="primary" @click="saveMedia">
122
+ {{ $t("mapo.save") }}
123
+ </v-btn>
124
+ <v-btn
125
+ v-if="editing && canDelete"
126
+ text
127
+ tile
128
+ color="error"
129
+ @click.stop="confirmDelete"
130
+ >
131
+ {{ $t("mapo.delete") }}
132
+ </v-btn>
133
+ </v-btn>
134
+ </div>
135
+ </div>
103
136
  </div>
104
137
  </template>
138
+
105
139
  <style lang="scss" scoped>
140
+ .media-editor--wrapper {
141
+ height: 100%;
142
+ display: flex;
143
+ flex-direction: column;
144
+ justify-content: space-between;
145
+ }
146
+
106
147
  table tr td:nth-child(2) {
107
148
  overflow-wrap: anywhere;
108
149
  }
150
+ .dialog {
151
+ position: relative;
152
+ height: 56px;
153
+ z-index: 5;
154
+ &__container {
155
+ position: absolute;
156
+ bottom: 0;
157
+ width: 100%;
158
+ }
159
+ &__content {
160
+ transition-property: max-height, padding;
161
+ transition-duration: 0.3s;
162
+ transition-timing-function: ease-out;
163
+ }
164
+ }
165
+ .media-editor--preview {
166
+ max-height: calc(100vh - 180px);
167
+ flex-grow: 1;
168
+ @media (max-width: 600px) {
169
+ max-height: calc(100vh - 260px);
170
+ min-height: calc(100vh - 260px);
171
+ }
172
+ }
173
+ .v-dialog .media-editor--preview {
174
+ max-height: calc(100vh - 510px);
175
+ @media (max-width: 600px) {
176
+ max-height: calc(100vh - 375px);
177
+ min-height: unset;
178
+ }
179
+ }
180
+ .edit_spacer {
181
+ flex-grow: 0;
182
+ transition: flex-grow 0.3s ease-out;
183
+ }
184
+ .img_overlay {
185
+ position: relative;
186
+ &__button {
187
+ position: absolute;
188
+ z-index: 1;
189
+ color: #333333 !important;
190
+ background: #e0e0e096;
191
+ top: 30px;
192
+ &--back {
193
+ left: 10px;
194
+ }
195
+ &--href {
196
+ right: 10px;
197
+ }
198
+ }
199
+ }
109
200
  </style>
110
201
  <script>
202
+ import { deepClone } from "@mapomodule/utils/helpers/objHelpers";
111
203
  import { humanFileSize } from "@mapomodule/utils/helpers/formatters";
204
+ import { mapGetters, mapActions } from "vuex";
112
205
 
113
206
  export default {
114
207
  name: "MediaEditor",
115
208
  data() {
116
209
  return {
117
- media: null
210
+ media: null,
211
+ editing: false,
212
+ newFile: null,
213
+ sameUrl: false,
214
+ currentLang: this.$i18n.locale,
118
215
  };
119
216
  },
120
217
  props: {
121
- value: {
122
- type: Object,
123
- default: () => null
124
- }
218
+ languages: {
219
+ type: Array,
220
+ default() {
221
+ return this.$mapo.$options?.content?.languages || [];
222
+ },
223
+ },
125
224
  },
126
225
  computed: {
226
+ ...mapGetters("mapo/media", ["editMedia"]),
127
227
  fileSize() {
128
228
  return this.media && humanFileSize(this.media.size);
129
229
  },
130
230
  dateCreated() {
131
231
  return this.media && new Date(this.media.created).toLocaleString();
132
232
  },
133
- extension() {
134
- return this.media && this.media.file && this.media.file.split(".").pop();
135
- },
136
233
  fileName() {
137
234
  return this.media && this.media.file && this.media.file.split("/").pop();
138
- }
235
+ },
236
+ rotate() {
237
+ return {
238
+ transform: this.editing ? "rotate(180deg)" : "rotate(0deg)",
239
+ transition: "transform .3s cubic-bezier(0.25, 0.8, 0.5, 1)",
240
+ };
241
+ },
242
+ height() {
243
+ switch (this.$vuetify.breakpoint.name) {
244
+ case "xs":
245
+ return "50vh";
246
+ default:
247
+ return 425;
248
+ }
249
+ },
250
+ fields() {
251
+ return [
252
+ { value: "title", label: this.$t('mapo.titleTag'), attrs: { dense: true } },
253
+ { value: "description", label: this.$t('mapo.description'), attrs: { dense: true } },
254
+ { value: "alt_text", label: this.$t('mapo.altTag'), attrs: { dense: true } },
255
+ ]
256
+ },
257
+ slotBindings() {
258
+ return {
259
+ model: this.media,
260
+ currentLang: this.lang,
261
+ langs: this.languages,
262
+ fields: this.fields,
263
+ readonly: !this.canEdit,
264
+ };
265
+ },
266
+ accept() {
267
+ switch (this.media.mime_type && this.media.mime_type.split("/")[0]) {
268
+ case "image":
269
+ return "image/*";
270
+ case "video":
271
+ return "video/*";
272
+ case "audio":
273
+ return "audio/*";
274
+ default:
275
+ return "*";
276
+ }
277
+ },
278
+ permissionsModel() {
279
+ return this.$mapo.$options?.medias?.permissionsModel || "media";
280
+ },
281
+ canEdit() {
282
+ return this.$store.getters["mapo/user/hasModelPermission"](
283
+ this.permissionsModel,
284
+ "change"
285
+ );
286
+ },
287
+ canDelete() {
288
+ return this.$store.getters["mapo/user/hasModelPermission"](
289
+ this.permissionsModel,
290
+ "delete"
291
+ );
292
+ },
139
293
  },
140
294
  watch: {
141
- value(val) {
142
- this.media = val;
143
- }
295
+ editMedia(val) {
296
+ this.media = deepClone(val);
297
+ this.editing = false;
298
+ this.newFile = null;
299
+ this.sameUrl = false;
300
+ },
144
301
  },
145
302
  methods: {
303
+ ...mapActions("mapo/media", ["getRoot", "closeEditor", "deleteMedia", "updateMedia"]),
146
304
  saveMedia() {
147
- this.$emit("updateMedia", this.media);
305
+ this.updateMedia({
306
+ ...this.media,
307
+ file: this.newFile || undefined,
308
+ same_url: (this.newFile && this.sameUrl) || undefined,
309
+ language_code: this.$i18n.locale,
310
+ }).catch(error => {
311
+ this.$mapo.$snack.open({
312
+ message: error.response?.data?.detail || this.$t("mapo.genericError"),
313
+ color: "error",
314
+ })
315
+ }).finally(() => {
316
+ this.newFile = null;
317
+ this.sameUrl = false;
318
+ });
148
319
  },
149
- deleteMedia() {
320
+ confirmDelete() {
150
321
  this.$mapo.$confirm
151
322
  .open({
152
- title: "Delete",
153
- question: "Are you sure you want to delete this media?",
154
- approveButton: { text: "Delete", attrs: { color: "red" } }
323
+ title: this.$t("mapo.delete"),
324
+ question: this.$t("mapo.mediaEditor.confirmDelete"),
325
+ approveButton: {
326
+ text: this.$t("mapo.delete"),
327
+ attrs: { color: "red", text: true },
328
+ },
155
329
  })
156
- .then(res => res && this.$emit("deleteMedia", this.media));
330
+ .then((res) => res && this.deleteMedia(this.media)
331
+ .catch(error =>
332
+ this.$mapo.$snack.open({
333
+ message: error.response?.data?.detail || this.$t("mapo.genericError"),
334
+ color: "error",
335
+ })
336
+ ).finally(() => {this.getRoot(); this.closeEditor()}));
157
337
  },
158
- close() {
159
- this.$emit("input", null);
160
- }
161
- }
338
+ },
162
339
  };
163
340
  </script>
@@ -0,0 +1,78 @@
1
+ <template>
2
+ <div>
3
+ <div class="d-flex flex-column flex-grow-1">
4
+ <v-file-input
5
+ v-model="newFile"
6
+ :accept="accept"
7
+ :label="$t('mapo.mediaEditor.changeFile')"
8
+ show-size
9
+ dense
10
+ prepend-icon
11
+ outlined
12
+ class="rounded-0"
13
+ ></v-file-input>
14
+ <v-checkbox
15
+ v-if="newFile"
16
+ v-model="sameUrl"
17
+ :label="$t('mapo.mediaEditor.maintainOldUrl')"
18
+ class="ma-0"
19
+ hide-details
20
+ dense
21
+ ></v-checkbox>
22
+ </div>
23
+ <v-img
24
+ v-if="newFile && newFilePreview"
25
+ :src="newFilePreview"
26
+ aspect-ratio="1"
27
+ min-width="70px"
28
+ max-width="110px"
29
+ class="grey lighten-2 ml-3"
30
+ >
31
+ <template v-slot:placeholder>
32
+ <v-row class="fill-height ma-0" align="center" justify="center">
33
+ <v-progress-circular
34
+ indeterminate
35
+ color="grey lighten-5"
36
+ ></v-progress-circular>
37
+ </v-row>
38
+ </template>
39
+ </v-img>
40
+ </div>
41
+ </template>
42
+
43
+ <script>
44
+ export default {
45
+ data() {
46
+ return {
47
+ newFile: null,
48
+ sameUrl: false,
49
+ };
50
+ },
51
+ props: {
52
+ accept: String,
53
+ file: {},
54
+ maintainUrl: Boolean,
55
+ },
56
+ watch: {
57
+ newFile(val) {
58
+ this.$emit("update:file", val);
59
+ },
60
+ file(val) {
61
+ this.newFile = val;
62
+ },
63
+ sameUrl(val) {
64
+ this.$emit("update:maintainUrl", val);
65
+ },
66
+ maintainUrl(val) {
67
+ this.sameUrl = val;
68
+ },
69
+ },
70
+ computed: {
71
+ newFilePreview() {
72
+ return this.newFile?.type?.startsWith("image/")
73
+ ? URL.createObjectURL(this.newFile)
74
+ : null;
75
+ },
76
+ },
77
+ };
78
+ </script>