alchemy-media 0.7.1 → 0.7.2
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 +6 -0
- package/assets/stylesheets/media_elements/_icon.scss +15 -1
- package/bootstrap.js +78 -15
- package/controller/media_files_controller.js +11 -4
- package/helper/media_helper.js +6 -6
- package/package.json +2 -2
- package/view/form/inputs/view_inline/file.hwk +1 -1
- package/view/form/inputs/view_inline/file_preview.hwk +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
## 0.7.2 (2023-01-23)
|
|
2
|
+
|
|
3
|
+
* Make `al-icon` center its contents
|
|
4
|
+
* Make the file upload action use the extra given filename
|
|
5
|
+
* Rename most route names & make them not-postponable
|
|
6
|
+
|
|
1
7
|
## 0.7.1 (2022-12-23)
|
|
2
8
|
|
|
3
9
|
* Cascade `al-svg` role attribute to child `svg` elements
|
|
@@ -1,12 +1,26 @@
|
|
|
1
1
|
al-icon {
|
|
2
2
|
// inline-flex breaks certain (duotone) icons
|
|
3
|
-
|
|
3
|
+
--fa-display: inline-flex;
|
|
4
|
+
display: inline-flex;
|
|
4
5
|
flex-flow: column;
|
|
5
6
|
justify-content: center;
|
|
6
7
|
align-content: center;
|
|
7
8
|
text-align: center;
|
|
9
|
+
position: relative;
|
|
8
10
|
|
|
9
11
|
&[hidden] {
|
|
10
12
|
display: none !important;
|
|
11
13
|
}
|
|
14
|
+
|
|
15
|
+
// Fix Fontawesome duotone icons
|
|
16
|
+
&[icon-style="duotone"] {
|
|
17
|
+
position: relative;
|
|
18
|
+
|
|
19
|
+
&::before {
|
|
20
|
+
position: absolute;
|
|
21
|
+
top: 50%;
|
|
22
|
+
left: 50%;
|
|
23
|
+
transform: translate(-50%, -50%);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
12
26
|
}
|
package/bootstrap.js
CHANGED
|
@@ -40,32 +40,95 @@ alchemy.createDir(options.scratch);
|
|
|
40
40
|
alchemy.createDir(options.cache);
|
|
41
41
|
|
|
42
42
|
// Create routes
|
|
43
|
-
Router.
|
|
44
|
-
|
|
43
|
+
Router.add({
|
|
44
|
+
name : 'MediaFile#serveStatic',
|
|
45
|
+
methods : ['get'],
|
|
46
|
+
can_be_postponed : false,
|
|
47
|
+
paths : /\/media\/static\/(.*)*/,
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
Router.add({
|
|
51
|
+
name : 'MediaFile#image',
|
|
52
|
+
methods : ['get'],
|
|
53
|
+
can_be_postponed : false,
|
|
54
|
+
paths : options.url + '/{id}',
|
|
55
|
+
});
|
|
45
56
|
|
|
46
57
|
// The prefix is added at the end of the route so it does not
|
|
47
58
|
// change the user's active_prefix
|
|
48
|
-
Router.
|
|
49
|
-
|
|
59
|
+
Router.add({
|
|
60
|
+
name : 'MediaFile#data',
|
|
61
|
+
methods : ['get'],
|
|
62
|
+
can_be_postponed : false,
|
|
63
|
+
paths : '/media/data/{prefix}/{id}',
|
|
64
|
+
});
|
|
50
65
|
|
|
51
66
|
Router.add({
|
|
52
|
-
name
|
|
53
|
-
methods
|
|
54
|
-
|
|
55
|
-
|
|
67
|
+
name : 'MediaFile#info',
|
|
68
|
+
methods : ['get'],
|
|
69
|
+
can_be_postponed : false,
|
|
70
|
+
paths : '/media/info',
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
Router.add({
|
|
74
|
+
name : 'MediaFile#recordsource',
|
|
75
|
+
methods : ['get'],
|
|
76
|
+
can_be_postponed : false,
|
|
77
|
+
paths : '/media/recordsource',
|
|
78
|
+
permission : 'media.recordsource',
|
|
56
79
|
});
|
|
57
80
|
|
|
58
81
|
// Allow dummy extensions
|
|
59
|
-
Router.
|
|
82
|
+
Router.add({
|
|
83
|
+
name : 'Media#fileextension',
|
|
84
|
+
methods : ['get'],
|
|
85
|
+
can_be_postponed : false,
|
|
86
|
+
paths : '/media/file/{id}.{extension}',
|
|
87
|
+
handler : 'MediaFile#file'
|
|
88
|
+
});
|
|
60
89
|
|
|
61
90
|
// Allow direct file downloads
|
|
62
|
-
Router.
|
|
63
|
-
|
|
91
|
+
Router.add({
|
|
92
|
+
name : 'MediaFile#file',
|
|
93
|
+
methods : ['get'],
|
|
94
|
+
can_be_postponed : false,
|
|
95
|
+
paths : '/media/file/{id}',
|
|
96
|
+
});
|
|
64
97
|
|
|
65
|
-
Router.
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
98
|
+
Router.add({
|
|
99
|
+
name : 'MediaFile#downloadFile',
|
|
100
|
+
methods : ['get'],
|
|
101
|
+
can_be_postponed : false,
|
|
102
|
+
paths : '/media/download/{id}',
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
Router.add({
|
|
106
|
+
name : 'MediaFile#thumbnail',
|
|
107
|
+
methods : ['get'],
|
|
108
|
+
can_be_postponed : false,
|
|
109
|
+
paths : '/media/thumbnail/{id}',
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
Router.add({
|
|
113
|
+
name : 'MediaFile#placeholder',
|
|
114
|
+
methods : ['get'],
|
|
115
|
+
can_be_postponed : false,
|
|
116
|
+
paths : '/media/placeholder',
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
Router.add({
|
|
120
|
+
name : 'MediaFile#upload',
|
|
121
|
+
methods : ['post'],
|
|
122
|
+
can_be_postponed : false,
|
|
123
|
+
paths : '/media/upload',
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
Router.add({
|
|
127
|
+
name : 'MediaFile#uploadsingle',
|
|
128
|
+
methods : ['post'],
|
|
129
|
+
can_be_postponed : false,
|
|
130
|
+
paths : '/media/uploadsingle',
|
|
131
|
+
});
|
|
69
132
|
|
|
70
133
|
var profiles = alchemy.shared('Media.profiles');
|
|
71
134
|
|
|
@@ -206,7 +206,7 @@ MediaFiles.setAction(function downloadFile(conduit, id, extension) {
|
|
|
206
206
|
*
|
|
207
207
|
* @author Jelle De Loecker <jelle@develry.be>
|
|
208
208
|
* @since 0.0.1
|
|
209
|
-
* @version 0.7.
|
|
209
|
+
* @version 0.7.2
|
|
210
210
|
*
|
|
211
211
|
* @param {Conduit} conduit
|
|
212
212
|
*/
|
|
@@ -215,7 +215,7 @@ MediaFiles.setAction(function upload(conduit) {
|
|
|
215
215
|
var MediaFile = this.getModel('MediaFile'),
|
|
216
216
|
files = conduit.files,
|
|
217
217
|
tasks = [],
|
|
218
|
-
|
|
218
|
+
accept = conduit.body?.accept;
|
|
219
219
|
|
|
220
220
|
if (files && files.files && typeof files.files == 'object') {
|
|
221
221
|
files = files.files;
|
|
@@ -225,12 +225,19 @@ MediaFiles.setAction(function upload(conduit) {
|
|
|
225
225
|
let file = files[key];
|
|
226
226
|
|
|
227
227
|
tasks.push(async next => {
|
|
228
|
+
|
|
229
|
+
let filename = file.name;
|
|
230
|
+
|
|
231
|
+
if (key == 'uploaded_file' && conduit.body.filename) {
|
|
232
|
+
filename = conduit.body.filename;
|
|
233
|
+
}
|
|
234
|
+
|
|
228
235
|
let options = {
|
|
229
236
|
move: true,
|
|
230
|
-
filename:
|
|
237
|
+
filename: filename,
|
|
231
238
|
};
|
|
232
239
|
|
|
233
|
-
let name =
|
|
240
|
+
let name = filename.split('.');
|
|
234
241
|
|
|
235
242
|
// Remove the last piece if there are more than 1
|
|
236
243
|
if (name.length > 1) {
|
package/helper/media_helper.js
CHANGED
|
@@ -230,7 +230,7 @@ Media.setMethod(function applyDirective(element, image, options) {
|
|
|
230
230
|
*
|
|
231
231
|
* @author Jelle De Loecker <jelle@develry.be>
|
|
232
232
|
* @since 0.4.0
|
|
233
|
-
* @version 0.
|
|
233
|
+
* @version 0.7.2
|
|
234
234
|
*
|
|
235
235
|
* @param {String} image_id
|
|
236
236
|
*
|
|
@@ -240,7 +240,7 @@ Media.setMethod(function fileAnchor(file_id, options) {
|
|
|
240
240
|
|
|
241
241
|
var url;
|
|
242
242
|
|
|
243
|
-
return this.view.helpers.Router.printRoute('
|
|
243
|
+
return this.view.helpers.Router.printRoute('MediaFile#file', {id: file_id}, options);
|
|
244
244
|
});
|
|
245
245
|
|
|
246
246
|
/**
|
|
@@ -248,7 +248,7 @@ Media.setMethod(function fileAnchor(file_id, options) {
|
|
|
248
248
|
*
|
|
249
249
|
* @author Jelle De Loecker <jelle@develry.be>
|
|
250
250
|
* @since 0.2.0
|
|
251
|
-
* @version 0.
|
|
251
|
+
* @version 0.7.2
|
|
252
252
|
*
|
|
253
253
|
* @param {String} image_id
|
|
254
254
|
*
|
|
@@ -269,7 +269,7 @@ Media.setMethod(function imageUrl(image_id, options) {
|
|
|
269
269
|
if (options.route) {
|
|
270
270
|
routeName = options.route;
|
|
271
271
|
} else {
|
|
272
|
-
routeName = '
|
|
272
|
+
routeName = 'MediaFile#image';
|
|
273
273
|
}
|
|
274
274
|
|
|
275
275
|
url = this.parseURL(this.view.helpers.Router.routeUrl(routeName, {id: image_id}));
|
|
@@ -311,7 +311,7 @@ Media.setMethod(function imageUrl(image_id, options) {
|
|
|
311
311
|
*
|
|
312
312
|
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
313
313
|
* @since 0.2.0
|
|
314
|
-
* @version 0.
|
|
314
|
+
* @version 0.7.2
|
|
315
315
|
*
|
|
316
316
|
* @param {Object} options
|
|
317
317
|
*
|
|
@@ -321,7 +321,7 @@ Media.setMethod(function placeholderUrl(options) {
|
|
|
321
321
|
|
|
322
322
|
var url;
|
|
323
323
|
|
|
324
|
-
url = this.parseURL(this.view.helpers.Router.routeUrl('
|
|
324
|
+
url = this.parseURL(this.view.helpers.Router.routeUrl('MediaFile#placeholder'));
|
|
325
325
|
|
|
326
326
|
if (options != null) {
|
|
327
327
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "alchemy-media",
|
|
3
3
|
"description": "The media plugin for Alchemy",
|
|
4
|
-
"version": "0.7.
|
|
4
|
+
"version": "0.7.2",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type" : "git",
|
|
7
7
|
"url" : "https://github.com/11ways/alchemy-media.git"
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"veronica" : "~0.2.2"
|
|
13
13
|
},
|
|
14
14
|
"peerDependencies": {
|
|
15
|
-
"alchemymvc" : ">=1.
|
|
15
|
+
"alchemymvc" : ">=1.3.0"
|
|
16
16
|
},
|
|
17
17
|
"license": "MIT",
|
|
18
18
|
"engines": {
|