From 807b58df940290e4488cda8454db846366abf14e Mon Sep 17 00:00:00 2001 From: Clint Tseng Date: Tue, 5 Mar 2019 15:41:58 -0800 Subject: [PATCH] control/new: add new appearance types for media inputs. --- public/javascripts/control.js | 7 ++++++- public/javascripts/data.js | 24 ++++++++++++++++++++++-- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/public/javascripts/control.js b/public/javascripts/control.js index f0f4445c..554b78d6 100644 --- a/public/javascripts/control.js +++ b/public/javascripts/control.js @@ -645,8 +645,13 @@ type: 'enum', description: 'Type of media to upload.', options: [ 'Image', + 'Selfie', + 'Annotate', + 'Draw', + 'Signature', 'Audio', - 'Video' ], + 'Video', + 'Selfie Video' ], value: 'Image' } }, inputBarcode: {}, inputSelectOne: { diff --git a/public/javascripts/data.js b/public/javascripts/data.js index c77c93fc..9e0b209c 100644 --- a/public/javascripts/data.js +++ b/public/javascripts/data.js @@ -148,6 +148,23 @@ var dataNS = odkmaker.namespace.load('odkmaker.data'); 'Vertical Slider': 'vertical', 'Picker': 'picker' }; + var mediaTypes = { + 'Image': 'image/*', + 'Selfie': 'image/*', + 'Annotate': 'image/*', + 'Draw': 'image/*', + 'Signature': 'image/*', + 'Audio': 'audio/*', + 'Video': 'video/*', + 'Selfie Video': 'video/*' + }; + var mediaAppearances = { + 'Signature': 'signature', + 'Annotate': 'annotate', + 'Draw': 'draw', + 'Selfie': 'new-front', + 'Selfie Video': 'draw' + }; var addTranslation = function(obj, itextPath, translations) { _.each(translations.children, function(translation) @@ -529,8 +546,11 @@ var dataNS = odkmaker.namespace.load('odkmaker.data'); } // media kind - if (control.type == 'inputMedia') - bodyTag.attrs.mediatype = control.kind.toLowerCase() + '/*'; + if (control.type == 'inputMedia') { + bodyTag.attrs.mediatype = mediaTypes[control.kind]; + if (mediaAppearances[control.kind] != null) + bodyTag.attrs.appearance = mediaAppearances[control.kind]; + } // appearance if (control.appearance != null)