Chose files with allowed mime-type.
This commit is contained in:
parent
e1cc2309a1
commit
ff34fa6de1
@ -1234,7 +1234,7 @@
|
||||
return ta.selectionEnd = ta.selectionStart = caretPos + text.length;
|
||||
},
|
||||
dialog: function() {
|
||||
var input, name, _ref;
|
||||
var file, input, name, _ref;
|
||||
qr.el = ui.dialog('qr', 'top:0;right:0;', '\
|
||||
<style>\
|
||||
.autohide:not(:hover) > form {\
|
||||
@ -1336,6 +1336,17 @@ textarea.field {\
|
||||
return qr.inputs[match[1]].value = JSON.parse(e.newValue);
|
||||
}
|
||||
});
|
||||
file = $('[type=file]', qr.el);
|
||||
file.accept = $('.rules').textContent.match(/: (.+)/)[1].replace(/\w+/g, function(type) {
|
||||
switch (type) {
|
||||
case 'JPG':
|
||||
return 'image/JPEG';
|
||||
case 'PDF':
|
||||
return 'application/PDF';
|
||||
default:
|
||||
return 'image/' + type;
|
||||
}
|
||||
});
|
||||
return $.add(d.body, qr.el);
|
||||
},
|
||||
submit: function(e) {
|
||||
|
||||
@ -1004,6 +1004,17 @@ textarea.field {
|
||||
if match = e.key.match /qr_(.+)$/
|
||||
qr.inputs[match[1]].value = JSON.parse e.newValue
|
||||
|
||||
file = $ '[type=file]', qr.el
|
||||
# chose only allowed files
|
||||
file.accept = $('.rules').textContent.match(/: (.+)/)[1].replace /\w+/g, (type) ->
|
||||
switch type
|
||||
when 'JPG'
|
||||
'image/JPEG'
|
||||
when 'PDF'
|
||||
'application/PDF'
|
||||
else
|
||||
'image/' + type
|
||||
|
||||
$.add d.body, qr.el
|
||||
|
||||
submit: (e) ->
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user