Skip to content

Commit

Permalink
Allowing to pass additional settings when initialising FileInput
Browse files Browse the repository at this point in the history
  • Loading branch information
Julius O committed Feb 1, 2016
1 parent f5ea703 commit b7f0689
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion geokey/static/js/admin.ui.fileinput.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,20 @@ $(function(global) {

function FileInput() {}

FileInput.prototype.init = function(field) {
FileInput.prototype.init = function(field, additionalSettings) {
var settings = {
showUpload: false,
showCancel: false,
browseLabel: 'Browse...',
msgLoading: 'Loading file {index} of {files}...'
};

for (var key in additionalSettings) {
settings[key] = additionalSettings[key];
}
console.log(additionalSettings);
console.log(settings);

if (field.attr('data-preview')) {
settings.initialPreview = '<img src="' + field.attr('data-preview') + '" class="file-preview-image">';
}
Expand Down

0 comments on commit b7f0689

Please sign in to comment.