Changed file dropper to autodetect "allowmultiple"

This commit is contained in:
Marcin Kurczewski 2014-09-13 16:09:23 +02:00
parent 12b43b1bb8
commit 23f5100cf8
2 changed files with 2 additions and 2 deletions

View file

@ -3,11 +3,11 @@ App.Controls = App.Controls || {};
App.Controls.FileDropper = function( App.Controls.FileDropper = function(
$fileInput, $fileInput,
allowMultiple,
onChange, onChange,
jQuery) { jQuery) {
var $dropDiv = jQuery('<div class="file-handler"></div>'); var $dropDiv = jQuery('<div class="file-handler"></div>');
var allowMultiple = $fileInput.attr('multiple');
$dropDiv.html((allowMultiple ? 'Drop files here!' : 'Drop file here!') + '<br/>Or just click on this box.'); $dropDiv.html((allowMultiple ? 'Drop files here!' : 'Drop file here!') + '<br/>Or just click on this box.');
$dropDiv.insertBefore($fileInput); $dropDiv.insertBefore($fileInput);
$fileInput.attr('multiple', allowMultiple); $fileInput.attr('multiple', allowMultiple);

View file

@ -52,7 +52,7 @@ App.Presenters.UserAccountSettingsPresenter = function(
$el.find('form').submit(accountSettingsFormSubmitted); $el.find('form').submit(accountSettingsFormSubmitted);
$el.find('form [name=avatar-style]').change(avatarStyleChanged); $el.find('form [name=avatar-style]').change(avatarStyleChanged);
avatarStyleChanged(); avatarStyleChanged();
new App.Controls.FileDropper($el.find('[name=avatar-content]'), false, avatarContentChanged, jQuery); new App.Controls.FileDropper($el.find('[name=avatar-content]'), avatarContentChanged, jQuery);
} }
function getPrivileges() { function getPrivileges() {