jquery.fileupload-rails 1.4.1 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ Zjc5NzI4Zjc3YTMyMzM1YTAxZWU5YWUyM2U3NjZmMmMwYThjZTcwZA==
5
+ data.tar.gz: !binary |-
6
+ MDliNDJmYTRlNGNjMDUzZGRkZjY2N2UyMTJjNmZkNGUwNDFiYWMyNg==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ MTNkMjZjMmMxZWI0MWFiMjI5MjIyMzFlZjViYzJjZTA0NmVmYWE2MjQ4OGFj
10
+ ZTA3NWFiOGRlMWNiYWQ3NjJjMmEyMzJlZWI5N2EwZjEyZjM2ZjIyNjdhMTNi
11
+ ZjFlNmFmNTEzZjg2OTVkMzViZTE1NWQzYjQzYzEzZTI5YmViOTU=
12
+ data.tar.gz: !binary |-
13
+ YTU3ODQzNzU3ZGM3NDhkNGIxYjM3NjZhNzRhNzg3MmVlOTA2MDg4N2FiYjRh
14
+ ZjNhODRiNTAxOGMxOGZlMzY3MWQwMTFlZTE3NzU3Yjg3ZGU0MzgyOGI2OTdm
15
+ MDc0NDliYWE3YmJiOTg5MzJjM2ViOWE2MmZjYjBlOWQwOWU2Zjk=
data/Readme.md CHANGED
@@ -41,6 +41,8 @@ If you downloaded jquery.ui assets into your project, delete them and use [jquer
41
41
 
42
42
  ## Changelog
43
43
 
44
+ 1.5.0. Core 5.30.
45
+
44
46
  1.4.1. Core 5.28.8.
45
47
 
46
48
  1.4.0. Core 5.28.4.
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "jquery.fileupload-rails"
5
- s.version = "1.4.1"
5
+ s.version = "1.5.0"
6
6
  s.author = "Semyon Perepelitsa"
7
7
  s.email = "sema@sema.in"
8
8
  s.homepage = "https://github.com/semaperepelitsa/jquery.fileupload-rails"
@@ -2,7 +2,7 @@
2
2
  //= require jquery.iframe-transport
3
3
 
4
4
  /*
5
- * jQuery File Upload Plugin 5.28.8
5
+ * jQuery File Upload Plugin 5.30
6
6
  * https://github.com/blueimp/jQuery-File-Upload
7
7
  *
8
8
  * Copyright 2010, Sebastian Tschan
@@ -118,6 +118,23 @@
118
118
  // By default, uploads are started automatically when adding files:
119
119
  autoUpload: true,
120
120
 
121
+ // Error and info messages:
122
+ messages: {
123
+ uploadedBytes: 'Uploaded bytes exceed file size'
124
+ },
125
+
126
+ // Translation function, gets the message key to be translated
127
+ // and an object with context specific data as arguments:
128
+ i18n: function (message, context) {
129
+ message = this.messages[message] || message.toString();
130
+ if (context) {
131
+ $.each(context, function (key, value) {
132
+ message = message.replace('{' + key + '}', value);
133
+ });
134
+ }
135
+ return message;
136
+ },
137
+
121
138
  // Additional form data to be sent along with the file uploads can be set
122
139
  // using this option, which accepts an array of objects with name and
123
140
  // value properties, a function returning such an array, a FormData
@@ -142,9 +159,10 @@
142
159
  // data.submit().done(func).fail(func).always(func);
143
160
  add: function (e, data) {
144
161
  if (data.autoUpload || (data.autoUpload !== false &&
145
- ($(this).data('blueimp-fileupload') ||
146
- $(this).data('fileupload')).options.autoUpload)) {
147
- data.submit();
162
+ $(this).fileupload('option', 'autoUpload'))) {
163
+ data.process().done(function () {
164
+ data.submit();
165
+ });
148
166
  }
149
167
  },
150
168
 
@@ -551,9 +569,20 @@
551
569
  return this._enhancePromise(promise);
552
570
  },
553
571
 
554
- // Adds convenience methods to the callback arguments:
572
+ // Adds convenience methods to the data callback argument:
555
573
  _addConvenienceMethods: function (e, data) {
556
- var that = this;
574
+ var that = this,
575
+ getPromise = function (data) {
576
+ return $.Deferred().resolveWith(that, [data]).promise();
577
+ };
578
+ data.process = function (resolveFunc, rejectFunc) {
579
+ if (resolveFunc || rejectFunc) {
580
+ data._processQueue = this._processQueue =
581
+ (this._processQueue || getPromise(this))
582
+ .pipe(resolveFunc, rejectFunc);
583
+ }
584
+ return this._processQueue || getPromise(this);
585
+ };
557
586
  data.submit = function () {
558
587
  if (this.state() !== 'pending') {
559
588
  data.jqXHR = this.jqXHR =
@@ -572,6 +601,9 @@
572
601
  if (this.jqXHR) {
573
602
  return that._getDeferredState(this.jqXHR);
574
603
  }
604
+ if (this._processQueue) {
605
+ return that._getDeferredState(this._processQueue);
606
+ }
575
607
  };
576
608
  data.progress = function () {
577
609
  return this._progress;
@@ -615,7 +647,7 @@
615
647
  return true;
616
648
  }
617
649
  if (ub >= fs) {
618
- file.error = 'Uploaded bytes exceed file size';
650
+ file.error = options.i18n('uploadedBytes');
619
651
  return this._getXHRPromise(
620
652
  false,
621
653
  options.context,
@@ -1148,10 +1180,32 @@
1148
1180
  }
1149
1181
  },
1150
1182
 
1151
- _create: function () {
1152
- var options = this.options;
1183
+ _getRegExp: function (str) {
1184
+ var parts = str.split('/'),
1185
+ modifiers = parts.pop();
1186
+ parts.shift();
1187
+ return new RegExp(parts.join('/'), modifiers);
1188
+ },
1189
+
1190
+ _initDataAttributes: function () {
1191
+ var that = this,
1192
+ options = this.options;
1153
1193
  // Initialize options set via HTML5 data-attributes:
1154
- $.extend(options, $(this.element[0].cloneNode(false)).data());
1194
+ $.each(
1195
+ $(this.element[0].cloneNode(false)).data(),
1196
+ function (key, value) {
1197
+ // Initialize RegExp options:
1198
+ if ($.type(value) === 'string' &&
1199
+ value.charAt(0) === '/') {
1200
+ value = that._getRegExp(value);
1201
+ }
1202
+ options[key] = value;
1203
+ }
1204
+ );
1205
+ },
1206
+
1207
+ _create: function () {
1208
+ this._initDataAttributes();
1155
1209
  this._initSpecialOptions();
1156
1210
  this._slots = [];
1157
1211
  this._sequence = this._getXHRPromise(true);
metadata CHANGED
@@ -1,48 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jquery.fileupload-rails
3
3
  version: !ruby/object:Gem::Version
4
- prerelease:
5
- version: 1.4.1
4
+ version: 1.5.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Semyon Perepelitsa
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-04-02 00:00:00.000000000 Z
11
+ date: 2013-04-27 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
14
+ prerelease: false
15
+ name: railties
15
16
  version_requirements: !ruby/object:Gem::Requirement
16
17
  requirements:
17
18
  - - ! '>='
18
19
  - !ruby/object:Gem::Version
19
20
  version: '3.1'
20
- none: false
21
- name: railties
22
- type: :runtime
23
- prerelease: false
24
21
  requirement: !ruby/object:Gem::Requirement
25
22
  requirements:
26
23
  - - ! '>='
27
24
  - !ruby/object:Gem::Version
28
25
  version: '3.1'
29
- none: false
26
+ type: :runtime
30
27
  - !ruby/object:Gem::Dependency
28
+ prerelease: false
29
+ name: jquery-ui-rails
31
30
  version_requirements: !ruby/object:Gem::Requirement
32
31
  requirements:
33
32
  - - ~>
34
33
  - !ruby/object:Gem::Version
35
34
  version: '3.0'
36
- none: false
37
- name: jquery-ui-rails
38
- type: :runtime
39
- prerelease: false
40
35
  requirement: !ruby/object:Gem::Requirement
41
36
  requirements:
42
37
  - - ~>
43
38
  - !ruby/object:Gem::Version
44
39
  version: '3.0'
45
- none: false
40
+ type: :runtime
46
41
  description: This gem packages jQuery File Upload plugin and it's dependencies for
47
42
  Rails asset pipeline.
48
43
  email: sema@sema.in
@@ -85,6 +80,7 @@ files:
85
80
  homepage: https://github.com/semaperepelitsa/jquery.fileupload-rails
86
81
  licenses:
87
82
  - MIT
83
+ metadata: {}
88
84
  post_install_message:
89
85
  rdoc_options: []
90
86
  require_paths:
@@ -94,17 +90,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
94
90
  - - ! '>='
95
91
  - !ruby/object:Gem::Version
96
92
  version: '0'
97
- none: false
98
93
  required_rubygems_version: !ruby/object:Gem::Requirement
99
94
  requirements:
100
95
  - - ! '>='
101
96
  - !ruby/object:Gem::Version
102
97
  version: '0'
103
- none: false
104
98
  requirements: []
105
99
  rubyforge_project:
106
- rubygems_version: 1.8.23
100
+ rubygems_version: 2.0.3
107
101
  signing_key:
108
- specification_version: 3
102
+ specification_version: 4
109
103
  summary: Use jQuery File Upload plugin with Rails 3
110
104
  test_files: []