Skip to content

Commit 52a5025

Browse files
authored
Merge pull request #5027 from rtibbles/update_le_utils_in_js
Update JS constants for le-utils latest.
2 parents 347a4df + 2751fb7 commit 52a5025

File tree

3 files changed

+212
-71
lines changed

3 files changed

+212
-71
lines changed

contentcuration/contentcuration/frontend/channelEdit/views/files/__tests__/fileUpload.spec.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,13 @@ describe('fileUpload', () => {
7171
});
7272
describe('computed', () => {
7373
it('should map the files to the correct presets', () => {
74-
expect(wrapper.vm.primaryFileMapping[1].file.id).toBe('file-3');
75-
expect(wrapper.vm.primaryFileMapping[2].file.id).toBe('file-1');
76-
expect(wrapper.vm.primaryFileMapping).toHaveLength(3);
74+
expect(wrapper.vm.primaryFileMapping.find(m => m.preset.id === 'epub').file.id).toBe(
75+
'file-3'
76+
);
77+
expect(wrapper.vm.primaryFileMapping.find(m => m.preset.id === 'document').file.id).toBe(
78+
'file-1'
79+
);
80+
expect(wrapper.vm.primaryFileMapping).toHaveLength(4);
7781
});
7882
it('should disallow file removal if there is only one primary file', () => {
7983
const testFiles2 = [

contentcuration/contentcuration/frontend/shared/leUtils/FormatPresets.js

Lines changed: 35 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ const FormatPresetsMap = new Map([
4545
order: 2,
4646
kind_id: 'audio',
4747
allowed_formats: ['png', 'jpg', 'jpeg'],
48-
associated_mimetypes: ['image/png', 'image/jpeg'],
48+
associated_mimetypes: ['image/jpeg', 'image/png'],
4949
},
5050
],
5151
[
@@ -58,7 +58,7 @@ const FormatPresetsMap = new Map([
5858
thumbnail: false,
5959
subtitle: false,
6060
display: true,
61-
order: 1,
61+
order: 3,
6262
kind_id: 'document',
6363
allowed_formats: ['bloompub', 'bloomd'],
6464
associated_mimetypes: ['application/bloompub+zip'],
@@ -77,7 +77,7 @@ const FormatPresetsMap = new Map([
7777
order: 0,
7878
kind_id: null,
7979
allowed_formats: ['png', 'jpg', 'jpeg'],
80-
associated_mimetypes: ['image/png', 'image/jpeg'],
80+
associated_mimetypes: ['image/jpeg', 'image/png'],
8181
},
8282
],
8383
[
@@ -106,10 +106,10 @@ const FormatPresetsMap = new Map([
106106
thumbnail: true,
107107
subtitle: false,
108108
display: true,
109-
order: 3,
109+
order: 4,
110110
kind_id: 'document',
111111
allowed_formats: ['png', 'jpg', 'jpeg'],
112-
associated_mimetypes: ['image/png', 'image/jpeg'],
112+
associated_mimetypes: ['image/jpeg', 'image/png'],
113113
},
114114
],
115115
[
@@ -173,7 +173,7 @@ const FormatPresetsMap = new Map([
173173
order: 3,
174174
kind_id: 'exercise',
175175
allowed_formats: ['png', 'jpg', 'jpeg', 'gif', 'svg'],
176-
associated_mimetypes: ['image/png', 'image/jpeg', 'image/svg', 'image/gif'],
176+
associated_mimetypes: ['image/jpeg', 'image/gif', 'image/png', 'image/svg'],
177177
},
178178
],
179179
[
@@ -189,7 +189,7 @@ const FormatPresetsMap = new Map([
189189
order: 2,
190190
kind_id: 'exercise',
191191
allowed_formats: ['png', 'jpg', 'jpeg'],
192-
associated_mimetypes: ['image/png', 'image/jpeg'],
192+
associated_mimetypes: ['image/jpeg', 'image/png'],
193193
},
194194
],
195195
[
@@ -221,7 +221,7 @@ const FormatPresetsMap = new Map([
221221
order: 2,
222222
kind_id: 'h5p',
223223
allowed_formats: ['png', 'jpg', 'jpeg'],
224-
associated_mimetypes: ['image/png', 'image/jpeg'],
224+
associated_mimetypes: ['image/jpeg', 'image/png'],
225225
},
226226
],
227227
[
@@ -237,7 +237,7 @@ const FormatPresetsMap = new Map([
237237
order: 1,
238238
kind_id: 'video',
239239
allowed_formats: ['mp4', 'webm'],
240-
associated_mimetypes: ['video/webm', 'video/mp4'],
240+
associated_mimetypes: ['video/mp4', 'video/webm'],
241241
},
242242
],
243243
[
@@ -269,7 +269,7 @@ const FormatPresetsMap = new Map([
269269
order: 2,
270270
kind_id: 'html5',
271271
allowed_formats: ['png', 'jpg', 'jpeg'],
272-
associated_mimetypes: ['image/png', 'image/jpeg'],
272+
associated_mimetypes: ['image/jpeg', 'image/png'],
273273
},
274274
],
275275
[
@@ -304,6 +304,22 @@ const FormatPresetsMap = new Map([
304304
associated_mimetypes: ['.zip'],
305305
},
306306
],
307+
[
308+
'kpub',
309+
{
310+
id: 'kpub',
311+
readable_name: 'Kolibri HTML5 Article',
312+
multi_language: false,
313+
supplementary: false,
314+
thumbnail: false,
315+
subtitle: false,
316+
display: true,
317+
order: 1,
318+
kind_id: 'document',
319+
allowed_formats: ['kpub'],
320+
associated_mimetypes: ['application/kpub+zip'],
321+
},
322+
],
307323
[
308324
'low_res_video',
309325
{
@@ -317,7 +333,7 @@ const FormatPresetsMap = new Map([
317333
order: 2,
318334
kind_id: 'video',
319335
allowed_formats: ['mp4', 'webm'],
320-
associated_mimetypes: ['video/webm', 'video/mp4'],
336+
associated_mimetypes: ['video/mp4', 'video/webm'],
321337
},
322338
],
323339
[
@@ -349,7 +365,7 @@ const FormatPresetsMap = new Map([
349365
order: 2,
350366
kind_id: 'exercise',
351367
allowed_formats: ['png', 'jpg', 'jpeg'],
352-
associated_mimetypes: ['image/png', 'image/jpeg'],
368+
associated_mimetypes: ['image/jpeg', 'image/png'],
353369
},
354370
],
355371
[
@@ -365,7 +381,7 @@ const FormatPresetsMap = new Map([
365381
order: 3,
366382
kind_id: 'slideshow',
367383
allowed_formats: ['png', 'jpg', 'jpeg'],
368-
associated_mimetypes: ['image/png', 'image/jpeg'],
384+
associated_mimetypes: ['image/jpeg', 'image/png'],
369385
},
370386
],
371387
[
@@ -397,7 +413,7 @@ const FormatPresetsMap = new Map([
397413
order: 2,
398414
kind_id: 'slideshow',
399415
allowed_formats: ['png', 'jpg', 'jpeg'],
400-
associated_mimetypes: ['image/png', 'image/jpeg'],
416+
associated_mimetypes: ['image/jpeg', 'image/png'],
401417
},
402418
],
403419
[
@@ -413,7 +429,7 @@ const FormatPresetsMap = new Map([
413429
order: 1,
414430
kind_id: 'topic',
415431
allowed_formats: ['png', 'jpg', 'jpeg'],
416-
associated_mimetypes: ['image/png', 'image/jpeg'],
432+
associated_mimetypes: ['image/jpeg', 'image/png'],
417433
},
418434
],
419435
[
@@ -429,7 +445,7 @@ const FormatPresetsMap = new Map([
429445
order: 3,
430446
kind_id: 'video',
431447
allowed_formats: ['mp4', 'webm'],
432-
associated_mimetypes: ['video/webm', 'video/mp4'],
448+
associated_mimetypes: ['video/mp4', 'video/webm'],
433449
},
434450
],
435451
[
@@ -461,7 +477,7 @@ const FormatPresetsMap = new Map([
461477
order: 3,
462478
kind_id: 'video',
463479
allowed_formats: ['png', 'jpg', 'jpeg'],
464-
associated_mimetypes: ['image/png', 'image/jpeg'],
480+
associated_mimetypes: ['image/jpeg', 'image/png'],
465481
},
466482
],
467483
[
@@ -493,7 +509,7 @@ const FormatPresetsMap = new Map([
493509
order: 2,
494510
kind_id: 'zim',
495511
allowed_formats: ['png', 'jpg', 'jpeg'],
496-
associated_mimetypes: ['image/png', 'image/jpeg'],
512+
associated_mimetypes: ['image/jpeg', 'image/png'],
497513
},
498514
],
499515
]);
@@ -522,6 +538,7 @@ export const FormatPresetsNames = {
522538
HTML5_THUMBNAIL: 'html5_thumbnail',
523539
HTML5_ZIP: 'html5_zip',
524540
IMSCP_ZIP: 'imscp_zip',
541+
KPUB: 'kpub',
525542
LOW_RES_VIDEO: 'low_res_video',
526543
QTI: 'qti',
527544
QTI_THUMBNAIL: 'qti_thumbnail',

0 commit comments

Comments
 (0)