less-rails-semantic_ui 1.4.1.0 → 1.5.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (29) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +1 -0
  3. data/assets/javascripts/semantic_ui/definitions/modules/dropdown.js +35 -20
  4. data/assets/javascripts/semantic_ui/definitions/modules/popup.js +29 -11
  5. data/assets/javascripts/semantic_ui/definitions/modules/progress.js +121 -20
  6. data/assets/javascripts/semantic_ui/definitions/modules/search.js +2 -2
  7. data/assets/javascripts/semantic_ui/definitions/modules/sticky.js +3 -0
  8. data/assets/javascripts/semantic_ui/definitions/modules/tab.js +24 -38
  9. data/assets/javascripts/semantic_ui/definitions/modules/video.js +2 -2
  10. data/assets/stylesheets/semantic_ui/definitions/collections/form.less +18 -3
  11. data/assets/stylesheets/semantic_ui/definitions/collections/grid.less +23 -29
  12. data/assets/stylesheets/semantic_ui/definitions/collections/menu.less +5 -4
  13. data/assets/stylesheets/semantic_ui/definitions/collections/table.less +13 -0
  14. data/assets/stylesheets/semantic_ui/definitions/elements/input.less +15 -14
  15. data/assets/stylesheets/semantic_ui/definitions/elements/label.less +22 -50
  16. data/assets/stylesheets/semantic_ui/definitions/elements/list.less +9 -9
  17. data/assets/stylesheets/semantic_ui/definitions/globals/reset.less +3 -0
  18. data/assets/stylesheets/semantic_ui/definitions/globals/site.less +0 -7
  19. data/assets/stylesheets/semantic_ui/definitions/modules/checkbox.less +8 -6
  20. data/assets/stylesheets/semantic_ui/definitions/modules/dropdown.less +1 -0
  21. data/assets/stylesheets/semantic_ui/definitions/modules/popup.less +1 -0
  22. data/assets/stylesheets/semantic_ui/definitions/modules/progress.less +10 -10
  23. data/assets/stylesheets/semantic_ui/definitions/modules/sidebar.less +3 -5
  24. data/assets/stylesheets/semantic_ui/themes/default/elements/input.variables +1 -1
  25. data/assets/stylesheets/semantic_ui/themes/default/elements/label.variables +2 -1
  26. data/assets/stylesheets/semantic_ui/themes/default/modules/checkbox.variables +1 -0
  27. data/assets/stylesheets/semantic_ui/themes/default/modules/progress.variables +2 -2
  28. data/less-rails-semantic_ui.gemspec +1 -1
  29. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b57ce73a46e525d87a57cd9b4e72f008ae0031a4
4
- data.tar.gz: 706c945f6b8010709b95c489ecd171cb73c60261
3
+ metadata.gz: af4aa2caff4de2c9e63d1da32b3d1e023d719a56
4
+ data.tar.gz: f43d19955b19bcd7a5d98ca8b8a83cdca1b26b28
5
5
  SHA512:
6
- metadata.gz: feb94bd4abe3e03fd7d6c531205724a8797bfee0097b80ce0ab7c6d87f3624889f5564af3e825100ea338d8276b992437ec2bbec6118e46a432283b0bdc6abb1
7
- data.tar.gz: c8f61d63fd20667a0c99de6cd99ac47d1ed0c9537f8243ca1ab2d385c1d3f451f2c3f1acb7159d392279a15246fa212a7f3e3f5df1b95219a227e1fa7763ed6f
6
+ metadata.gz: 5a9878d1f53c308f5235600a9dde8f1a1718e362e40d9eb20356d7e3fdffdd2acbe92bc63479e2fc546d60c89667861a2b0d339b08dc0b6135a112b302843d04
7
+ data.tar.gz: cbebfeac146cb047096ade77a5cc81a92c5d41cb26080be21f317b7a5c790dd6eaa55e0c6c0840b541323bbfaa0657b93c68d33cafdf3600a8af934bc02ecaef
data/.travis.yml CHANGED
@@ -2,6 +2,7 @@ language: ruby
2
2
  rvm:
3
3
  - 2.0.0
4
4
  - 2.1.5
5
+ - 2.2.0
5
6
  before_install:
6
7
  - travis_retry gem install bundler
7
8
  - bundle --version
@@ -378,11 +378,11 @@ $.fn.dropdown = function(parameters) {
378
378
  text = module.get.choiceText($choice, false),
379
379
  value = module.get.choiceValue($choice, text)
380
380
  ;
381
- if( exactRegExp.test( text ) || exactRegExp.test( value ) ) {
381
+ if( text.match(exactRegExp) || value.match(exactRegExp) ) {
382
382
  $results = $results.add($choice);
383
383
  }
384
384
  else if(settings.fullTextSearch) {
385
- if( fullTextRegExp.test( text ) || fullTextRegExp.test( value ) ) {
385
+ if( text.match(fullTextRegExp) || value.match(fullTextRegExp) ) {
386
386
  $results = $results.add($choice);
387
387
  }
388
388
  }
@@ -605,16 +605,22 @@ $.fn.dropdown = function(parameters) {
605
605
 
606
606
  click: function (event) {
607
607
  var
608
- $choice = $(this),
609
- text = module.get.choiceText($choice),
610
- value = module.get.choiceValue($choice, text),
608
+ $choice = $(this),
609
+ $target = $(event.target),
610
+ $subMenu = $choice.find(selector.menu),
611
+ text = module.get.choiceText($choice),
612
+ value = module.get.choiceValue($choice, text),
611
613
  callback = function() {
612
614
  module.remove.searchTerm();
613
615
  module.determine.selectAction(text, value);
614
616
  },
615
- openingSubMenu = ($choice.find(selector.menu).size() > 0)
617
+ openingSubMenu = ($subMenu.size() > 0),
618
+ isSubItem = ($subMenu.find($target).size() > 0)
616
619
  ;
617
- if( !openingSubMenu ) {
620
+ if(isSubItem) {
621
+ return false;
622
+ }
623
+ if(!openingSubMenu || settings.allowCategorySelection) {
618
624
  callback();
619
625
  }
620
626
  }
@@ -738,6 +744,12 @@ $.fn.dropdown = function(parameters) {
738
744
  : settings.preserveHTML
739
745
  ;
740
746
  if($choice !== undefined) {
747
+ if($choice.find(selector.menu).size() > 0) {
748
+ module.verbose('Retreiving text of element with sub-menu');
749
+ $choice = $choice.clone();
750
+ $choice.find(selector.menu).remove();
751
+ $choice.find(selector.menuIcon).remove();
752
+ }
741
753
  return ($choice.data(metadata.text) !== undefined)
742
754
  ? $choice.data(metadata.text)
743
755
  : (preserveHTML)
@@ -1484,19 +1496,21 @@ $.fn.dropdown = function(parameters) {
1484
1496
 
1485
1497
  $.fn.dropdown.settings = {
1486
1498
 
1487
- debug : false,
1488
- verbose : true,
1489
- performance : true,
1499
+ debug : false,
1500
+ verbose : true,
1501
+ performance : true,
1490
1502
 
1491
- on : 'click',
1492
- action : 'activate',
1503
+ on : 'click',
1504
+ action : 'activate',
1493
1505
 
1494
- allowTab : true,
1495
- fullTextSearch : false,
1496
- preserveHTML : true,
1497
- sortSelect : false,
1506
+ allowTab : true,
1507
+ fullTextSearch : false,
1508
+ preserveHTML : true,
1509
+ sortSelect : false,
1498
1510
 
1499
- delay : {
1511
+ allowCategorySelection : false,
1512
+
1513
+ delay : {
1500
1514
  hide : 300,
1501
1515
  show : 200,
1502
1516
  search : 50,
@@ -1532,11 +1546,12 @@ $.fn.dropdown.settings = {
1532
1546
 
1533
1547
  selector : {
1534
1548
  dropdown : '.ui.dropdown',
1535
- text : '> .text:not(.icon)',
1536
1549
  input : '> input[type="hidden"], > select',
1537
- search : '> input.search, .menu > .search > input, .menu > input.search',
1550
+ item : '.item',
1538
1551
  menu : '.menu',
1539
- item : '.item'
1552
+ menuIcon : '.dropdown.icon',
1553
+ search : '> input.search, .menu > .search > input, .menu > input.search',
1554
+ text : '> .text:not(.icon)'
1540
1555
  },
1541
1556
 
1542
1557
  className : {
@@ -116,13 +116,20 @@ $.fn.popup = function(parameters) {
116
116
  }
117
117
  if(settings.popup) {
118
118
  $popup.addClass(className.loading);
119
- $offsetParent = $popup.offsetParent();
119
+ if($popup.offsetParent()[0] !== $module.offsetParent()[0]) {
120
+ module.debug('Moving popup to the same offset parent as activating element');
121
+ $offsetParent = $module.offsetParent();
122
+ $popup
123
+ .detach()
124
+ .appendTo($offsetParent)
125
+ ;
126
+ }
120
127
  $popup.removeClass(className.loading);
121
128
  }
122
129
  else {
123
130
  $offsetParent = (settings.inline)
124
- ? $target.offsetParent()
125
- : $body
131
+ ? $target.offsetParent()
132
+ : $body
126
133
  ;
127
134
  }
128
135
  if( $offsetParent.is('html') ) {
@@ -141,6 +148,8 @@ $.fn.popup = function(parameters) {
141
148
  if($popup && !settings.preserve) {
142
149
  module.removePopup();
143
150
  }
151
+ clearTimeout(module.hideTimer);
152
+ clearTimeout(module.showTimer);
144
153
  $module
145
154
  .off(eventNamespace)
146
155
  .removeData(moduleNamespace)
@@ -156,7 +165,7 @@ $.fn.popup = function(parameters) {
156
165
  ;
157
166
  clearTimeout(module.hideTimer);
158
167
  module.showTimer = setTimeout(function() {
159
- if( module.is.hidden() && !( module.is.active() && module.is.dropdown()) ) {
168
+ if(module.is.hidden() && !( module.is.active() && module.is.dropdown()) ) {
160
169
  module.show();
161
170
  }
162
171
  }, delay);
@@ -169,7 +178,7 @@ $.fn.popup = function(parameters) {
169
178
  ;
170
179
  clearTimeout(module.showTimer);
171
180
  module.hideTimer = setTimeout(function() {
172
- if( module.is.visible() ) {
181
+ if(module.is.visible() ) {
173
182
  module.hide();
174
183
  }
175
184
  }, delay);
@@ -301,19 +310,22 @@ $.fn.popup = function(parameters) {
301
310
  return false;
302
311
  }
303
312
  if(settings.inline || settings.popup) {
304
- return ( $popup.size() !== 0 );
313
+ return ( module.has.popup() );
305
314
  }
306
315
  else {
307
- return ( $popup.closest($context).size() );
316
+ return ( $popup.closest($context).size() > 1 )
317
+ ? true
318
+ : false
319
+ ;
308
320
  }
309
321
  },
310
322
 
311
323
  removePopup: function() {
312
- module.debug('Removing popup');
313
- $.proxy(settings.onRemove, $popup)(element);
314
- if($popup.size() > 0) {
324
+ module.debug('Removing popup', $popup);
325
+ if( module.has.popup() ) {
315
326
  $popup.remove();
316
327
  }
328
+ $.proxy(settings.onRemove, $popup)(element);
317
329
  },
318
330
 
319
331
  save: {
@@ -724,7 +736,7 @@ $.fn.popup = function(parameters) {
724
736
  bind: {
725
737
  popup: function() {
726
738
  module.verbose('Allowing hover events on popup to prevent closing');
727
- if($popup && $popup.size() > 0) {
739
+ if( $popup && module.has.popup() ) {
728
740
  $popup
729
741
  .on('mouseenter' + eventNamespace, module.event.start)
730
742
  .on('mouseleave' + eventNamespace, module.event.end)
@@ -773,6 +785,12 @@ $.fn.popup = function(parameters) {
773
785
  }
774
786
  },
775
787
 
788
+ has: {
789
+ popup: function() {
790
+ return ($popup.size() > 0);
791
+ }
792
+ },
793
+
776
794
  is: {
777
795
  active: function() {
778
796
  return $module.hasClass(className.active);
@@ -52,14 +52,21 @@ $.fn.progress = function(parameters) {
52
52
 
53
53
  element = this,
54
54
  instance = $module.data(moduleNamespace),
55
+
56
+ animating = false,
57
+ transitionEnd,
55
58
  module
56
59
  ;
57
60
 
58
61
  module = {
59
62
 
60
63
  initialize: function() {
61
- module.debug('Initializing progress', settings);
64
+ module.debug('Initializing progress bar', settings);
65
+
66
+ transitionEnd = module.get.transitionEnd();
67
+
62
68
  module.read.metadata();
69
+ module.set.duration();
63
70
  module.set.initials();
64
71
  module.instantiate();
65
72
  },
@@ -71,9 +78,9 @@ $.fn.progress = function(parameters) {
71
78
  .data(moduleNamespace, module)
72
79
  ;
73
80
  },
74
-
75
81
  destroy: function() {
76
82
  module.verbose('Destroying previous progress for', $module);
83
+ clearInterval(instance.interval);
77
84
  module.remove.state();
78
85
  $module.removeData(moduleNamespace);
79
86
  instance = undefined;
@@ -174,9 +181,11 @@ $.fn.progress = function(parameters) {
174
181
  get: {
175
182
  text: function(templateText) {
176
183
  var
177
- value = module.value || 0,
178
- total = module.total || 0,
179
- percent = module.percent || 0
184
+ value = module.value || 0,
185
+ total = module.total || 0,
186
+ percent = (module.is.visible() && animating)
187
+ ? module.get.displayPercent()
188
+ : module.percent || 0
180
189
  ;
181
190
  templateText = templateText || '';
182
191
  templateText = templateText
@@ -191,6 +200,41 @@ $.fn.progress = function(parameters) {
191
200
  module.debug('Generating random increment percentage');
192
201
  return Math.floor((Math.random() * settings.random.max) + settings.random.min);
193
202
  },
203
+
204
+ transitionEnd: function() {
205
+ var
206
+ element = document.createElement('element'),
207
+ transitions = {
208
+ 'transition' :'transitionend',
209
+ 'OTransition' :'oTransitionEnd',
210
+ 'MozTransition' :'transitionend',
211
+ 'WebkitTransition' :'webkitTransitionEnd'
212
+ },
213
+ transition
214
+ ;
215
+ for(transition in transitions){
216
+ if( element.style[transition] !== undefined ){
217
+ return transitions[transition];
218
+ }
219
+ }
220
+ },
221
+
222
+ // gets current displayed percentage (if animating values this is the intermediary value)
223
+ displayPercent: function() {
224
+ var
225
+ barWidth = $bar.width(),
226
+ totalWidth = $module.width(),
227
+ minDisplay = parseInt($bar.css('min-width'), 10),
228
+ displayPercent = (barWidth > minDisplay)
229
+ ? (barWidth / totalWidth * 100)
230
+ : module.percent
231
+ ;
232
+ if(settings.precision === 0) {
233
+ return Math.round(displayPercent);
234
+ }
235
+ return Math.round(displayPercent * (10 * settings.precision) / (10 * settings.precision) );
236
+ },
237
+
194
238
  percent: function() {
195
239
  return module.percent || 0;
196
240
  },
@@ -211,6 +255,12 @@ $.fn.progress = function(parameters) {
211
255
  },
212
256
  error: function() {
213
257
  return $module.hasClass(className.error);
258
+ },
259
+ active: function() {
260
+ return $module.hasClass(className.active);
261
+ },
262
+ visible: function() {
263
+ return $module.is(':visible');
214
264
  }
215
265
  },
216
266
 
@@ -256,8 +306,24 @@ $.fn.progress = function(parameters) {
256
306
  ;
257
307
  }
258
308
  },
309
+ duration: function(duration) {
310
+ duration = duration || settings.duration;
311
+ duration = (typeof duration == 'number')
312
+ ? duration + 'ms'
313
+ : duration
314
+ ;
315
+ module.verbose('Setting progress bar transition duration', duration);
316
+ $bar
317
+ .css({
318
+ '-webkit-transition-duration': duration,
319
+ '-moz-transition-duration': duration,
320
+ '-ms-transition-duration': duration,
321
+ '-o-transition-duration': duration,
322
+ 'transition-duration': duration
323
+ })
324
+ ;
325
+ },
259
326
  initials: function() {
260
-
261
327
  if(settings.total !== false) {
262
328
  module.verbose('Current total set in settings', settings.total);
263
329
  module.total = settings.total;
@@ -270,7 +336,6 @@ $.fn.progress = function(parameters) {
270
336
  module.verbose('Current percent set in settings', settings.percent);
271
337
  module.percent = settings.percent;
272
338
  }
273
-
274
339
  if(module.percent !== undefined) {
275
340
  module.set.percent(module.percent);
276
341
  }
@@ -307,27 +372,60 @@ $.fn.progress = function(parameters) {
307
372
  ;
308
373
  }
309
374
  module.set.barWidth(percent);
375
+ if( module.is.visible() ) {
376
+ module.set.labelInterval();
377
+ }
378
+ module.set.labels();
379
+ settings.onChange.call(element, percent, module.value, module.total);
380
+ },
381
+ labelInterval: function() {
382
+ clearInterval(module.interval);
383
+ $bar
384
+ .one(transitionEnd + eventNamespace, function() {
385
+ module.verbose('Bar finished animating, removing continuous label updates');
386
+ clearInterval(module.interval);
387
+ animating = false;
388
+ module.set.labels();
389
+ })
390
+ ;
391
+ animating = true;
392
+ module.interval = setInterval(module.set.labels, settings.framerate);
393
+ },
394
+ labels: function() {
395
+ module.verbose('Setting both bar progress and outer label text');
310
396
  module.set.barLabel();
397
+ module.set.state();
398
+ },
399
+ label: function(text) {
400
+ text = text || '';
401
+ if(text) {
402
+ text = module.get.text(text);
403
+ module.debug('Setting label to text', text);
404
+ $label.text(text);
405
+ }
406
+ },
407
+ state: function(percent) {
408
+ percent = (percent !== undefined)
409
+ ? percent
410
+ : module.percent
411
+ ;
311
412
  if(percent === 100) {
312
413
  if(settings.autoSuccess && !(module.is.warning() || module.is.error())) {
313
414
  module.set.success();
314
415
  module.debug('Automatically triggering success at 100%');
315
416
  }
316
417
  else {
418
+ module.verbose('Reached 100% removing active state');
317
419
  module.remove.active();
318
420
  }
319
421
  }
320
422
  else if(percent > 0) {
423
+ module.verbose('Adjusting active progress bar label', percent);
321
424
  module.set.active();
322
425
  }
323
- $.proxy(settings.onChange, element)(percent, module.value, module.total);
324
- },
325
- label: function(text) {
326
- text = text || '';
327
- if(text) {
328
- text = module.get.text(text);
329
- module.debug('Setting label to text', text);
330
- $label.text(text);
426
+ else {
427
+ module.remove.active();
428
+ module.set.label(settings.text.active);
331
429
  }
332
430
  },
333
431
  barLabel: function(text) {
@@ -346,7 +444,7 @@ $.fn.progress = function(parameters) {
346
444
  active: function(text) {
347
445
  text = text || settings.text.active;
348
446
  module.debug('Setting active state');
349
- if(settings.showActivity) {
447
+ if(settings.showActivity && !module.is.active() ) {
350
448
  $module.addClass(className.active);
351
449
  }
352
450
  module.remove.warning();
@@ -355,7 +453,7 @@ $.fn.progress = function(parameters) {
355
453
  if(text) {
356
454
  module.set.label(text);
357
455
  }
358
- $.proxy(settings.onActive, element)(module.value, module.total);
456
+ settings.onActive.call(element, module.value, module.total);
359
457
  },
360
458
  success : function(text) {
361
459
  text = text || settings.text.success;
@@ -368,7 +466,7 @@ $.fn.progress = function(parameters) {
368
466
  if(text) {
369
467
  module.set.label(text);
370
468
  }
371
- $.proxy(settings.onSuccess, element)(module.total);
469
+ settings.onSuccess.call(element, module.total);
372
470
  },
373
471
  warning : function(text) {
374
472
  text = text || settings.text.warning;
@@ -381,7 +479,7 @@ $.fn.progress = function(parameters) {
381
479
  if(text) {
382
480
  module.set.label(text);
383
481
  }
384
- $.proxy(settings.onWarning, element)(module.value, module.total);
482
+ settings.onWarning.call(element, module.value, module.total);
385
483
  },
386
484
  error : function(text) {
387
485
  text = text || settings.text.error;
@@ -394,7 +492,7 @@ $.fn.progress = function(parameters) {
394
492
  if(text) {
395
493
  module.set.label(text);
396
494
  }
397
- $.proxy(settings.onError, element)(module.value, module.total);
495
+ settings.onError.call(element, module.value, module.total);
398
496
  },
399
497
  total: function(totalValue) {
400
498
  module.total = totalValue;
@@ -616,12 +714,15 @@ $.fn.progress.settings = {
616
714
  max : 5
617
715
  },
618
716
 
717
+ duration : 300,
718
+
619
719
  autoSuccess : true,
620
720
  showActivity : true,
621
721
  limitValues : true,
622
722
 
623
723
  label : 'percent',
624
724
  precision : 1,
725
+ framerate : (1000 / 30), /// 30 fps
625
726
 
626
727
  percent : false,
627
728
  total : false,