simple_form_extension 1.2.7 → 1.2.8

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8d4523dca61e652afcbbbf575a107fd2d67a46de
4
- data.tar.gz: 36eeca76ad1bf4d5da545769a07b8089196c506a
3
+ metadata.gz: 1837eee35ab3f9670489245780d9d06bb8db5151
4
+ data.tar.gz: c6bbc67de650599e311a50342e024120fb2a370a
5
5
  SHA512:
6
- metadata.gz: cbc5d23bc873583370f19d31ed38acce4483aa230cbd178acb89ec89d905ff8e933ee457dfc2ba5a22c9a9167d27b91b5b09171a25f9d0c6f4366369130b851c
7
- data.tar.gz: 5d138020fa28f55d6e362fa23be0277b23dd93264c995085ec2f102c9c28d2ba4bf277aed2ba5b7f269f44e4e61179ead0d8ddaa356bbbbb12be099364401994
6
+ metadata.gz: 98619e0b84070c615da6f51fe138ed3ac762e7ddd3a48ea4a5d685bfb6ce95b2e81d161752977613409797ad887b168f2f38a1477df3c631c487e760a9a8723f
7
+ data.tar.gz: e66b63f26c685cac5c485eca8ff3c85e192b2208d950e7a16079b8f766490a28e50e5ec6acf1721cea244eb1e7fec5b64152f8e26b961c9e1ee51047af4c54f4
@@ -4,14 +4,14 @@ module SimpleFormExtension
4
4
  def input(wrapper_options = nil)
5
5
  input_html_options[:class] << "form-control spinbox-input"
6
6
  if options.fetch(:spinner, true)
7
- "<div class=\"input-group spinner-box-input\">
7
+ "<div class=\"input-group spinbox\">
8
8
  #{@builder.text_field(attribute_name, input_html_options)}
9
9
  <span class=\"input-group-btn\">
10
- <span class=\"spinner-buttons btn-group-vertical\">
11
- <button class=\"btn btn-default spinner-up\" type=\"button\" tabindex=\"-1\">
10
+ <span class=\"spinbox-buttons btn-group-vertical\">
11
+ <button class=\"btn btn-default spinbox-up\" type=\"button\" tabindex=\"-1\">
12
12
  <i class=\"fa fa-chevron-up\"></i>
13
13
  </button>
14
- <button class=\"btn btn-default spinner-down\" type=\"button\" tabindex=\"-1\">
14
+ <button class=\"btn btn-default spinbox-down\" type=\"button\" tabindex=\"-1\">
15
15
  <i class=\"fa fa-chevron-down\"></i>
16
16
  </button>
17
17
  </span>
@@ -1,3 +1,3 @@
1
1
  module SimpleFormExtension
2
- VERSION = "1.2.7"
2
+ VERSION = "1.2.8"
3
3
  end
@@ -14,6 +14,7 @@ class DateTimePicker
14
14
  @$input.datetimepicker(
15
15
  lang: @locale
16
16
  format: @$input.data('format')
17
+ step: @$input.data('step')
17
18
  dayOfWeekStart: @$input.data('week-start-day')
18
19
  )
19
20
 
@@ -25,6 +26,7 @@ class DatePicker extends DateTimePicker
25
26
  @$input.datetimepicker(
26
27
  lang: @locale
27
28
  timepicker: false
29
+ step: @$input.data('step')
28
30
  format: @$input.data('format')
29
31
  dayOfWeekStart: @$input.data('week-start-day')
30
32
  )
@@ -34,6 +36,7 @@ class TimePicker extends DateTimePicker
34
36
  @$input.datetimepicker(
35
37
  lang: @locale
36
38
  datepicker: false,
39
+ step: @$input.data('step')
37
40
  format: @$input.data('format')
38
41
  )
39
42
 
@@ -11,6 +11,7 @@ $.fn.simpleFormSpinbox = ->
11
11
  $input.data('simple-form:spinbox', instance)
12
12
 
13
13
  onPageReady ->
14
- $spinbox = $('.spinner-box-input')
14
+ $spinbox = $('.spinbox')
15
15
  return unless $spinbox.length
16
16
  $spinbox.simpleFormSpinbox()
17
+
@@ -1,26 +1,13 @@
1
- /*
2
- * Fuel UX Spinbox
3
- * https://github.com/ExactTarget/fuelux
4
- *
5
- * Copyright (c) 2014 ExactTarget
6
- * Licensed under the BSD New license.
7
- */
8
-
9
- // -- BEGIN UMD WRAPPER PREFACE --
10
-
11
- // For more information on UMD visit:
12
- // https://github.com/umdjs/umd/blob/master/jqueryPlugin.js
13
-
14
- (function(factory) {
15
- if (typeof define === 'function' && define.amd) {
16
- // if AMD loader is available, register as an anonymous module.
17
- define(['jquery'], factory);
18
- } else {
19
- // OR use browser globals if AMD is not present
20
- factory(jQuery);
21
- }
22
- }(function($) {
23
- // -- END UMD WRAPPER PREFACE --
1
+ ( function( $ ) {
2
+ /*
3
+ * Fuel UX Spinbox
4
+ * https://github.com/ExactTarget/fuelux
5
+ *
6
+ * Copyright (c) 2014 ExactTarget
7
+ * Licensed under the BSD New license.
8
+ */
9
+
10
+
24
11
 
25
12
  // -- BEGIN MODULE CODE HERE --
26
13
 
@@ -28,38 +15,38 @@
28
15
 
29
16
  // SPINBOX CONSTRUCTOR AND PROTOTYPE
30
17
 
31
- var Spinbox = function(element, options) {
32
- this.$element = $(element);
33
- this.$element.find('.btn').on('click', function(e) {
18
+ var Spinbox = function( element, options ) {
19
+ this.$element = $( element );
20
+ this.$element.find( '.btn' ).on( 'click', function( e ) {
34
21
  //keep spinbox from submitting if they forgot to say type="button" on their spinner buttons
35
22
  e.preventDefault();
36
- });
37
- this.options = $.extend({}, $.fn.spinbox.defaults, options);
38
- this.$input = this.$element.find('.spinbox-input');
39
- this.$element.on('focusin.fu.spinbox', this.$input, $.proxy(this.changeFlag, this));
40
- this.$element.on('focusout.fu.spinbox', this.$input, $.proxy(this.change, this));
41
- this.$element.on('keydown.fu.spinbox', this.$input, $.proxy(this.keydown, this));
42
- this.$element.on('keyup.fu.spinbox', this.$input, $.proxy(this.keyup, this));
23
+ } );
24
+ this.options = $.extend( {}, $.fn.spinbox.defaults, options );
25
+ this.$input = this.$element.find( '.spinbox-input' );
26
+ this.$element.on( 'focusin.fu.spinbox', this.$input, $.proxy( this.changeFlag, this ) );
27
+ this.$element.on( 'focusout.fu.spinbox', this.$input, $.proxy( this.change, this ) );
28
+ this.$element.on( 'keydown.fu.spinbox', this.$input, $.proxy( this.keydown, this ) );
29
+ this.$element.on( 'keyup.fu.spinbox', this.$input, $.proxy( this.keyup, this ) );
43
30
 
44
31
  this.bindMousewheelListeners();
45
32
  this.mousewheelTimeout = {};
46
33
 
47
- if (this.options.hold) {
48
- this.$element.on('mousedown.fu.spinbox', '.spinbox-up', $.proxy(function() {
49
- this.startSpin(true);
50
- }, this));
51
- this.$element.on('mouseup.fu.spinbox', '.spinbox-up, .spinbox-down', $.proxy(this.stopSpin, this));
52
- this.$element.on('mouseout.fu.spinbox', '.spinbox-up, .spinbox-down', $.proxy(this.stopSpin, this));
53
- this.$element.on('mousedown.fu.spinbox', '.spinbox-down', $.proxy(function() {
54
- this.startSpin(false);
55
- }, this));
34
+ if ( this.options.hold ) {
35
+ this.$element.on( 'mousedown.fu.spinbox', '.spinbox-up', $.proxy( function() {
36
+ this.startSpin( true );
37
+ }, this ) );
38
+ this.$element.on( 'mouseup.fu.spinbox', '.spinbox-up, .spinbox-down', $.proxy( this.stopSpin, this ) );
39
+ this.$element.on( 'mouseout.fu.spinbox', '.spinbox-up, .spinbox-down', $.proxy( this.stopSpin, this ) );
40
+ this.$element.on( 'mousedown.fu.spinbox', '.spinbox-down', $.proxy( function() {
41
+ this.startSpin( false );
42
+ }, this ) );
56
43
  } else {
57
- this.$element.on('click.fu.spinbox', '.spinbox-up', $.proxy(function() {
58
- this.step(true);
59
- }, this));
60
- this.$element.on('click.fu.spinbox', '.spinbox-down', $.proxy(function() {
61
- this.step(false);
62
- }, this));
44
+ this.$element.on( 'click.fu.spinbox', '.spinbox-up', $.proxy( function() {
45
+ this.step( true );
46
+ }, this ) );
47
+ this.$element.on( 'click.fu.spinbox', '.spinbox-down', $.proxy( function() {
48
+ this.step( false );
49
+ }, this ) );
63
50
  }
64
51
 
65
52
  this.switches = {
@@ -67,9 +54,9 @@
67
54
  enabled: true
68
55
  };
69
56
 
70
- if (this.options.speed === 'medium') {
57
+ if ( this.options.speed === 'medium' ) {
71
58
  this.switches.speed = 300;
72
- } else if (this.options.speed === 'fast') {
59
+ } else if ( this.options.speed === 'fast' ) {
73
60
  this.switches.speed = 100;
74
61
  } else {
75
62
  this.switches.speed = 500;
@@ -79,7 +66,7 @@
79
66
 
80
67
  this.render();
81
68
 
82
- if (this.options.disabled) {
69
+ if ( this.options.disabled ) {
83
70
  this.disable();
84
71
  }
85
72
  };
@@ -92,64 +79,64 @@
92
79
  // any external bindings
93
80
  // [none]
94
81
  // set input value attrbute
95
- this.$element.find('input').each(function() {
96
- $(this).attr('value', $(this).val());
97
- });
82
+ this.$element.find( 'input' ).each( function() {
83
+ $( this ).attr( 'value', $( this ).val() );
84
+ } );
98
85
  // empty elements to return to original markup
99
86
  // [none]
100
87
  // returns string of markup
101
- return this.$element[0].outerHTML;
88
+ return this.$element[ 0 ].outerHTML;
102
89
  },
103
90
 
104
91
  render: function() {
105
- var inputValue = this.parseInput(this.$input.val());
92
+ var inputValue = this.parseInput( this.$input.val() );
106
93
  var maxUnitLength = '';
107
94
 
108
95
  // if input is empty and option value is default, 0
109
- if (inputValue !== '' && this.options.value === 0) {
110
- this.value(inputValue);
96
+ if ( inputValue !== '' && this.options.value === 0 ) {
97
+ this.value( inputValue );
111
98
  } else {
112
- this.output (this.options.value);
99
+ this.output( this.options.value );
113
100
  }
114
101
 
115
- if (this.options.units.length) {
116
- $.each(this.options.units, function(index, value) {
117
- if (value.length > maxUnitLength.length) {
102
+ if ( this.options.units.length ) {
103
+ $.each( this.options.units, function( index, value ) {
104
+ if ( value.length > maxUnitLength.length ) {
118
105
  maxUnitLength = value;
119
106
  }
120
- });
107
+ } );
121
108
  }
122
-
123
109
  },
124
110
 
125
- output: function(value, updateField) {
126
- value = (value + '').split('.').join(this.options.decimalMark);
127
- updateField = (updateField || true);
128
- if (updateField) {
129
- this.$input.val(value);
111
+ output: function( value, updateField ) {
112
+ value = ( value + '' ).split( '.' ).join( this.options.decimalMark );
113
+ updateField = ( updateField || true );
114
+ if ( updateField ) {
115
+ this.$input.val( value );
130
116
  }
131
117
 
132
118
  return value;
133
119
  },
134
120
 
135
- parseInput: function(value) {
136
- value = (value + '').split(this.options.decimalMark).join('.');
121
+ parseInput: function( value ) {
122
+ value = ( value + '' ).split( this.options.decimalMark ).join( '.' );
137
123
 
138
124
  return value;
139
125
  },
140
126
 
141
127
  change: function() {
142
- var newVal = this.parseInput(this.$input.val()) || '';
128
+ var newVal = this.parseInput( this.$input.val() ) || '';
143
129
 
144
- if (this.options.units.length || this.options.decimalMark !== '.') {
145
- newVal = this.parseValueWithUnit(newVal);
146
- } else if (newVal / 1) {
147
- newVal = this.options.value = this.checkMaxMin(newVal / 1);
130
+ if ( this.options.units.length || this.options.decimalMark !== '.' ) {
131
+ newVal = this.parseValueWithUnit( newVal );
132
+ } else if ( newVal / 1 ) {
133
+ newVal = this.options.value = this.checkMaxMin( newVal / 1 );
148
134
  } else {
149
- newVal = this.checkMaxMin(newVal.replace(/[^0-9.-]/g, '') || '');
135
+ newVal = this.checkMaxMin( newVal.replace( /[^0-9.-]/g, '' ) || '' );
150
136
  this.options.value = newVal / 1;
151
137
  }
152
- this.output (newVal);
138
+
139
+ this.output( newVal );
153
140
 
154
141
  this.changeFlag = false;
155
142
  this.triggerChangedEvent();
@@ -160,8 +147,8 @@
160
147
  },
161
148
 
162
149
  stopSpin: function() {
163
- if (this.switches.timeout !== undefined) {
164
- clearTimeout(this.switches.timeout);
150
+ if ( this.switches.timeout !== undefined ) {
151
+ clearTimeout( this.switches.timeout );
165
152
  this.switches.count = 1;
166
153
  this.triggerChangedEvent();
167
154
  }
@@ -169,49 +156,47 @@
169
156
 
170
157
  triggerChangedEvent: function() {
171
158
  var currentValue = this.value();
172
- if (currentValue === this.lastValue) return;
173
-
159
+ if ( currentValue === this.lastValue ) return;
174
160
  this.lastValue = currentValue;
175
161
 
176
162
  // Primary changed event
177
- this.$element.trigger('changed.fu.spinbox', this.output(currentValue, false)); // no DOM update
163
+ this.$element.trigger( 'changed.fu.spinbox', this.output( currentValue, false ) ); // no DOM update
178
164
  },
179
165
 
180
- startSpin: function(type) {
181
-
182
- if (!this.options.disabled) {
166
+ startSpin: function( type ) {
167
+ if ( !this.options.disabled ) {
183
168
  var divisor = this.switches.count;
184
169
 
185
- if (divisor === 1) {
186
- this.step(type);
170
+ if ( divisor === 1 ) {
171
+ this.step( type );
187
172
  divisor = 1;
188
- } else if (divisor < 3) {
173
+ } else if ( divisor < 3 ) {
189
174
  divisor = 1.5;
190
- } else if (divisor < 8) {
175
+ } else if ( divisor < 8 ) {
191
176
  divisor = 2.5;
192
177
  } else {
193
178
  divisor = 4;
194
179
  }
195
180
 
196
- this.switches.timeout = setTimeout($.proxy(function() {
197
- this.iterate(type);
198
- }, this), this.switches.speed / divisor);
181
+ this.switches.timeout = setTimeout( $.proxy( function() {
182
+ this.iterate( type );
183
+ }, this ), this.switches.speed / divisor );
199
184
  this.switches.count++;
200
185
  }
201
186
  },
202
187
 
203
- iterate: function(type) {
204
- this.step(type);
205
- this.startSpin(type);
188
+ iterate: function( type ) {
189
+ this.step( type );
190
+ this.startSpin( type );
206
191
  },
207
192
 
208
- step: function(isIncrease) {
193
+ step: function( isIncrease ) {
209
194
  // isIncrease: true is up, false is down
210
195
 
211
196
  var digits, multiple, currentValue, limitValue;
212
197
 
213
198
  // trigger change event
214
- if (this.changeFlag) {
199
+ if ( this.changeFlag ) {
215
200
  this.change();
216
201
  }
217
202
 
@@ -219,160 +204,164 @@
219
204
  currentValue = this.options.value;
220
205
  limitValue = isIncrease ? this.options.max : this.options.min;
221
206
 
222
- if ( (isIncrease ? currentValue < limitValue : currentValue > limitValue) ) {
223
- var newVal = currentValue + (isIncrease ? 1 : -1) * this.options.step;
207
+ if ( ( isIncrease ? currentValue < limitValue : currentValue > limitValue ) ) {
208
+ var newVal = currentValue + ( isIncrease ? 1 : -1 ) * this.options.step;
224
209
 
225
210
  // raise to power of 10 x number of decimal places, then round
226
- if (this.options.step % 1 !== 0) {
227
- digits = (this.options.step + '').split('.')[1].length;
228
- multiple = Math.pow(10, digits);
229
- newVal = Math.round(newVal * multiple) / multiple;
211
+ if ( this.options.step % 1 !== 0 ) {
212
+ digits = ( this.options.step + '' ).split( '.' )[ 1 ].length;
213
+ multiple = Math.pow( 10, digits );
214
+ newVal = Math.round( newVal * multiple ) / multiple;
230
215
  }
231
216
 
232
217
  // if outside limits, set to limit value
233
- if (isIncrease ? newVal > limitValue : newVal < limitValue) {
234
- this.value(limitValue);
218
+ if ( isIncrease ? newVal > limitValue : newVal < limitValue ) {
219
+ this.value( limitValue );
235
220
  } else {
236
- this.value(newVal);
221
+ this.value( newVal );
237
222
  }
238
223
 
239
- } else if (this.options.cycle) {
224
+ } else if ( this.options.cycle ) {
240
225
  var cycleVal = isIncrease ? this.options.min : this.options.max;
241
- this.value(cycleVal);
226
+ this.value( cycleVal );
242
227
  }
243
228
  },
244
229
 
245
- value: function(value) {
246
-
247
- if (value || value === 0) {
248
- if (this.options.units.length || this.options.decimalMark !== '.') {
249
- this.output(this.parseValueWithUnit(value + (this.unit || '')));
230
+ value: function( value ) {
231
+ if ( value || value === 0 ) {
232
+ if ( this.options.units.length || this.options.decimalMark !== '.' ) {
233
+ this.output( this.parseValueWithUnit( value + ( this.unit || '' ) ) );
250
234
  return this;
251
235
 
252
- } else if (!isNaN(parseFloat(value)) && isFinite(value)) {
236
+ } else if ( !isNaN( parseFloat( value ) ) && isFinite( value ) ) {
253
237
  this.options.value = value / 1;
254
- this.output (value + (this.unit ? this.unit : ''));
238
+ this.output( value + ( this.unit ? this.unit : '' ) );
255
239
  return this;
256
240
 
257
241
  }
242
+
258
243
  } else {
259
- if (this.changeFlag) {
244
+ if ( this.changeFlag ) {
260
245
  this.change();
261
246
  }
262
247
 
263
- if (this.unit) {
248
+ if ( this.unit ) {
264
249
  return this.options.value + this.unit;
265
250
  } else {
266
- return this.output(this.options.value, false); // no DOM update
251
+ return this.output( this.options.value, false ); // no DOM update
267
252
  }
253
+
268
254
  }
269
255
  },
270
256
 
271
- isUnitLegal: function(unit) {
257
+ isUnitLegal: function( unit ) {
272
258
  var legalUnit;
273
259
 
274
- $.each(this.options.units, function(index, value) {
275
- if (value.toLowerCase() === unit.toLowerCase()) {
260
+ $.each( this.options.units, function( index, value ) {
261
+ if ( value.toLowerCase() === unit.toLowerCase() ) {
276
262
  legalUnit = unit.toLowerCase();
277
263
  return false;
278
264
  }
279
- });
265
+ } );
280
266
 
281
267
  return legalUnit;
282
268
  },
283
269
 
284
270
  // strips units and add them back
285
- parseValueWithUnit: function(value) {
286
- var unit = value.replace(/[^a-zA-Z]/g, '');
287
- var number = value.replace(/[^0-9.-]/g, '');
271
+ parseValueWithUnit: function( value ) {
272
+ var unit = value.replace( /[^a-zA-Z]/g, '' );
273
+ var number = value.replace( /[^0-9.-]/g, '' );
288
274
 
289
- if (unit) {
290
- unit = this.isUnitLegal(unit);
275
+ if ( unit ) {
276
+ unit = this.isUnitLegal( unit );
291
277
  }
292
278
 
293
- this.options.value = this.checkMaxMin(number / 1);
279
+ this.options.value = this.checkMaxMin( number / 1 );
294
280
  this.unit = unit || undefined;
295
- return this.options.value + (unit || '');
281
+ return this.options.value + ( unit || '' );
296
282
  },
297
283
 
298
- checkMaxMin: function(value) {
284
+ checkMaxMin: function( value ) {
299
285
  // if unreadable
300
- if (isNaN(parseFloat(value))) {
286
+ if ( isNaN( parseFloat( value ) ) ) {
301
287
  return value;
302
288
  }
289
+
303
290
  // if not within range return the limit
304
- if (!(value <= this.options.max && value >= this.options.min)) {
291
+ if ( !( value <= this.options.max && value >= this.options.min ) ) {
305
292
  value = value >= this.options.max ? this.options.max : this.options.min;
306
293
  }
294
+
307
295
  return value;
308
296
  },
309
297
 
310
298
  disable: function() {
311
299
  this.options.disabled = true;
312
- this.$element.addClass('disabled');
313
- this.$input.attr('disabled', '');
314
- this.$element.find('button').addClass('disabled');
300
+ this.$element.addClass( 'disabled' );
301
+ this.$input.attr( 'disabled', '' );
302
+ this.$element.find( 'button' ).addClass( 'disabled' );
315
303
  },
316
304
 
317
305
  enable: function() {
318
306
  this.options.disabled = false;
319
- this.$element.removeClass('disabled');
320
- this.$input.removeAttr('disabled');
321
- this.$element.find('button').removeClass('disabled');
307
+ this.$element.removeClass( 'disabled' );
308
+ this.$input.removeAttr( 'disabled' );
309
+ this.$element.find( 'button' ).removeClass( 'disabled' );
322
310
  },
323
311
 
324
- keydown: function(event) {
312
+ keydown: function( event ) {
325
313
  var keyCode = event.keyCode;
326
- if (keyCode === 38) {
327
- this.step(true);
328
- } else if (keyCode === 40) {
329
- this.step(false);
314
+ if ( keyCode === 38 ) {
315
+ this.step( true );
316
+ } else if ( keyCode === 40 ) {
317
+ this.step( false );
330
318
  }
331
319
  },
332
320
 
333
- keyup: function(event) {
321
+ keyup: function( event ) {
334
322
  var keyCode = event.keyCode;
335
323
 
336
- if (keyCode === 38 || keyCode === 40) {
324
+ if ( keyCode === 38 || keyCode === 40 ) {
337
325
  this.triggerChangedEvent();
338
326
  }
339
327
  },
340
328
 
341
329
  bindMousewheelListeners: function() {
342
- var inputEl = this.$input.get(0);
343
- if (inputEl.addEventListener) {
330
+ var inputEl = this.$input.get( 0 );
331
+ if ( inputEl.addEventListener ) {
344
332
  //IE 9, Chrome, Safari, Opera
345
- inputEl.addEventListener('mousewheel', $.proxy(this.mousewheelHandler, this), false);
333
+ inputEl.addEventListener( 'mousewheel', $.proxy( this.mousewheelHandler, this ), false );
346
334
  // Firefox
347
- inputEl.addEventListener('DOMMouseScroll', $.proxy(this.mousewheelHandler, this), false);
335
+ inputEl.addEventListener( 'DOMMouseScroll', $.proxy( this.mousewheelHandler, this ), false );
348
336
  } else {
349
337
  // IE <9
350
- inputEl.attachEvent('onmousewheel', $.proxy(this.mousewheelHandler, this));
338
+ inputEl.attachEvent( 'onmousewheel', $.proxy( this.mousewheelHandler, this ) );
351
339
  }
352
340
  },
353
341
 
354
- mousewheelHandler: function(event) {
355
- if (!this.options.disabled) {
342
+ mousewheelHandler: function( event ) {
343
+ if ( !this.options.disabled ) {
356
344
  var e = window.event || event; // old IE support
357
- var delta = Math.max(-1, Math.min(1, (e.wheelDelta || -e.detail)));
345
+ var delta = Math.max( -1, Math.min( 1, ( e.wheelDelta || -e.detail ) ) );
358
346
  var self = this;
359
347
 
360
- clearTimeout(this.mousewheelTimeout);
361
- this.mousewheelTimeout = setTimeout(function () {
348
+ clearTimeout( this.mousewheelTimeout );
349
+ this.mousewheelTimeout = setTimeout( function() {
362
350
  self.triggerChangedEvent();
363
- }, 300);
351
+ }, 300 );
364
352
 
365
- if (delta < 0) {
366
- this.step(true);
353
+ if ( delta < 0 ) {
354
+ this.step( true );
367
355
  } else {
368
- this.step(false);
356
+ this.step( false );
369
357
  }
370
358
 
371
- if (e.preventDefault) {
359
+ if ( e.preventDefault ) {
372
360
  e.preventDefault();
373
361
  } else {
374
362
  e.returnValue = false;
375
363
  }
364
+
376
365
  return false;
377
366
  }
378
367
  }
@@ -381,24 +370,25 @@
381
370
 
382
371
  // SPINBOX PLUGIN DEFINITION
383
372
 
384
- $.fn.spinbox = function(option) {
385
- var args = Array.prototype.slice.call(arguments, 1);
373
+ $.fn.spinbox = function( option ) {
374
+ var args = Array.prototype.slice.call( arguments, 1 );
386
375
  var methodReturn;
387
376
 
388
- var $set = this.each(function() {
389
- var $this = $(this);
390
- var data = $this.data('fu.spinbox');
377
+ var $set = this.each( function() {
378
+ var $this = $( this );
379
+ var data = $this.data( 'fu.spinbox' );
391
380
  var options = typeof option === 'object' && option;
392
381
 
393
- if (!data) {
394
- $this.data('fu.spinbox', (data = new Spinbox(this, options)));
382
+ if ( !data ) {
383
+ $this.data( 'fu.spinbox', ( data = new Spinbox( this, options ) ) );
395
384
  }
396
- if (typeof option === 'string') {
397
- methodReturn = data[option].apply(data, args);
385
+
386
+ if ( typeof option === 'string' ) {
387
+ methodReturn = data[ option ].apply( data, args );
398
388
  }
399
- });
389
+ } );
400
390
 
401
- return (methodReturn === undefined) ? $set : methodReturn;
391
+ return ( methodReturn === undefined ) ? $set : methodReturn;
402
392
  };
403
393
 
404
394
  // value needs to be 0 for this.render();
@@ -425,23 +415,24 @@
425
415
 
426
416
  // DATA-API
427
417
 
428
- $(document).on('mousedown.fu.spinbox.data-api', '[data-initialize=spinbox]', function(e) {
429
- var $control = $(e.target).closest('.spinbox');
430
- if (!$control.data('fu.spinbox')) {
431
- $control.spinbox($control.data());
418
+ $( document ).on( 'mousedown.fu.spinbox.data-api', '[data-initialize=spinbox]', function( e ) {
419
+ var $control = $( e.target ).closest( '.spinbox' );
420
+ if ( !$control.data( 'fu.spinbox' ) ) {
421
+ $control.spinbox( $control.data() );
432
422
  }
433
- });
423
+ } );
434
424
 
435
425
  // Must be domReady for AMD compatibility
436
- $(function() {
437
- $('[data-initialize=spinbox]').each(function() {
438
- var $this = $(this);
439
- if (!$this.data('fu.spinbox')) {
440
- $this.spinbox($this.data());
426
+ $( function() {
427
+ $( '[data-initialize=spinbox]' ).each( function() {
428
+ var $this = $( this );
429
+ if ( !$this.data( 'fu.spinbox' ) ) {
430
+ $this.spinbox( $this.data() );
441
431
  }
442
- });
443
- });
432
+ } );
433
+ } );
434
+
435
+
436
+
437
+ } )( jQuery );
444
438
 
445
- // -- BEGIN UMD WRAPPER AFTERWORD --
446
- }));
447
- // -- END UMD WRAPPER AFTERWORD --
@@ -4,4 +4,4 @@
4
4
  //= require selectize.bootstrap3
5
5
  //= require jquery.datetimepicker
6
6
  //= require jasny-bootstrap
7
- //= require_tree ./overrides
7
+
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_form_extension
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.7
4
+ version: 1.2.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexandre Vasseur
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-07 00:00:00.000000000 Z
11
+ date: 2015-04-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -159,11 +159,6 @@ files:
159
159
  - vendor/assets/javascripts/spinbox.js
160
160
  - vendor/assets/stylesheets/jasny-bootstrap.css
161
161
  - vendor/assets/stylesheets/jquery.datetimepicker.css
162
- - vendor/assets/stylesheets/overrides/_variables.scss
163
- - vendor/assets/stylesheets/overrides/fuelux.sass
164
- - vendor/assets/stylesheets/overrides/jasny.bootstrap.sass
165
- - vendor/assets/stylesheets/overrides/redactor.css.sass
166
- - vendor/assets/stylesheets/overrides/selectize.sass
167
162
  - vendor/assets/stylesheets/simple_form_extension.sass
168
163
  homepage: http://www.glyph.fr
169
164
  licenses:
@@ -1,86 +0,0 @@
1
- // Grays
2
- // -------------------------
3
- $gray-darker: lighten(#000, 13.5%) !default; // #222
4
- $gray-dark: #999999 !default;
5
- $gray: #CCCCCC !default;
6
- $gray-light: #EEEEEE !default;
7
- $gray-lighter: #D5D5D5 !default;
8
-
9
-
10
- // Brand colors
11
- // -------------------------
12
- $brand-primary: #33414e !default;
13
- $brand-success: #95b75d !default;
14
- $brand-warning: #fea223 !default;
15
- $brand-danger: #b64645 !default;
16
- $brand-info: #3fbae4 !default;
17
-
18
-
19
- // Components
20
- // -------------------------
21
- $border-radius-base: 2px !default;
22
-
23
- $component-active-color: #fff !default;
24
- $component-active-bg: $gray-light !default;
25
-
26
-
27
- // Buttons
28
- // -------------------------
29
- $btn-default-color: #333 !default;
30
- $btn-default-bg: #f5f5f5 !default;
31
- $btn-default-border: #ccc !default;
32
-
33
- $btn-primary-color: #fff !default;
34
- $btn-primary-bg: $brand-primary !default;
35
- $btn-primary-border: #29343f !default;
36
-
37
- $btn-success-color: #fff !default;
38
- $btn-success-bg: $brand-success !default;
39
- $btn-success-border: #89ad4d !default;
40
-
41
- $btn-warning-color: #fff !default;
42
- $btn-warning-bg: $brand-warning !default;
43
- $btn-warning-border: #fe970a !default;
44
-
45
- $btn-danger-color: #fff !default;
46
- $btn-danger-bg: $brand-danger !default;
47
- $btn-danger-border: #a43f3e !default;
48
-
49
- $btn-info-color: #fff !default;
50
- $btn-info-bg: $brand-info !default;
51
- $btn-info-border: #29b2e1 !default;
52
-
53
- $btn-link-disabled-color: $gray-light !default;
54
-
55
-
56
- // Forms
57
- // -------------------------
58
- $input-bg: #F9F9F9 !default;
59
- $input-bg-disabled: $gray-light !default;
60
-
61
- $input-color: $gray-darker !default;
62
- $input-border: $gray-lighter !default;
63
- $input-border-radius: $border-radius-base !default;
64
- $input-border-focus: #C1C1C1 !default;
65
-
66
- $input-group-addon-bg: $gray-lighter !default;
67
- $input-group-addon-border-color: $input-border !default;
68
-
69
-
70
- // Dropdowns
71
- // -------------------------
72
- $dropdown-bg: #fff !default;
73
- $dropdown-border: #e5e5e5 !default;
74
- $dropdown-fallback-border: #ccc !default;
75
- $dropdown-divider-bg: #e5e5e5 !default;
76
-
77
- $dropdown-link-color: $gray-darker !default;
78
- $dropdown-link-hover-color: darken($gray-darker, 5%) !default;
79
- $dropdown-link-hover-bg: darken(#fff, 5%) !default;
80
-
81
- $dropdown-link-active-color: $component-active-color !default;
82
- $dropdown-link-active-bg: $component-active-bg !default;
83
-
84
- $dropdown-link-disabled-color: $gray-light !default;
85
-
86
- $dropdown-header-color: #777 !default;
@@ -1,40 +0,0 @@
1
- @import "variables"
2
-
3
- @import "compass/css3/box-shadow"
4
- @import "compass/css3/border-radius"
5
-
6
- input[type=number]::-webkit-inner-spin-button,
7
- input[type=number]::-webkit-outer-spin-button
8
- -webkit-appearance: none
9
- margin: 0
10
-
11
- .spinner,
12
- .spinner-box-input
13
- .spinner-buttons
14
- height: 100%
15
- .btn
16
- position: relative
17
- height: 50%
18
- padding: 3px 9px
19
- line-height: 0px
20
- font-size: 10px
21
- top: 0px
22
- margin-left: -1px !important
23
- border-color: $input-border
24
- +box-shadow(none)
25
- z-index: 2
26
- .fa
27
- font-size: 1em
28
- margin-right: 0
29
- line-height: 9px
30
- &.disabled
31
- cursor: not-allowed
32
- &:hover,
33
- &:focus
34
- +box-shadow(none)
35
- .spinner-up
36
- +border-top-left-radius(0 !important)
37
- +border-top-right-radius($input-border-radius !important)
38
- .spinner-down
39
- +border-bottom-left-radius(0 !important)
40
- padding: 3px 9px 2px 9px
@@ -1,41 +0,0 @@
1
- /* Jasny Bootstrap Fileupload overrides */
2
-
3
- @import "variables"
4
- @import "compass/css3/border-radius"
5
-
6
- .fileinput
7
- margin-bottom: 0
8
- display: block
9
- .uneditable-input
10
- background-color: $input-bg-disabled
11
-
12
- .fileinput-new.input-group .btn-file
13
- .fileinput.input-group .btn-file
14
- +border-right-radius($border-radius-base)
15
- border-color: $input-border
16
-
17
- .fileinput.input-group .input-group-btn
18
- .form-control.file
19
- padding: 0 !important
20
- position: absolute
21
-
22
- .fileinput
23
- .input-group-btn > .btn:hover,
24
- .input-group-btn > .btn:focus,
25
- .input-group-btn > .btn:active
26
- z-index: 0
27
-
28
- .fileinput-preview.thumbnail
29
- width: auto
30
- height: auto
31
- min-width: 80px
32
- min-height: 80px
33
- max-height: 500px
34
- margin-bottom: 0
35
- margin-top: 5px
36
- background-color: $input-bg
37
-
38
- .empty-thumbnail
39
- width: 250px
40
- height: 200px
41
- background-color: $input-bg
@@ -1,88 +0,0 @@
1
- @import "variables"
2
- @import "compass/css3/border-radius"
3
- @import "compass/css3/box-shadow"
4
-
5
- .redactor-button-disabled
6
- &:hover,
7
- &:focus
8
- background-color: transparent !important
9
- color: #333 !important
10
- cursor: disabled
11
-
12
- .redactor-dropdown a
13
- color: $dropdown-link-color
14
- &:hover,
15
- &:focus
16
- background-color: $dropdown-link-hover-bg
17
- color: $dropdown-link-hover-color !important
18
-
19
- .redactor-box
20
- .redactor-toolbar
21
- /* Override z-index because we don't whant */
22
- /* redactor_toolbar fixed somewhere or on top of everythink ..*/
23
- z-index: 1 !important
24
- +box-shadow(none)
25
- +border-radius($input-border-radius $input-border-radius 0 0)
26
- border: 1px solid $input-border
27
- li a
28
- &:hover,
29
- &:focus
30
- background-color: $btn-primary-bg
31
- color: $btn-primary-color
32
-
33
- .redactor-editor
34
- background-color: $input-bg
35
- border: 1px solid $input-border
36
- border-top-width: 0px
37
- +border-radius(0 0 $input-border-radius $input-border-radius)
38
- &:focus
39
- border-color: $input-border-focus
40
- background: #FFF
41
- &[disabled], &[readonly]
42
- color: #CCC
43
- &[disabled]:focus, &[readonly]:focus
44
- background: $input-bg-disabled
45
- color: #CCC
46
- border-color: $gray-lighter
47
-
48
- textarea.form-control
49
- background-color: $input-bg
50
- color: $input-color
51
- border: 1px solid $input-border
52
- border-top-width: 0px
53
- &:focus
54
- background-color: #111
55
- color: $gray-lighter
56
-
57
- .redactor-editor
58
- div.row
59
- margin-left: -15px
60
- margin-right: -15px
61
- margin-bottom: 0
62
- div[class^=col-lg-], div[class^=col-md-], div[class^=col-sm-], div[class^=col-xs-]
63
- padding-left: 15px
64
- padding-right: 15px
65
- border: 1px dashed $gray-light
66
- margin-bottom: 0
67
-
68
- #redactor-modal
69
- input[type="text"],
70
- input[type="password"],
71
- input[type="email"],
72
- textarea
73
- border-color: $input-border
74
- background-color: $input-bg
75
- color: $input-color
76
- +box-shadow(none)
77
- &:focus
78
- background-color: #fff
79
- border-color: $input-border-focus
80
- +box-shadow(none)
81
-
82
- footer
83
- button.redactor-modal-action-btn
84
- background-color: $btn-primary-bg
85
- color: $btn-primary-color
86
- &:hover,
87
- &:focus
88
- background-color: darken($btn-primary-bg, 5%)
@@ -1,39 +0,0 @@
1
- @import "variables"
2
- @import "compass/css3/border-radius"
3
-
4
- .selectize-dropdown,
5
- .selectize-dropdown.form-control
6
- +border-radius($border-radius-base)
7
-
8
- .selectize-input
9
- border-color: $input-border
10
- +border-radius($input-border-radius)
11
- &.focus
12
- border-color: $input-border-focus
13
- &.dropdown-active
14
- +border-radius($input-border-radius)
15
-
16
- .selectize-dropdown,
17
- .selectize-input,
18
- .selectize-input input
19
- color: $input-color
20
-
21
- .selectize-input,
22
- .selectize-control.single
23
- .selectize-input.input-active
24
- background: $input-bg
25
-
26
- .selectize-dropdown
27
- [data-selectable]
28
- background-color: $dropdown-bg
29
- color: $dropdown-link-color
30
- .active
31
- background-color: $dropdown-link-hover-bg
32
- color: $dropdown-link-hover-color
33
- .selected
34
- background-color: $dropdown-link-active-bg
35
- color: $dropdown-link-active-color
36
-
37
- .selectize-dropdown-content
38
- padding: 0
39
-