mechanize-store 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/README.rdoc +4 -2
- data/app/assets/javascripts/mechanize_store/sb-admin/jquery-file-upload/canvas-to-blob.min.js +1 -0
- data/app/assets/javascripts/mechanize_store/sb-admin/jquery-file-upload/jquery.blueimp-gallery.min.js +1 -0
- data/app/assets/javascripts/mechanize_store/sb-admin/jquery-file-upload/jquery.fileupload-angular.js +429 -0
- data/app/assets/javascripts/mechanize_store/sb-admin/jquery-file-upload/jquery.fileupload-audio.js +106 -0
- data/app/assets/javascripts/mechanize_store/sb-admin/jquery-file-upload/jquery.fileupload-image.js +309 -0
- data/app/assets/javascripts/mechanize_store/sb-admin/jquery-file-upload/jquery.fileupload-jquery-ui.js +152 -0
- data/app/assets/javascripts/mechanize_store/sb-admin/jquery-file-upload/jquery.fileupload-process.js +172 -0
- data/app/assets/javascripts/mechanize_store/sb-admin/jquery-file-upload/jquery.fileupload-ui.js +699 -0
- data/app/assets/javascripts/mechanize_store/sb-admin/jquery-file-upload/jquery.fileupload-validate.js +119 -0
- data/app/assets/javascripts/mechanize_store/sb-admin/jquery-file-upload/jquery.fileupload-video.js +106 -0
- data/app/assets/javascripts/mechanize_store/sb-admin/jquery-file-upload/jquery.fileupload.js +1426 -0
- data/app/assets/javascripts/mechanize_store/sb-admin/jquery-file-upload/jquery.iframe-transport.js +214 -0
- data/app/assets/javascripts/mechanize_store/sb-admin/jquery-file-upload/jquery.ui.widget.js +530 -0
- data/app/assets/javascripts/mechanize_store/sb-admin/jquery-file-upload/load-image.min.js +1 -0
- data/app/assets/javascripts/mechanize_store/sb-admin/jquery-file-upload/main.js +14 -0
- data/app/assets/javascripts/mechanize_store/sb-admin/jquery-file-upload/tmpl.min.js +1 -0
- data/app/assets/stylesheets/mechanize_store/application.css +0 -2
- data/app/assets/stylesheets/mechanize_store/sb-admin/sb-admin.css +2 -2
- data/app/controllers/mechanize_store/product_photos_controller.rb +49 -0
- data/app/models/mechanize_store/product.rb +4 -3
- data/app/models/mechanize_store/product_photo.rb +11 -0
- data/app/views/layouts/{store → mechanize_store}/application.html.erb +38 -2
- data/app/views/mechanize_store/flags/_form.html.erb +1 -1
- data/app/views/mechanize_store/flags/index.html.erb +2 -2
- data/app/views/mechanize_store/order_statuses/_form.html.erb +6 -6
- data/app/views/mechanize_store/order_statuses/index.html.erb +3 -3
- data/app/views/mechanize_store/orders/index.html.erb +5 -5
- data/app/views/mechanize_store/payment_statuses/_form.html.erb +1 -1
- data/app/views/mechanize_store/payment_statuses/index.html.erb +3 -3
- data/app/views/mechanize_store/payment_types/_form.html.erb +6 -6
- data/app/views/mechanize_store/payment_types/index.html.erb +2 -2
- data/app/views/mechanize_store/product_categories/index.html.erb +4 -6
- data/app/views/mechanize_store/product_photos/create.json.jbuilder +9 -0
- data/app/views/mechanize_store/product_photos/index.json.jbuilder +9 -0
- data/app/views/mechanize_store/products/_form.html.erb +1 -1
- data/app/views/mechanize_store/products/index.html.erb +1 -1
- data/app/views/mechanize_store/products/show.html.erb +186 -32
- data/config/locales/store.pt-BR.yml +54 -11
- data/config/routes.rb +3 -2
- data/db/migrate/20140402153139_create_mechanize_store_orders.rb +1 -1
- data/lib/mechanize_store/version.rb +1 -1
- metadata +108 -7
- data/app/models/mechanize_store/store.rb +0 -5
- data/db/migrate/20140402141340_create_mechanize_store_stores.rb +0 -12
data/app/assets/javascripts/mechanize_store/sb-admin/jquery-file-upload/jquery.fileupload-audio.js
ADDED
@@ -0,0 +1,106 @@
|
|
1
|
+
/*
|
2
|
+
* jQuery File Upload Audio Preview Plugin 1.0.3
|
3
|
+
* https://github.com/blueimp/jQuery-File-Upload
|
4
|
+
*
|
5
|
+
* Copyright 2013, Sebastian Tschan
|
6
|
+
* https://blueimp.net
|
7
|
+
*
|
8
|
+
* Licensed under the MIT license:
|
9
|
+
* http://www.opensource.org/licenses/MIT
|
10
|
+
*/
|
11
|
+
|
12
|
+
/* jshint nomen:false */
|
13
|
+
/* global define, window, document */
|
14
|
+
|
15
|
+
(function (factory) {
|
16
|
+
'use strict';
|
17
|
+
if (typeof define === 'function' && define.amd) {
|
18
|
+
// Register as an anonymous AMD module:
|
19
|
+
define([
|
20
|
+
'jquery',
|
21
|
+
'load-image',
|
22
|
+
'./jquery.fileupload-process'
|
23
|
+
], factory);
|
24
|
+
} else {
|
25
|
+
// Browser globals:
|
26
|
+
factory(
|
27
|
+
window.jQuery,
|
28
|
+
window.loadImage
|
29
|
+
);
|
30
|
+
}
|
31
|
+
}(function ($, loadImage) {
|
32
|
+
'use strict';
|
33
|
+
|
34
|
+
// Prepend to the default processQueue:
|
35
|
+
$.blueimp.fileupload.prototype.options.processQueue.unshift(
|
36
|
+
{
|
37
|
+
action: 'loadAudio',
|
38
|
+
// Use the action as prefix for the "@" options:
|
39
|
+
prefix: true,
|
40
|
+
fileTypes: '@',
|
41
|
+
maxFileSize: '@',
|
42
|
+
disabled: '@disableAudioPreview'
|
43
|
+
},
|
44
|
+
{
|
45
|
+
action: 'setAudio',
|
46
|
+
name: '@audioPreviewName',
|
47
|
+
disabled: '@disableAudioPreview'
|
48
|
+
}
|
49
|
+
);
|
50
|
+
|
51
|
+
// The File Upload Audio Preview plugin extends the fileupload widget
|
52
|
+
// with audio preview functionality:
|
53
|
+
$.widget('blueimp.fileupload', $.blueimp.fileupload, {
|
54
|
+
|
55
|
+
options: {
|
56
|
+
// The regular expression for the types of audio files to load,
|
57
|
+
// matched against the file type:
|
58
|
+
loadAudioFileTypes: /^audio\/.*$/
|
59
|
+
},
|
60
|
+
|
61
|
+
_audioElement: document.createElement('audio'),
|
62
|
+
|
63
|
+
processActions: {
|
64
|
+
|
65
|
+
// Loads the audio file given via data.files and data.index
|
66
|
+
// as audio element if the browser supports playing it.
|
67
|
+
// Accepts the options fileTypes (regular expression)
|
68
|
+
// and maxFileSize (integer) to limit the files to load:
|
69
|
+
loadAudio: function (data, options) {
|
70
|
+
if (options.disabled) {
|
71
|
+
return data;
|
72
|
+
}
|
73
|
+
var file = data.files[data.index],
|
74
|
+
url,
|
75
|
+
audio;
|
76
|
+
if (this._audioElement.canPlayType &&
|
77
|
+
this._audioElement.canPlayType(file.type) &&
|
78
|
+
($.type(options.maxFileSize) !== 'number' ||
|
79
|
+
file.size <= options.maxFileSize) &&
|
80
|
+
(!options.fileTypes ||
|
81
|
+
options.fileTypes.test(file.type))) {
|
82
|
+
url = loadImage.createObjectURL(file);
|
83
|
+
if (url) {
|
84
|
+
audio = this._audioElement.cloneNode(false);
|
85
|
+
audio.src = url;
|
86
|
+
audio.controls = true;
|
87
|
+
data.audio = audio;
|
88
|
+
return data;
|
89
|
+
}
|
90
|
+
}
|
91
|
+
return data;
|
92
|
+
},
|
93
|
+
|
94
|
+
// Sets the audio element as a property of the file object:
|
95
|
+
setAudio: function (data, options) {
|
96
|
+
if (data.audio && !options.disabled) {
|
97
|
+
data.files[data.index][options.name || 'preview'] = data.audio;
|
98
|
+
}
|
99
|
+
return data;
|
100
|
+
}
|
101
|
+
|
102
|
+
}
|
103
|
+
|
104
|
+
});
|
105
|
+
|
106
|
+
}));
|
data/app/assets/javascripts/mechanize_store/sb-admin/jquery-file-upload/jquery.fileupload-image.js
ADDED
@@ -0,0 +1,309 @@
|
|
1
|
+
/*
|
2
|
+
* jQuery File Upload Image Preview & Resize Plugin 1.7.1
|
3
|
+
* https://github.com/blueimp/jQuery-File-Upload
|
4
|
+
*
|
5
|
+
* Copyright 2013, Sebastian Tschan
|
6
|
+
* https://blueimp.net
|
7
|
+
*
|
8
|
+
* Licensed under the MIT license:
|
9
|
+
* http://www.opensource.org/licenses/MIT
|
10
|
+
*/
|
11
|
+
|
12
|
+
/* jshint nomen:false */
|
13
|
+
/* global define, window, Blob */
|
14
|
+
|
15
|
+
(function (factory) {
|
16
|
+
'use strict';
|
17
|
+
if (typeof define === 'function' && define.amd) {
|
18
|
+
// Register as an anonymous AMD module:
|
19
|
+
define([
|
20
|
+
'jquery',
|
21
|
+
'load-image',
|
22
|
+
'load-image-meta',
|
23
|
+
'load-image-exif',
|
24
|
+
'load-image-ios',
|
25
|
+
'canvas-to-blob',
|
26
|
+
'./jquery.fileupload-process'
|
27
|
+
], factory);
|
28
|
+
} else {
|
29
|
+
// Browser globals:
|
30
|
+
factory(
|
31
|
+
window.jQuery,
|
32
|
+
window.loadImage
|
33
|
+
);
|
34
|
+
}
|
35
|
+
}(function ($, loadImage) {
|
36
|
+
'use strict';
|
37
|
+
|
38
|
+
// Prepend to the default processQueue:
|
39
|
+
$.blueimp.fileupload.prototype.options.processQueue.unshift(
|
40
|
+
{
|
41
|
+
action: 'loadImageMetaData',
|
42
|
+
disableImageHead: '@',
|
43
|
+
disableExif: '@',
|
44
|
+
disableExifThumbnail: '@',
|
45
|
+
disableExifSub: '@',
|
46
|
+
disableExifGps: '@',
|
47
|
+
disabled: '@disableImageMetaDataLoad'
|
48
|
+
},
|
49
|
+
{
|
50
|
+
action: 'loadImage',
|
51
|
+
// Use the action as prefix for the "@" options:
|
52
|
+
prefix: true,
|
53
|
+
fileTypes: '@',
|
54
|
+
maxFileSize: '@',
|
55
|
+
noRevoke: '@',
|
56
|
+
disabled: '@disableImageLoad'
|
57
|
+
},
|
58
|
+
{
|
59
|
+
action: 'resizeImage',
|
60
|
+
// Use "image" as prefix for the "@" options:
|
61
|
+
prefix: 'image',
|
62
|
+
maxWidth: '@',
|
63
|
+
maxHeight: '@',
|
64
|
+
minWidth: '@',
|
65
|
+
minHeight: '@',
|
66
|
+
crop: '@',
|
67
|
+
orientation: '@',
|
68
|
+
forceResize: '@',
|
69
|
+
disabled: '@disableImageResize'
|
70
|
+
},
|
71
|
+
{
|
72
|
+
action: 'saveImage',
|
73
|
+
quality: '@imageQuality',
|
74
|
+
type: '@imageType',
|
75
|
+
disabled: '@disableImageResize'
|
76
|
+
},
|
77
|
+
{
|
78
|
+
action: 'saveImageMetaData',
|
79
|
+
disabled: '@disableImageMetaDataSave'
|
80
|
+
},
|
81
|
+
{
|
82
|
+
action: 'resizeImage',
|
83
|
+
// Use "preview" as prefix for the "@" options:
|
84
|
+
prefix: 'preview',
|
85
|
+
maxWidth: '@',
|
86
|
+
maxHeight: '@',
|
87
|
+
minWidth: '@',
|
88
|
+
minHeight: '@',
|
89
|
+
crop: '@',
|
90
|
+
orientation: '@',
|
91
|
+
thumbnail: '@',
|
92
|
+
canvas: '@',
|
93
|
+
disabled: '@disableImagePreview'
|
94
|
+
},
|
95
|
+
{
|
96
|
+
action: 'setImage',
|
97
|
+
name: '@imagePreviewName',
|
98
|
+
disabled: '@disableImagePreview'
|
99
|
+
},
|
100
|
+
{
|
101
|
+
action: 'deleteImageReferences',
|
102
|
+
disabled: '@disableImageReferencesDeletion'
|
103
|
+
}
|
104
|
+
);
|
105
|
+
|
106
|
+
// The File Upload Resize plugin extends the fileupload widget
|
107
|
+
// with image resize functionality:
|
108
|
+
$.widget('blueimp.fileupload', $.blueimp.fileupload, {
|
109
|
+
|
110
|
+
options: {
|
111
|
+
// The regular expression for the types of images to load:
|
112
|
+
// matched against the file type:
|
113
|
+
loadImageFileTypes: /^image\/(gif|jpeg|png|svg\+xml)$/,
|
114
|
+
// The maximum file size of images to load:
|
115
|
+
loadImageMaxFileSize: 10000000, // 10MB
|
116
|
+
// The maximum width of resized images:
|
117
|
+
imageMaxWidth: 1920,
|
118
|
+
// The maximum height of resized images:
|
119
|
+
imageMaxHeight: 1080,
|
120
|
+
// Defines the image orientation (1-8) or takes the orientation
|
121
|
+
// value from Exif data if set to true:
|
122
|
+
imageOrientation: false,
|
123
|
+
// Define if resized images should be cropped or only scaled:
|
124
|
+
imageCrop: false,
|
125
|
+
// Disable the resize image functionality by default:
|
126
|
+
disableImageResize: true,
|
127
|
+
// The maximum width of the preview images:
|
128
|
+
previewMaxWidth: 80,
|
129
|
+
// The maximum height of the preview images:
|
130
|
+
previewMaxHeight: 80,
|
131
|
+
// Defines the preview orientation (1-8) or takes the orientation
|
132
|
+
// value from Exif data if set to true:
|
133
|
+
previewOrientation: true,
|
134
|
+
// Create the preview using the Exif data thumbnail:
|
135
|
+
previewThumbnail: true,
|
136
|
+
// Define if preview images should be cropped or only scaled:
|
137
|
+
previewCrop: false,
|
138
|
+
// Define if preview images should be resized as canvas elements:
|
139
|
+
previewCanvas: true
|
140
|
+
},
|
141
|
+
|
142
|
+
processActions: {
|
143
|
+
|
144
|
+
// Loads the image given via data.files and data.index
|
145
|
+
// as img element, if the browser supports the File API.
|
146
|
+
// Accepts the options fileTypes (regular expression)
|
147
|
+
// and maxFileSize (integer) to limit the files to load:
|
148
|
+
loadImage: function (data, options) {
|
149
|
+
if (options.disabled) {
|
150
|
+
return data;
|
151
|
+
}
|
152
|
+
var that = this,
|
153
|
+
file = data.files[data.index],
|
154
|
+
dfd = $.Deferred();
|
155
|
+
if (($.type(options.maxFileSize) === 'number' &&
|
156
|
+
file.size > options.maxFileSize) ||
|
157
|
+
(options.fileTypes &&
|
158
|
+
!options.fileTypes.test(file.type)) ||
|
159
|
+
!loadImage(
|
160
|
+
file,
|
161
|
+
function (img) {
|
162
|
+
if (img.src) {
|
163
|
+
data.img = img;
|
164
|
+
}
|
165
|
+
dfd.resolveWith(that, [data]);
|
166
|
+
},
|
167
|
+
options
|
168
|
+
)) {
|
169
|
+
return data;
|
170
|
+
}
|
171
|
+
return dfd.promise();
|
172
|
+
},
|
173
|
+
|
174
|
+
// Resizes the image given as data.canvas or data.img
|
175
|
+
// and updates data.canvas or data.img with the resized image.
|
176
|
+
// Also stores the resized image as preview property.
|
177
|
+
// Accepts the options maxWidth, maxHeight, minWidth,
|
178
|
+
// minHeight, canvas and crop:
|
179
|
+
resizeImage: function (data, options) {
|
180
|
+
if (options.disabled || !(data.canvas || data.img)) {
|
181
|
+
return data;
|
182
|
+
}
|
183
|
+
options = $.extend({canvas: true}, options);
|
184
|
+
var that = this,
|
185
|
+
dfd = $.Deferred(),
|
186
|
+
img = (options.canvas && data.canvas) || data.img,
|
187
|
+
resolve = function (newImg) {
|
188
|
+
if (newImg && (newImg.width !== img.width ||
|
189
|
+
newImg.height !== img.height ||
|
190
|
+
options.forceResize)) {
|
191
|
+
data[newImg.getContext ? 'canvas' : 'img'] = newImg;
|
192
|
+
}
|
193
|
+
data.preview = newImg;
|
194
|
+
dfd.resolveWith(that, [data]);
|
195
|
+
},
|
196
|
+
thumbnail;
|
197
|
+
if (data.exif) {
|
198
|
+
if (options.orientation === true) {
|
199
|
+
options.orientation = data.exif.get('Orientation');
|
200
|
+
}
|
201
|
+
if (options.thumbnail) {
|
202
|
+
thumbnail = data.exif.get('Thumbnail');
|
203
|
+
if (thumbnail) {
|
204
|
+
loadImage(thumbnail, resolve, options);
|
205
|
+
return dfd.promise();
|
206
|
+
}
|
207
|
+
}
|
208
|
+
}
|
209
|
+
if (img) {
|
210
|
+
resolve(loadImage.scale(img, options));
|
211
|
+
return dfd.promise();
|
212
|
+
}
|
213
|
+
return data;
|
214
|
+
},
|
215
|
+
|
216
|
+
// Saves the processed image given as data.canvas
|
217
|
+
// inplace at data.index of data.files:
|
218
|
+
saveImage: function (data, options) {
|
219
|
+
if (!data.canvas || options.disabled) {
|
220
|
+
return data;
|
221
|
+
}
|
222
|
+
var that = this,
|
223
|
+
file = data.files[data.index],
|
224
|
+
dfd = $.Deferred();
|
225
|
+
if (data.canvas.toBlob) {
|
226
|
+
data.canvas.toBlob(
|
227
|
+
function (blob) {
|
228
|
+
if (!blob.name) {
|
229
|
+
if (file.type === blob.type) {
|
230
|
+
blob.name = file.name;
|
231
|
+
} else if (file.name) {
|
232
|
+
blob.name = file.name.replace(
|
233
|
+
/\..+$/,
|
234
|
+
'.' + blob.type.substr(6)
|
235
|
+
);
|
236
|
+
}
|
237
|
+
}
|
238
|
+
// Don't restore invalid meta data:
|
239
|
+
if (file.type !== blob.type) {
|
240
|
+
delete data.imageHead;
|
241
|
+
}
|
242
|
+
// Store the created blob at the position
|
243
|
+
// of the original file in the files list:
|
244
|
+
data.files[data.index] = blob;
|
245
|
+
dfd.resolveWith(that, [data]);
|
246
|
+
},
|
247
|
+
options.type || file.type,
|
248
|
+
options.quality
|
249
|
+
);
|
250
|
+
} else {
|
251
|
+
return data;
|
252
|
+
}
|
253
|
+
return dfd.promise();
|
254
|
+
},
|
255
|
+
|
256
|
+
loadImageMetaData: function (data, options) {
|
257
|
+
if (options.disabled) {
|
258
|
+
return data;
|
259
|
+
}
|
260
|
+
var that = this,
|
261
|
+
dfd = $.Deferred();
|
262
|
+
loadImage.parseMetaData(data.files[data.index], function (result) {
|
263
|
+
$.extend(data, result);
|
264
|
+
dfd.resolveWith(that, [data]);
|
265
|
+
}, options);
|
266
|
+
return dfd.promise();
|
267
|
+
},
|
268
|
+
|
269
|
+
saveImageMetaData: function (data, options) {
|
270
|
+
if (!(data.imageHead && data.canvas &&
|
271
|
+
data.canvas.toBlob && !options.disabled)) {
|
272
|
+
return data;
|
273
|
+
}
|
274
|
+
var file = data.files[data.index],
|
275
|
+
blob = new Blob([
|
276
|
+
data.imageHead,
|
277
|
+
// Resized images always have a head size of 20 bytes,
|
278
|
+
// including the JPEG marker and a minimal JFIF header:
|
279
|
+
this._blobSlice.call(file, 20)
|
280
|
+
], {type: file.type});
|
281
|
+
blob.name = file.name;
|
282
|
+
data.files[data.index] = blob;
|
283
|
+
return data;
|
284
|
+
},
|
285
|
+
|
286
|
+
// Sets the resized version of the image as a property of the
|
287
|
+
// file object, must be called after "saveImage":
|
288
|
+
setImage: function (data, options) {
|
289
|
+
if (data.preview && !options.disabled) {
|
290
|
+
data.files[data.index][options.name || 'preview'] = data.preview;
|
291
|
+
}
|
292
|
+
return data;
|
293
|
+
},
|
294
|
+
|
295
|
+
deleteImageReferences: function (data, options) {
|
296
|
+
if (!options.disabled) {
|
297
|
+
delete data.img;
|
298
|
+
delete data.canvas;
|
299
|
+
delete data.preview;
|
300
|
+
delete data.imageHead;
|
301
|
+
}
|
302
|
+
return data;
|
303
|
+
}
|
304
|
+
|
305
|
+
}
|
306
|
+
|
307
|
+
});
|
308
|
+
|
309
|
+
}));
|
@@ -0,0 +1,152 @@
|
|
1
|
+
/*
|
2
|
+
* jQuery File Upload jQuery UI Plugin 8.7.1
|
3
|
+
* https://github.com/blueimp/jQuery-File-Upload
|
4
|
+
*
|
5
|
+
* Copyright 2013, Sebastian Tschan
|
6
|
+
* https://blueimp.net
|
7
|
+
*
|
8
|
+
* Licensed under the MIT license:
|
9
|
+
* http://www.opensource.org/licenses/MIT
|
10
|
+
*/
|
11
|
+
|
12
|
+
/* jshint nomen:false */
|
13
|
+
/* global define, window */
|
14
|
+
|
15
|
+
(function (factory) {
|
16
|
+
'use strict';
|
17
|
+
if (typeof define === 'function' && define.amd) {
|
18
|
+
// Register as an anonymous AMD module:
|
19
|
+
define(['jquery', './jquery.fileupload-ui'], factory);
|
20
|
+
} else {
|
21
|
+
// Browser globals:
|
22
|
+
factory(window.jQuery);
|
23
|
+
}
|
24
|
+
}(function ($) {
|
25
|
+
'use strict';
|
26
|
+
|
27
|
+
$.widget('blueimp.fileupload', $.blueimp.fileupload, {
|
28
|
+
|
29
|
+
options: {
|
30
|
+
processdone: function (e, data) {
|
31
|
+
data.context.find('.start').button('enable');
|
32
|
+
},
|
33
|
+
progress: function (e, data) {
|
34
|
+
if (data.context) {
|
35
|
+
data.context.find('.progress').progressbar(
|
36
|
+
'option',
|
37
|
+
'value',
|
38
|
+
parseInt(data.loaded / data.total * 100, 10)
|
39
|
+
);
|
40
|
+
}
|
41
|
+
},
|
42
|
+
progressall: function (e, data) {
|
43
|
+
var $this = $(this);
|
44
|
+
$this.find('.fileupload-progress')
|
45
|
+
.find('.progress').progressbar(
|
46
|
+
'option',
|
47
|
+
'value',
|
48
|
+
parseInt(data.loaded / data.total * 100, 10)
|
49
|
+
).end()
|
50
|
+
.find('.progress-extended').each(function () {
|
51
|
+
$(this).html(
|
52
|
+
($this.data('blueimp-fileupload') ||
|
53
|
+
$this.data('fileupload'))
|
54
|
+
._renderExtendedProgress(data)
|
55
|
+
);
|
56
|
+
});
|
57
|
+
}
|
58
|
+
},
|
59
|
+
|
60
|
+
_renderUpload: function (func, files) {
|
61
|
+
var node = this._super(func, files),
|
62
|
+
showIconText = $(window).width() > 480;
|
63
|
+
node.find('.progress').empty().progressbar();
|
64
|
+
node.find('.start').button({
|
65
|
+
icons: {primary: 'ui-icon-circle-arrow-e'},
|
66
|
+
text: showIconText
|
67
|
+
});
|
68
|
+
node.find('.cancel').button({
|
69
|
+
icons: {primary: 'ui-icon-cancel'},
|
70
|
+
text: showIconText
|
71
|
+
});
|
72
|
+
if (node.hasClass('fade')) {
|
73
|
+
node.hide();
|
74
|
+
}
|
75
|
+
return node;
|
76
|
+
},
|
77
|
+
|
78
|
+
_renderDownload: function (func, files) {
|
79
|
+
var node = this._super(func, files),
|
80
|
+
showIconText = $(window).width() > 480;
|
81
|
+
node.find('.delete').button({
|
82
|
+
icons: {primary: 'ui-icon-trash'},
|
83
|
+
text: showIconText
|
84
|
+
});
|
85
|
+
if (node.hasClass('fade')) {
|
86
|
+
node.hide();
|
87
|
+
}
|
88
|
+
return node;
|
89
|
+
},
|
90
|
+
|
91
|
+
_startHandler: function (e) {
|
92
|
+
$(e.currentTarget).button('disable');
|
93
|
+
this._super(e);
|
94
|
+
},
|
95
|
+
|
96
|
+
_transition: function (node) {
|
97
|
+
var deferred = $.Deferred();
|
98
|
+
if (node.hasClass('fade')) {
|
99
|
+
node.fadeToggle(
|
100
|
+
this.options.transitionDuration,
|
101
|
+
this.options.transitionEasing,
|
102
|
+
function () {
|
103
|
+
deferred.resolveWith(node);
|
104
|
+
}
|
105
|
+
);
|
106
|
+
} else {
|
107
|
+
deferred.resolveWith(node);
|
108
|
+
}
|
109
|
+
return deferred;
|
110
|
+
},
|
111
|
+
|
112
|
+
_create: function () {
|
113
|
+
this._super();
|
114
|
+
this.element
|
115
|
+
.find('.fileupload-buttonbar')
|
116
|
+
.find('.fileinput-button').each(function () {
|
117
|
+
var input = $(this).find('input:file').detach();
|
118
|
+
$(this)
|
119
|
+
.button({icons: {primary: 'ui-icon-plusthick'}})
|
120
|
+
.append(input);
|
121
|
+
})
|
122
|
+
.end().find('.start')
|
123
|
+
.button({icons: {primary: 'ui-icon-circle-arrow-e'}})
|
124
|
+
.end().find('.cancel')
|
125
|
+
.button({icons: {primary: 'ui-icon-cancel'}})
|
126
|
+
.end().find('.delete')
|
127
|
+
.button({icons: {primary: 'ui-icon-trash'}})
|
128
|
+
.end().find('.progress').progressbar();
|
129
|
+
},
|
130
|
+
|
131
|
+
_destroy: function () {
|
132
|
+
this.element
|
133
|
+
.find('.fileupload-buttonbar')
|
134
|
+
.find('.fileinput-button').each(function () {
|
135
|
+
var input = $(this).find('input:file').detach();
|
136
|
+
$(this)
|
137
|
+
.button('destroy')
|
138
|
+
.append(input);
|
139
|
+
})
|
140
|
+
.end().find('.start')
|
141
|
+
.button('destroy')
|
142
|
+
.end().find('.cancel')
|
143
|
+
.button('destroy')
|
144
|
+
.end().find('.delete')
|
145
|
+
.button('destroy')
|
146
|
+
.end().find('.progress').progressbar('destroy');
|
147
|
+
this._super();
|
148
|
+
}
|
149
|
+
|
150
|
+
});
|
151
|
+
|
152
|
+
}));
|