Skip to content

Commit d1b1361

Browse files
committed
Updated jQuery UI Widget Factory and fixed AngularJS widget options handling. Closes blueimp#2904
1 parent d87b249 commit d1b1361

File tree

5 files changed

+23
-22
lines changed

5 files changed

+23
-22
lines changed

blueimp-file-upload.jquery.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "blueimp-file-upload",
3-
"version": "9.5.3",
3+
"version": "9.5.4",
44
"title": "jQuery File Upload",
55
"author": {
66
"name": "Sebastian Tschan",

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "blueimp-file-upload",
3-
"version": "9.5.3",
3+
"version": "9.5.4",
44
"title": "jQuery File Upload",
55
"description": "File Upload widget with multiple file selection, drag&drop support, progress bar, validation and preview images, audio and video for jQuery. Supports cross-domain, chunked and resumable file uploads. Works with any server-side platform (Google App Engine, PHP, Python, Ruby on Rails, Java, etc.) that supports standard HTML form file uploads.",
66
"keywords": [

js/jquery.fileupload-angular.js

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* jQuery File Upload AngularJS Plugin 2.1.3
2+
* jQuery File Upload AngularJS Plugin 2.2.0
33
* https://github.com/blueimp/jQuery-File-Upload
44
*
55
* Copyright 2013, Sebastian Tschan
@@ -38,7 +38,7 @@
3838
.provider('fileUpload', function () {
3939
var scopeEvalAsync = function (expression) {
4040
var scope = angular.element(this)
41-
.fileupload('option', 'scope')();
41+
.fileupload('option', 'scope');
4242
// Schedule a new $digest cycle if not already inside of one
4343
// and evaluate the given expression:
4444
scope.$evalAsync(expression);
@@ -75,7 +75,7 @@
7575
handleResponse: function (e, data) {
7676
var files = data.result && data.result.files;
7777
if (files) {
78-
data.scope().replace(data.files, files);
78+
data.scope.replace(data.files, files);
7979
} else if (data.errorThrown ||
8080
data.textStatus === 'error') {
8181
data.files[0].error = data.errorThrown ||
@@ -86,7 +86,7 @@
8686
if (e.isDefaultPrevented()) {
8787
return false;
8888
}
89-
var scope = data.scope(),
89+
var scope = data.scope,
9090
filesCopy = [];
9191
angular.forEach(data.files, function (file) {
9292
filesCopy.push(file);
@@ -116,14 +116,14 @@
116116
if (e.isDefaultPrevented()) {
117117
return false;
118118
}
119-
data.scope().$apply();
119+
data.scope.$apply();
120120
},
121121
done: function (e, data) {
122122
if (e.isDefaultPrevented()) {
123123
return false;
124124
}
125125
var that = this;
126-
data.scope().$apply(function () {
126+
data.scope.$apply(function () {
127127
data.handleResponse.call(that, e, data);
128128
});
129129
},
@@ -132,7 +132,7 @@
132132
return false;
133133
}
134134
var that = this,
135-
scope = data.scope();
135+
scope = data.scope;
136136
if (data.errorThrown === 'abort') {
137137
scope.clear(data.files);
138138
return;
@@ -145,7 +145,7 @@
145145
processstart: scopeEvalAsync,
146146
processstop: scopeEvalAsync,
147147
getNumberOfFiles: function () {
148-
var scope = this.scope();
148+
var scope = this.scope;
149149
return scope.queue.length - scope.processing();
150150
},
151151
dataType: 'json',
@@ -207,7 +207,10 @@
207207
return $element.fileupload('active');
208208
},
209209
option: function (option, data) {
210-
return $element.fileupload('option', option, data);
210+
if (arguments.length === 1) {
211+
return $element.fileupload('option', option);
212+
}
213+
$element.fileupload('option', option, data);
211214
},
212215
add: function (data) {
213216
return $element.fileupload('add', data);
@@ -277,12 +280,10 @@
277280
// the options provided via "data-"-parameters,
278281
// as well as those given via options object:
279282
$element.fileupload(angular.extend(
280-
{scope: function () {
281-
return $scope;
282-
}},
283+
{scope: $scope},
283284
fileUpload.defaults
284285
)).on('fileuploadadd', function (e, data) {
285-
data.scope = $scope.option('scope');
286+
data.scope = $scope;
286287
}).on('fileuploadfail', function (e, data) {
287288
if (data.errorThrown === 'abort') {
288289
return;

js/vendor/jquery.ui.widget.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
/*
2-
* jQuery UI Widget 1.10.3+amd
1+
/*!
2+
* jQuery UI Widget 1.10.4+amd
33
* https://github.com/blueimp/jQuery-File-Upload
44
*
5-
* Copyright 2013 jQuery Foundation and other contributors
5+
* Copyright 2014 jQuery Foundation and other contributors
66
* Released under the MIT license.
77
* http://jquery.org/license
88
*
@@ -115,7 +115,7 @@ $.widget = function( name, base, prototype ) {
115115
// TODO: remove support for widgetEventPrefix
116116
// always use the name + a colon as the prefix, e.g., draggable:start
117117
// don't prefix for widgets that aren't DOM-based
118-
widgetEventPrefix: existingConstructor ? basePrototype.widgetEventPrefix : name
118+
widgetEventPrefix: existingConstructor ? (basePrototype.widgetEventPrefix || name) : name
119119
}, proxiedPrototype, {
120120
constructor: constructor,
121121
namespace: namespace,
@@ -324,12 +324,12 @@ $.Widget.prototype = {
324324
curOption = curOption[ parts[ i ] ];
325325
}
326326
key = parts.pop();
327-
if ( value === undefined ) {
327+
if ( arguments.length === 1 ) {
328328
return curOption[ key ] === undefined ? null : curOption[ key ];
329329
}
330330
curOption[ key ] = value;
331331
} else {
332-
if ( value === undefined ) {
332+
if ( arguments.length === 1 ) {
333333
return this.options[ key ] === undefined ? null : this.options[ key ];
334334
}
335335
options[ key ] = value;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "blueimp-file-upload",
3-
"version": "9.5.3",
3+
"version": "9.5.4",
44
"title": "jQuery File Upload",
55
"description": "File Upload widget with multiple file selection, drag&drop support, progress bar, validation and preview images, audio and video for jQuery. Supports cross-domain, chunked and resumable file uploads. Works with any server-side platform (Google App Engine, PHP, Python, Ruby on Rails, Java, etc.) that supports standard HTML form file uploads.",
66
"keywords": [

0 commit comments

Comments
 (0)