bootstrap-filestyle-rails 1.1.0 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ad66b3f52a0655168b4fb62cd1546e31da11cd1e
|
4
|
+
data.tar.gz: 86346109edf0e55dbde44f2248c96ee6cbd7d881
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 07c311a3bf040958a696432e8c7e80673ea373170baac3f6b659d2bdcaf84df9cc14e2c94828201ad7e9042aec6d78401b4656162f5ba7c7ad1e80abe8607a08
|
7
|
+
data.tar.gz: 82c04c170ceb9a1436a0251f50d68a7f7adb6b2a9a685db3b2fd2c00970d88f08ee95f18edf2a42730d952d7053705b74f98b18c770381dc2d4acb58bc4d3ef9
|
@@ -4,21 +4,21 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
require 'bootstrap-filestyle-rails/version'
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
|
-
spec.name =
|
7
|
+
spec.name = 'bootstrap-filestyle-rails'
|
8
8
|
spec.version = BootstrapFilestyleRails::VERSION
|
9
|
-
spec.authors = [
|
10
|
-
spec.email = [
|
9
|
+
spec.authors = ['Mauricio Pasquier Juan']
|
10
|
+
spec.email = ['mauricio@pasquierjuan.com.ar']
|
11
11
|
spec.description = %Q{Bootstrap Filestyle (gem version reflects assets
|
12
12
|
version) packaged for rails}
|
13
13
|
spec.summary = %q{Bootstrap Filestyle for the asset pipeline}
|
14
|
-
spec.homepage =
|
15
|
-
spec.license =
|
14
|
+
spec.homepage = 'https://github.com/mauriciopasquier/bootstrap-filestyle-rails'
|
15
|
+
spec.license = 'MIT'
|
16
16
|
|
17
17
|
spec.files = `git ls-files`.split($/)
|
18
18
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
19
19
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
20
|
-
spec.require_paths = [
|
20
|
+
spec.require_paths = ['lib']
|
21
21
|
|
22
|
-
spec.add_development_dependency
|
23
|
-
spec.add_development_dependency
|
22
|
+
spec.add_development_dependency 'bundler', '~> 1.3'
|
23
|
+
spec.add_development_dependency 'rake'
|
24
24
|
end
|
@@ -1,13 +1,11 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require 'rails'
|
2
|
+
require 'bootstrap-filestyle-rails/version'
|
3
3
|
|
4
|
-
#
|
4
|
+
# Public: Adds bootstrap-filestyle to the rails asset pipeline.
|
5
5
|
module BootstrapFilestyleRails
|
6
|
-
|
7
|
-
|
8
|
-
require "bootstrap-filestyle-rails/railtie"
|
6
|
+
if ::Rails.version.to_s < '3.1'
|
7
|
+
require 'bootstrap-filestyle-rails/railtie'
|
9
8
|
else
|
10
|
-
require
|
9
|
+
require 'bootstrap-filestyle-rails/engine'
|
11
10
|
end
|
12
|
-
|
13
11
|
end
|
@@ -1,373 +1,338 @@
|
|
1
1
|
/*
|
2
2
|
* bootstrap-filestyle
|
3
|
-
* doc: http://
|
3
|
+
* doc: http://markusslima.github.io/bootstrap-filestyle/
|
4
4
|
* github: https://github.com/markusslima/bootstrap-filestyle
|
5
5
|
*
|
6
6
|
* Copyright (c) 2014 Markus Vinicius da Silva Lima
|
7
|
-
* Version 1.1.
|
7
|
+
* Version 1.1.2
|
8
8
|
* Licensed under the MIT license.
|
9
9
|
*/
|
10
|
-
(function
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
$.fn.filestyle.defaults = {
|
339
|
-
'buttonText': 'Choose file',
|
340
|
-
'iconName': 'glyphicon-folder-open',
|
341
|
-
'buttonName': 'btn-default',
|
342
|
-
'size': 'nr',
|
343
|
-
'input': true,
|
344
|
-
'icon': true,
|
345
|
-
'buttonBefore': false,
|
346
|
-
'disabled': false
|
347
|
-
};
|
348
|
-
|
349
|
-
$.fn.filestyle.noConflict = function () {
|
350
|
-
$.fn.filestyle = old;
|
351
|
-
return this;
|
352
|
-
};
|
353
|
-
|
354
|
-
// Data attributes register
|
355
|
-
$(function() {
|
356
|
-
$('.filestyle').each(function () {
|
357
|
-
var $this = $(this),
|
358
|
-
options = {
|
359
|
-
|
360
|
-
'input': $this.attr('data-input') === 'false' ? false : true,
|
361
|
-
'icon': $this.attr('data-icon') === 'false' ? false : true,
|
362
|
-
'buttonBefore': $this.attr('data-buttonBefore') === 'true' ? true : false,
|
363
|
-
'disabled': $this.attr('data-disabled') === 'true' ? true : false,
|
364
|
-
'size': $this.attr('data-size'),
|
365
|
-
'buttonText': $this.attr('data-buttonText'),
|
366
|
-
'buttonName': $this.attr('data-buttonName'),
|
367
|
-
'iconName': $this.attr('data-iconName')
|
368
|
-
};
|
369
|
-
|
370
|
-
$this.filestyle(options);
|
371
|
-
});
|
372
|
-
});
|
10
|
+
(function($) {"use strict";
|
11
|
+
|
12
|
+
var Filestyle = function(element, options) {
|
13
|
+
this.options = options;
|
14
|
+
this.$elementFilestyle = [];
|
15
|
+
this.$element = $(element);
|
16
|
+
};
|
17
|
+
|
18
|
+
Filestyle.prototype = {
|
19
|
+
clear : function() {
|
20
|
+
this.$element.val('');
|
21
|
+
this.$elementFilestyle.find(':text').val('');
|
22
|
+
this.$elementFilestyle.find('.badge').remove();
|
23
|
+
},
|
24
|
+
|
25
|
+
destroy : function() {
|
26
|
+
this.$element.removeAttr('style').removeData('filestyle').val('');
|
27
|
+
this.$elementFilestyle.remove();
|
28
|
+
},
|
29
|
+
|
30
|
+
disabled : function(value) {
|
31
|
+
if (value === true) {
|
32
|
+
if (!this.options.disabled) {
|
33
|
+
this.$element.attr('disabled', 'true');
|
34
|
+
this.$elementFilestyle.find('label').attr('disabled', 'true');
|
35
|
+
this.options.disabled = true;
|
36
|
+
}
|
37
|
+
} else if (value === false) {
|
38
|
+
if (this.options.disabled) {
|
39
|
+
this.$element.removeAttr('disabled');
|
40
|
+
this.$elementFilestyle.find('label').removeAttr('disabled');
|
41
|
+
this.options.disabled = false;
|
42
|
+
}
|
43
|
+
} else {
|
44
|
+
return this.options.disabled;
|
45
|
+
}
|
46
|
+
},
|
47
|
+
|
48
|
+
buttonBefore : function(value) {
|
49
|
+
if (value === true) {
|
50
|
+
if (!this.options.buttonBefore) {
|
51
|
+
this.options.buttonBefore = true;
|
52
|
+
if (this.options.input) {
|
53
|
+
this.$elementFilestyle.remove();
|
54
|
+
this.constructor();
|
55
|
+
this.pushNameFiles();
|
56
|
+
}
|
57
|
+
}
|
58
|
+
} else if (value === false) {
|
59
|
+
if (this.options.buttonBefore) {
|
60
|
+
this.options.buttonBefore = false;
|
61
|
+
if (this.options.input) {
|
62
|
+
this.$elementFilestyle.remove();
|
63
|
+
this.constructor();
|
64
|
+
this.pushNameFiles();
|
65
|
+
}
|
66
|
+
}
|
67
|
+
} else {
|
68
|
+
return this.options.buttonBefore;
|
69
|
+
}
|
70
|
+
},
|
71
|
+
|
72
|
+
icon : function(value) {
|
73
|
+
if (value === true) {
|
74
|
+
if (!this.options.icon) {
|
75
|
+
this.options.icon = true;
|
76
|
+
this.$elementFilestyle.find('label').prepend(this.htmlIcon());
|
77
|
+
}
|
78
|
+
} else if (value === false) {
|
79
|
+
if (this.options.icon) {
|
80
|
+
this.options.icon = false;
|
81
|
+
this.$elementFilestyle.find('.glyphicon').remove();
|
82
|
+
}
|
83
|
+
} else {
|
84
|
+
return this.options.icon;
|
85
|
+
}
|
86
|
+
},
|
87
|
+
|
88
|
+
input : function(value) {
|
89
|
+
if (value === true) {
|
90
|
+
if (!this.options.input) {
|
91
|
+
this.options.input = true;
|
92
|
+
|
93
|
+
if (this.options.buttonBefore) {
|
94
|
+
this.$elementFilestyle.append(this.htmlInput());
|
95
|
+
} else {
|
96
|
+
this.$elementFilestyle.prepend(this.htmlInput());
|
97
|
+
}
|
98
|
+
|
99
|
+
this.$elementFilestyle.find('.badge').remove();
|
100
|
+
|
101
|
+
this.pushNameFiles();
|
102
|
+
|
103
|
+
this.$elementFilestyle.find('.group-span-filestyle').addClass('input-group-btn');
|
104
|
+
}
|
105
|
+
} else if (value === false) {
|
106
|
+
if (this.options.input) {
|
107
|
+
this.options.input = false;
|
108
|
+
this.$elementFilestyle.find(':text').remove();
|
109
|
+
var files = this.pushNameFiles();
|
110
|
+
if (files.length > 0 && this.options.badge) {
|
111
|
+
this.$elementFilestyle.find('label').append(' <span class="badge">' + files.length + '</span>');
|
112
|
+
}
|
113
|
+
this.$elementFilestyle.find('.group-span-filestyle').removeClass('input-group-btn');
|
114
|
+
}
|
115
|
+
} else {
|
116
|
+
return this.options.input;
|
117
|
+
}
|
118
|
+
},
|
119
|
+
|
120
|
+
size : function(value) {
|
121
|
+
if (value !== undefined) {
|
122
|
+
var btn = this.$elementFilestyle.find('label'), input = this.$elementFilestyle.find('input');
|
123
|
+
|
124
|
+
btn.removeClass('btn-lg btn-sm');
|
125
|
+
input.removeClass('input-lg input-sm');
|
126
|
+
if (value != 'nr') {
|
127
|
+
btn.addClass('btn-' + value);
|
128
|
+
input.addClass('input-' + value);
|
129
|
+
}
|
130
|
+
} else {
|
131
|
+
return this.options.size;
|
132
|
+
}
|
133
|
+
},
|
134
|
+
|
135
|
+
buttonText : function(value) {
|
136
|
+
if (value !== undefined) {
|
137
|
+
this.options.buttonText = value;
|
138
|
+
this.$elementFilestyle.find('label span').html(this.options.buttonText);
|
139
|
+
} else {
|
140
|
+
return this.options.buttonText;
|
141
|
+
}
|
142
|
+
},
|
143
|
+
|
144
|
+
buttonName : function(value) {
|
145
|
+
if (value !== undefined) {
|
146
|
+
this.options.buttonName = value;
|
147
|
+
this.$elementFilestyle.find('label').attr({
|
148
|
+
'class' : 'btn ' + this.options.buttonName
|
149
|
+
});
|
150
|
+
} else {
|
151
|
+
return this.options.buttonName;
|
152
|
+
}
|
153
|
+
},
|
154
|
+
|
155
|
+
iconName : function(value) {
|
156
|
+
if (value !== undefined) {
|
157
|
+
this.$elementFilestyle.find('.glyphicon').attr({
|
158
|
+
'class' : '.glyphicon ' + this.options.iconName
|
159
|
+
});
|
160
|
+
} else {
|
161
|
+
return this.options.iconName;
|
162
|
+
}
|
163
|
+
},
|
164
|
+
|
165
|
+
htmlIcon : function() {
|
166
|
+
if (this.options.icon) {
|
167
|
+
return '<span class="glyphicon ' + this.options.iconName + '"></span> ';
|
168
|
+
} else {
|
169
|
+
return '';
|
170
|
+
}
|
171
|
+
},
|
172
|
+
|
173
|
+
htmlInput : function() {
|
174
|
+
if (this.options.input) {
|
175
|
+
return '<input type="text" class="form-control ' + (this.options.size == 'nr' ? '' : 'input-' + this.options.size) + '" disabled> ';
|
176
|
+
} else {
|
177
|
+
return '';
|
178
|
+
}
|
179
|
+
},
|
180
|
+
|
181
|
+
// puts the name of the input files
|
182
|
+
// return files
|
183
|
+
pushNameFiles : function() {
|
184
|
+
var content = '', files = [];
|
185
|
+
if (this.$element[0].files === undefined) {
|
186
|
+
files[0] = {
|
187
|
+
'name' : this.$element[0] && this.$element[0].value
|
188
|
+
};
|
189
|
+
} else {
|
190
|
+
files = this.$element[0].files;
|
191
|
+
}
|
192
|
+
|
193
|
+
for (var i = 0; i < files.length; i++) {
|
194
|
+
content += files[i].name.split("\\").pop() + ', ';
|
195
|
+
}
|
196
|
+
|
197
|
+
if (content !== '') {
|
198
|
+
this.$elementFilestyle.find(':text').val(content.replace(/\, $/g, ''));
|
199
|
+
} else {
|
200
|
+
this.$elementFilestyle.find(':text').val('');
|
201
|
+
}
|
202
|
+
|
203
|
+
return files;
|
204
|
+
},
|
205
|
+
|
206
|
+
constructor : function() {
|
207
|
+
var _self = this,
|
208
|
+
html = '',
|
209
|
+
id = _self.$element.attr('id'),
|
210
|
+
files = [],
|
211
|
+
btn = '',
|
212
|
+
$label;
|
213
|
+
|
214
|
+
if (id === '' || !id) {
|
215
|
+
id = 'filestyle-' + $('.bootstrap-filestyle').length;
|
216
|
+
_self.$element.attr({
|
217
|
+
'id' : id
|
218
|
+
});
|
219
|
+
}
|
220
|
+
|
221
|
+
btn = '<span class="group-span-filestyle ' + (_self.options.input ? 'input-group-btn' : '') + '">' +
|
222
|
+
'<label for="' + id + '" class="btn ' + _self.options.buttonName + ' ' +
|
223
|
+
(_self.options.size == 'nr' ? '' : 'btn-' + _self.options.size) + '" ' +
|
224
|
+
(_self.options.disabled ? 'disabled="true"' : '') + '>' +
|
225
|
+
_self.htmlIcon() + _self.options.buttonText +
|
226
|
+
'</label>' +
|
227
|
+
'</span>';
|
228
|
+
|
229
|
+
html = _self.options.buttonBefore ? btn + _self.htmlInput() : _self.htmlInput() + btn;
|
230
|
+
|
231
|
+
_self.$elementFilestyle = $('<div class="bootstrap-filestyle input-group">' + html + '</div>');
|
232
|
+
_self.$elementFilestyle.find('.group-span-filestyle').attr('tabindex', "0").keypress(function(e) {
|
233
|
+
if (e.keyCode === 13 || e.charCode === 32) {
|
234
|
+
_self.$elementFilestyle.find('label').click();
|
235
|
+
return false;
|
236
|
+
}
|
237
|
+
});
|
238
|
+
|
239
|
+
// hidding input file and add filestyle
|
240
|
+
_self.$element.css({
|
241
|
+
'position' : 'absolute',
|
242
|
+
'clip' : 'rect(0px 0px 0px 0px)' // using 0px for work in IE8
|
243
|
+
}).attr('tabindex', "-1").after(_self.$elementFilestyle);
|
244
|
+
|
245
|
+
if (_self.options.disabled) {
|
246
|
+
_self.$element.attr('disabled', 'true');
|
247
|
+
}
|
248
|
+
|
249
|
+
// Getting input file value
|
250
|
+
_self.$element.change(function() {
|
251
|
+
var files = _self.pushNameFiles();
|
252
|
+
|
253
|
+
if (_self.options.input == false && _self.options.badge) {
|
254
|
+
if (_self.$elementFilestyle.find('.badge').length == 0) {
|
255
|
+
_self.$elementFilestyle.find('label').append(' <span class="badge">' + files.length + '</span>');
|
256
|
+
} else if (files.length == 0) {
|
257
|
+
_self.$elementFilestyle.find('.badge').remove();
|
258
|
+
} else {
|
259
|
+
_self.$elementFilestyle.find('.badge').html(files.length);
|
260
|
+
}
|
261
|
+
} else {
|
262
|
+
_self.$elementFilestyle.find('.badge').remove();
|
263
|
+
}
|
264
|
+
});
|
265
|
+
|
266
|
+
// Check if browser is Firefox
|
267
|
+
if (window.navigator.userAgent.search(/firefox/i) > -1) {
|
268
|
+
// Simulating choose file for firefox
|
269
|
+
_self.$elementFilestyle.find('label').click(function() {
|
270
|
+
_self.$element.click();
|
271
|
+
return false;
|
272
|
+
});
|
273
|
+
}
|
274
|
+
}
|
275
|
+
};
|
276
|
+
|
277
|
+
var old = $.fn.filestyle;
|
278
|
+
|
279
|
+
$.fn.filestyle = function(option, value) {
|
280
|
+
var get = '', element = this.each(function() {
|
281
|
+
if ($(this).attr('type') === 'file') {
|
282
|
+
var $this = $(this), data = $this.data('filestyle'), options = $.extend({}, $.fn.filestyle.defaults, option, typeof option === 'object' && option);
|
283
|
+
|
284
|
+
if (!data) {
|
285
|
+
$this.data('filestyle', ( data = new Filestyle(this, options)));
|
286
|
+
data.constructor();
|
287
|
+
}
|
288
|
+
|
289
|
+
if ( typeof option === 'string') {
|
290
|
+
get = data[option](value);
|
291
|
+
}
|
292
|
+
}
|
293
|
+
});
|
294
|
+
|
295
|
+
if ( typeof get !== undefined) {
|
296
|
+
return get;
|
297
|
+
} else {
|
298
|
+
return element;
|
299
|
+
}
|
300
|
+
};
|
301
|
+
|
302
|
+
$.fn.filestyle.defaults = {
|
303
|
+
'buttonText' : 'Choose file',
|
304
|
+
'iconName' : 'glyphicon-folder-open',
|
305
|
+
'buttonName' : 'btn-default',
|
306
|
+
'size' : 'nr',
|
307
|
+
'input' : true,
|
308
|
+
'badge' : true,
|
309
|
+
'icon' : true,
|
310
|
+
'buttonBefore' : false,
|
311
|
+
'disabled' : false
|
312
|
+
};
|
313
|
+
|
314
|
+
$.fn.filestyle.noConflict = function() {
|
315
|
+
$.fn.filestyle = old;
|
316
|
+
return this;
|
317
|
+
};
|
318
|
+
|
319
|
+
// Data attributes register
|
320
|
+
$(function() {
|
321
|
+
$('.filestyle').each(function() {
|
322
|
+
var $this = $(this), options = {
|
323
|
+
|
324
|
+
'input' : $this.attr('data-input') === 'false' ? false : true,
|
325
|
+
'icon' : $this.attr('data-icon') === 'false' ? false : true,
|
326
|
+
'buttonBefore' : $this.attr('data-buttonBefore') === 'true' ? true : false,
|
327
|
+
'disabled' : $this.attr('data-disabled') === 'true' ? true : false,
|
328
|
+
'size' : $this.attr('data-size'),
|
329
|
+
'buttonText' : $this.attr('data-buttonText'),
|
330
|
+
'buttonName' : $this.attr('data-buttonName'),
|
331
|
+
'iconName' : $this.attr('data-iconName'),
|
332
|
+
'badge' : $this.attr('data-badge') === 'false' ? false : true
|
333
|
+
};
|
334
|
+
|
335
|
+
$this.filestyle(options);
|
336
|
+
});
|
337
|
+
});
|
373
338
|
})(window.jQuery);
|
metadata
CHANGED
@@ -1,41 +1,41 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bootstrap-filestyle-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mauricio Pasquier Juan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-10-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.3'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.3'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
description: |-
|
@@ -47,7 +47,7 @@ executables: []
|
|
47
47
|
extensions: []
|
48
48
|
extra_rdoc_files: []
|
49
49
|
files:
|
50
|
-
- .gitignore
|
50
|
+
- ".gitignore"
|
51
51
|
- Gemfile
|
52
52
|
- LICENSE.txt
|
53
53
|
- README.md
|
@@ -68,17 +68,17 @@ require_paths:
|
|
68
68
|
- lib
|
69
69
|
required_ruby_version: !ruby/object:Gem::Requirement
|
70
70
|
requirements:
|
71
|
-
- -
|
71
|
+
- - ">="
|
72
72
|
- !ruby/object:Gem::Version
|
73
73
|
version: '0'
|
74
74
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
75
75
|
requirements:
|
76
|
-
- -
|
76
|
+
- - ">="
|
77
77
|
- !ruby/object:Gem::Version
|
78
78
|
version: '0'
|
79
79
|
requirements: []
|
80
80
|
rubyforge_project:
|
81
|
-
rubygems_version: 2.
|
81
|
+
rubygems_version: 2.2.2
|
82
82
|
signing_key:
|
83
83
|
specification_version: 4
|
84
84
|
summary: Bootstrap Filestyle for the asset pipeline
|