Skip to content

Commit

Permalink
control/new: add new appearance types for media inputs.
Browse files Browse the repository at this point in the history
  • Loading branch information
issa-tseng committed Mar 5, 2019
1 parent aa370b1 commit 807b58d
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 3 deletions.
7 changes: 6 additions & 1 deletion public/javascripts/control.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
24 changes: 22 additions & 2 deletions public/javascripts/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 807b58d

Please sign in to comment.