vendor/assets/javascripts/uploader/jquery.fileupload-ui.js in rails-uploader-0.0.3 vs vendor/assets/javascripts/uploader/jquery.fileupload-ui.js in rails-uploader-0.0.4
- old
+ new
@@ -131,10 +131,11 @@
// Callback for successful uploads:
done: function (e, data) {
var that = $(this).data('fileupload'),
template,
preview;
+
if (data.context) {
data.context.each(function (index) {
var file = ($.isArray(data.result) &&
data.result[index]) || {error: 'emptyResult'};
if (file.error) {
@@ -360,10 +361,11 @@
options: this.options
});
if (result instanceof $) {
return result;
}
+
return $(this.options.templatesContainer).html(result).children();
},
_renderPreview: function (file, node) {
var that = this,
@@ -535,17 +537,17 @@
'click.' + this.options.namespace,
eventData,
this._startHandler
)
.delegate(
- '.cancel button',
+ '.cancel a',
'click.' + this.options.namespace,
eventData,
this._cancelHandler
)
.delegate(
- '.delete button',
+ '.delete a',
'click.' + this.options.namespace,
eventData,
this._deleteHandler
);
this._initButtonBarEventHandlers();
@@ -554,11 +556,11 @@
_destroyEventHandlers: function () {
var options = this.options;
this._destroyButtonBarEventHandlers();
options.filesContainer
.undelegate('.start button', 'click.' + options.namespace)
- .undelegate('.cancel button', 'click.' + options.namespace)
- .undelegate('.delete button', 'click.' + options.namespace);
+ .undelegate('.cancel a', 'click.' + options.namespace)
+ .undelegate('.delete a', 'click.' + options.namespace);
parentWidget.prototype._destroyEventHandlers.call(this);
},
_enableFileInputButton: function () {
this.element.find('.fileinput-button input')