Commit bcfc6934 authored by Guillaume Perréal's avatar Guillaume Perréal
Browse files

Affichage/cache le bouton d'upload lorsqu'un gère un fichier unique.

Showing with 14 additions and 1 deletion
+14 -1
......@@ -9,6 +9,8 @@
$.fn.irsteaFileUpload = function(options) {
var $this = $(this),
$button = $this.find('.fileinput-button'),
$entries = $this.find('.fileinput-entries'),
prototype = options.prototype,
createUrl = options.createUrl,
uploadPrototype = options.uploadPrototype,
......@@ -33,11 +35,19 @@
},
formatBitrate = function(rate) {
return formatSize(rate) + '/s';
},
updateButtonVisibility = function() {
console.debug($entries.children());
if($entries.children().length > 0 && !options.multiple) {
$button.hide();
} else {
$button.show();
}
};
$this.find('.template-download .size').each(function() { $(this).html(formatSize($(this).text())); });
var formatBitrate = function(rate) { return formatSize(rate) + '/s'; };
updateButtonVisibility();
// Activation
$this.fileupload({
......@@ -112,6 +122,9 @@
fileuploadfailed: function (e, data) {
$.ajax(data.url, { type: 'DELETE' });
},
fileuploadadded: updateButtonVisibility,
fileuploadfinished: updateButtonVisibility,
fileuploaddestroyed: updateButtonVisibility,
});
};
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment