@mapomodule/uikit 1.0.0-alpha.9 → 1.0.0

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 (230) hide show
  1. package/CHANGELOG.md +853 -0
  2. package/components/ConfirmDialog.vue +58 -37
  3. package/components/Detail/Detail.vue +415 -285
  4. package/components/Detail/DetailLangSwitch.vue +8 -1
  5. package/components/DropArea.vue +62 -55
  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 +12 -9
  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 → Form/fields}/wygEditor/utils/mapomedia.plugin.js +7 -6
  26. package/components/{fields → Form/fields}/wygEditor/wygEditor.vue +114 -25
  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 +5 -5
  33. package/components/List/ListFilters.vue +48 -10
  34. package/components/List/ListHead.vue +1 -1
  35. package/components/List/ListQuickEdit.vue +28 -102
  36. package/components/List/ListTable.vue +89 -11
  37. package/components/Login.vue +5 -4
  38. package/components/LogoutButton.vue +43 -28
  39. package/components/MediaManager/MediaBreadcrumbs.vue +45 -0
  40. package/components/MediaManager/MediaEditor.vue +226 -195
  41. package/components/MediaManager/MediaFileChanger.vue +78 -0
  42. package/components/MediaManager/MediaFolders.vue +207 -183
  43. package/components/MediaManager/MediaGallery.vue +212 -137
  44. package/components/MediaManager/MediaManager.vue +97 -171
  45. package/components/MediaManager/MediaManagerDialog.vue +28 -20
  46. package/components/MediaManager/MediaPreview.vue +89 -11
  47. package/components/MediaManager/MediaUploader.vue +75 -77
  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 +2 -3
  54. package/components/ThemeToggle.vue +13 -0
  55. package/components/layout/Sidebar/Sidebar.vue +48 -39
  56. package/components/layout/Sidebar/SidebarList.vue +10 -5
  57. package/components/layout/Sidebar/SidebarListItem.vue +56 -15
  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 +33 -7
  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 -142
  220. package/components/Detail/defaults.js +0 -57
  221. package/components/fields/FksField.vue +0 -60
  222. package/components/fields/MediaField.vue +0 -213
  223. package/components/fields/MediaM2mField.vue +0 -243
  224. package/components/fields/wygEditor/defaults.js +0 -55
  225. package/components/layout/Sidebar/SidebarFooter.vue +0 -71
  226. package/defaults.js +0 -29
  227. package/layouts/error.vue +0 -45
  228. /package/components/{fields → Form/fields}/wygEditor/utils/events.js +0 -0
  229. /package/components/{fields/wygEditor/utils/script.injector.js → Form/fields/wygEditor/utils/tinymce.injector.js} +0 -0
  230. /package/static/{favicon.ico → mapo/favicon.ico} +0 -0
@@ -1,176 +1,149 @@
1
1
  <template>
2
- <div v-if="media">
3
- <v-container class="px-md-6">
4
- <div class="img_overlay">
5
- <v-btn class="img_overlay__button img_overlay__button--back" small icon @click="close">
6
- <v-icon>mdi-arrow-left</v-icon>
7
- </v-btn>
8
- <v-btn class="img_overlay__button img_overlay__button--href" small icon :href="media.file" target="_blank" >
9
- <v-icon>mdi-open-in-new</v-icon>
10
- </v-btn>
11
- </div>
12
- <MediaPreview
13
- :media="media"
14
- height="400"
15
- contain
16
- filename
17
- media-controls
18
- class="elevation-2"
19
- />
20
- <v-overlay
21
- absolute
22
- v-model="editing"
23
- @click="editing = false"
24
- ></v-overlay>
25
- <div class="dialog">
26
- <div class="dialog__container">
27
- <v-card flat tile class="dialog__content overflow-y-auto"
28
- :class="{ 'py-0': !editing }"
29
- :max-height="editing ? height : '0px'"
30
- >
31
- <v-card-text class="flex-grow-0">
32
- <v-row class="flex-md-row-reverse">
33
- <v-col md="6" cols="12" class="info-media">
34
- <table class="text-caption fill-height pb-md-10">
35
- <tr>
36
- <td class="pr-3"><b>Filename:</b></td>
37
- <td>{{ fileName }}</td>
38
- </tr>
39
- <tr>
40
- <td class="pr-3"><b>Mime type:</b></td>
41
- <td>{{ media.mime_type }}</td>
42
- </tr>
43
- <tr>
44
- <td class="pr-3"><b>Created:</b></td>
45
- <td>{{ dateCreated }}</td>
46
- </tr>
47
- <tr>
48
- <td class="pr-3"><b>Size:</b></td>
49
- <td>{{ fileSize }}</td>
50
- </tr>
51
- <tr>
52
- <td class="pr-3"><b>Url:</b></td>
53
- <td>
54
- <a :href="media.file" target="_blank">{{ media.file }}</a>
55
- </td>
56
- </tr>
57
- <tr>
58
- <td class="pr-3"><b>Linked models:</b></td>
59
- <td>
60
- <ul>
61
- <li v-for="link in media.links" :key="link.id">
62
- <b>{{link.model}} (id:{{link.id}})</b> - {{link.name}}
63
- </li>
64
- </ul>
65
- </td>
66
- </tr>
67
- </table>
68
- </v-col>
69
- <v-col md="6" cols="12">
70
- <v-row>
71
- <v-col sm="6" md="12" cols="12">
72
- <v-text-field
73
- dense
74
- v-model="media.name"
75
- label="Name"
76
- ></v-text-field>
77
- </v-col>
78
- <v-col sm="6" md="12" cols="12">
79
- <v-text-field
80
- dense
81
- v-model="media.title"
82
- label="Title"
83
- ></v-text-field>
84
- </v-col>
85
- <v-col sm="6" md="12" cols="12">
86
- <v-text-field
87
- dense
88
- v-model="media.description"
89
- label="Description"
90
- ></v-text-field>
91
- </v-col>
92
- <v-col sm="6" md="12" cols="12">
93
- <v-text-field
94
- dense
95
- v-model="media.alt_text"
96
- label="Alt name"
97
- ></v-text-field>
98
- </v-col>
99
- <v-col sm="6" md="12" cols="12" class="d-flex align-center">
100
- <div class="d-flex flex-column flex-grow-1">
101
- <v-file-input
102
- v-model="newFile"
103
- :accept="accept"
104
- label="New file"
105
- show-size
106
- dense
107
- prepend-icon
108
- ></v-file-input>
109
- <v-checkbox
110
- v-if="newFile"
111
- v-model="sameUrl"
112
- label="Maintain old url"
113
- class="ma-0"
114
- hide-details
115
- dense
116
- ></v-checkbox>
117
- </div>
118
- <v-img
119
- v-if="newFile && newFilePreview"
120
- :src="newFilePreview"
121
- aspect-ratio="1"
122
- min-width="70px"
123
- max-width="110px"
124
- class="grey lighten-2 ml-3"
125
- >
126
- <template v-slot:placeholder>
127
- <v-row
128
- class="fill-height ma-0"
129
- align="center"
130
- justify="center"
131
- >
132
- <v-progress-circular
133
- indeterminate
134
- color="grey lighten-5"
135
- ></v-progress-circular>
136
- </v-row>
137
- </template>
138
- </v-img>
139
- </v-col>
140
- </v-row>
141
- </v-col>
142
- </v-row>
143
- </v-card-text>
144
- </v-card>
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
+ >
10
+ <v-icon>mdi-arrow-left</v-icon>
11
+ </v-btn>
12
+ <v-btn
13
+ class="img_overlay__button img_overlay__button--href"
14
+ small
15
+ icon
16
+ :href="media.file"
17
+ target="_blank"
18
+ >
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>
145
124
  <v-btn
125
+ v-if="editing && canDelete"
126
+ text
146
127
  tile
147
- depressed
148
- width="100%"
149
- :class="{ 'pr-0': editing }"
150
- @click="editing = !editing"
128
+ color="error"
129
+ @click.stop="confirmDelete"
151
130
  >
152
- <span>Edit</span>
153
- <v-icon :style="rotate">mdi-chevron-up</v-icon>
154
- <div class="edit_spacer" :class="{ 'flex-grow-1': editing }"></div>
155
- <v-btn v-if="editing" text tile color="primary" @click="saveMedia">
156
- save
157
- </v-btn>
158
- <v-btn
159
- v-if="editing"
160
- text
161
- tile
162
- color="error"
163
- @click.stop="deleteMedia"
164
- >
165
- delete
166
- </v-btn>
131
+ {{ $t("mapo.delete") }}
167
132
  </v-btn>
168
- </div>
133
+ </v-btn>
169
134
  </div>
170
- </v-container>
135
+ </div>
171
136
  </div>
172
137
  </template>
138
+
173
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
+
174
147
  table tr td:nth-child(2) {
175
148
  overflow-wrap: anywhere;
176
149
  }
@@ -189,6 +162,21 @@ table tr td:nth-child(2) {
189
162
  transition-timing-function: ease-out;
190
163
  }
191
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
+ }
192
180
  .edit_spacer {
193
181
  flex-grow: 0;
194
182
  transition: flex-grow 0.3s ease-out;
@@ -200,7 +188,7 @@ table tr td:nth-child(2) {
200
188
  z-index: 1;
201
189
  color: #333333 !important;
202
190
  background: #e0e0e096;
203
- top: 10px;
191
+ top: 30px;
204
192
  &--back {
205
193
  left: 10px;
206
194
  }
@@ -211,7 +199,9 @@ table tr td:nth-child(2) {
211
199
  }
212
200
  </style>
213
201
  <script>
202
+ import { deepClone } from "@mapomodule/utils/helpers/objHelpers";
214
203
  import { humanFileSize } from "@mapomodule/utils/helpers/formatters";
204
+ import { mapGetters, mapActions } from "vuex";
215
205
 
216
206
  export default {
217
207
  name: "MediaEditor",
@@ -221,15 +211,19 @@ export default {
221
211
  editing: false,
222
212
  newFile: null,
223
213
  sameUrl: false,
214
+ currentLang: this.$i18n.locale,
224
215
  };
225
216
  },
226
217
  props: {
227
- value: {
228
- type: Object,
229
- default: () => null,
218
+ languages: {
219
+ type: Array,
220
+ default() {
221
+ return this.$mapo.$options?.content?.languages || [];
222
+ },
230
223
  },
231
224
  },
232
225
  computed: {
226
+ ...mapGetters("mapo/media", ["editMedia"]),
233
227
  fileSize() {
234
228
  return this.media && humanFileSize(this.media.size);
235
229
  },
@@ -253,56 +247,93 @@ export default {
253
247
  return 425;
254
248
  }
255
249
  },
256
- accept(){
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() {
257
267
  switch (this.media.mime_type && this.media.mime_type.split("/")[0]) {
258
268
  case "image":
259
- return "image/*"
269
+ return "image/*";
260
270
  case "video":
261
- return "video/*"
271
+ return "video/*";
262
272
  case "audio":
263
- return "audio/*"
273
+ return "audio/*";
264
274
  default:
265
- return "*"
275
+ return "*";
266
276
  }
267
277
  },
268
- newFilePreview() {
269
- return this.newFile.type.startsWith("image/") ? URL.createObjectURL(this.newFile) : null;
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
+ );
270
292
  },
271
293
  },
272
294
  watch: {
273
- value(val) {
274
- this.media = val;
295
+ editMedia(val) {
296
+ this.media = deepClone(val);
275
297
  this.editing = false;
276
298
  this.newFile = null;
277
299
  this.sameUrl = false;
278
300
  },
279
301
  },
280
302
  methods: {
303
+ ...mapActions("mapo/media", ["getRoot", "closeEditor", "deleteMedia", "updateMedia"]),
281
304
  saveMedia() {
282
- const media = {
283
- id: this.media.id,
284
- name: this.media.name,
285
- title: this.media.title,
286
- description: this.media.description,
287
- alt_text: this.media.alt_text,
305
+ this.updateMedia({
306
+ ...this.media,
288
307
  file: this.newFile || undefined,
289
308
  same_url: (this.newFile && this.sameUrl) || undefined,
290
- };
291
- this.newFile = null;
292
- this.sameUrl = false;
293
- this.$emit("updateMedia", media);
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
+ });
294
319
  },
295
- deleteMedia() {
320
+ confirmDelete() {
296
321
  this.$mapo.$confirm
297
322
  .open({
298
- title: "Delete",
299
- question: "Are you sure you want to delete this media?",
300
- approveButton: { text: "Delete", attrs: { color: "red", text: true } },
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
+ },
301
329
  })
302
- .then((res) => res && this.$emit("deleteMedia", this.media));
303
- },
304
- close() {
305
- this.$emit("input", null);
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()}));
306
337
  },
307
338
  },
308
339
  };
@@ -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>