less-rails-semantic_ui 1.6.2.0 → 1.7.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/assets/javascripts/semantic_ui/definitions/behaviors/api.js +9 -9
  3. data/assets/javascripts/semantic_ui/definitions/behaviors/form.js +23 -23
  4. data/assets/javascripts/semantic_ui/definitions/behaviors/state.js +6 -6
  5. data/assets/javascripts/semantic_ui/definitions/behaviors/visibility.js +3 -3
  6. data/assets/javascripts/semantic_ui/definitions/behaviors/visit.js +7 -7
  7. data/assets/javascripts/semantic_ui/definitions/globals/site.js +2 -2
  8. data/assets/javascripts/semantic_ui/definitions/modules/accordion.js +12 -12
  9. data/assets/javascripts/semantic_ui/definitions/modules/checkbox.js +14 -13
  10. data/assets/javascripts/semantic_ui/definitions/modules/dimmer.js +9 -9
  11. data/assets/javascripts/semantic_ui/definitions/modules/dropdown.js +98 -58
  12. data/assets/javascripts/semantic_ui/definitions/modules/modal.js +14 -14
  13. data/assets/javascripts/semantic_ui/definitions/modules/popup.js +90 -39
  14. data/assets/javascripts/semantic_ui/definitions/modules/progress.js +12 -6
  15. data/assets/javascripts/semantic_ui/definitions/modules/rating.js +6 -6
  16. data/assets/javascripts/semantic_ui/definitions/modules/search.js +216 -205
  17. data/assets/javascripts/semantic_ui/definitions/modules/shape.js +8 -8
  18. data/assets/javascripts/semantic_ui/definitions/modules/sidebar.js +112 -89
  19. data/assets/javascripts/semantic_ui/definitions/modules/sticky.js +11 -11
  20. data/assets/javascripts/semantic_ui/definitions/modules/tab.js +12 -12
  21. data/assets/javascripts/semantic_ui/definitions/modules/transition.js +9 -9
  22. data/assets/javascripts/semantic_ui/definitions/modules/video.js +4 -4
  23. data/assets/stylesheets/semantic_ui/definitions/collections/grid.less +65 -10
  24. data/assets/stylesheets/semantic_ui/definitions/collections/menu.less +10 -6
  25. data/assets/stylesheets/semantic_ui/definitions/elements/button.less +54 -55
  26. data/assets/stylesheets/semantic_ui/definitions/elements/label.less +4 -4
  27. data/assets/stylesheets/semantic_ui/definitions/elements/list.less +4 -2
  28. data/assets/stylesheets/semantic_ui/definitions/elements/segment.less +0 -7
  29. data/assets/stylesheets/semantic_ui/definitions/elements/step.less +41 -40
  30. data/assets/stylesheets/semantic_ui/definitions/globals/site.less +19 -0
  31. data/assets/stylesheets/semantic_ui/definitions/modules/dropdown.less +108 -23
  32. data/assets/stylesheets/semantic_ui/definitions/modules/popup.less +0 -2
  33. data/assets/stylesheets/semantic_ui/definitions/modules/sidebar.less +109 -27
  34. data/assets/stylesheets/semantic_ui/themes/default/collections/menu.variables +3 -0
  35. data/assets/stylesheets/semantic_ui/themes/default/elements/button.variables +24 -0
  36. data/assets/stylesheets/semantic_ui/themes/default/globals/site.variables +5 -2
  37. data/assets/stylesheets/semantic_ui/themes/default/modules/dropdown.variables +22 -6
  38. data/assets/stylesheets/semantic_ui/themes/default/modules/sidebar.variables +21 -12
  39. data/assets/stylesheets/semantic_ui/themes/material/elements/button.overrides +0 -4
  40. data/assets/stylesheets/semantic_ui/themes/rtl/globals/site.overrides +6 -0
  41. data/assets/stylesheets/semantic_ui/themes/rtl/globals/site.variables +14 -0
  42. data/lib/less/rails/semantic_ui/version.rb +1 -1
  43. metadata +4 -2
@@ -56,7 +56,7 @@ $.fn.rating = function(parameters) {
56
56
  initialize: function() {
57
57
  module.verbose('Initializing rating module', settings);
58
58
 
59
- if($icon.size() === 0) {
59
+ if($icon.length === 0) {
60
60
  module.setup.layout();
61
61
  }
62
62
 
@@ -144,7 +144,7 @@ $.fn.rating = function(parameters) {
144
144
  currentRating = module.getRating(),
145
145
  rating = $icon.index($activeIcon) + 1,
146
146
  canClear = (settings.clearable == 'auto')
147
- ? ($icon.size() === 1)
147
+ ? ($icon.length === 1)
148
148
  : settings.clearable
149
149
  ;
150
150
  if(canClear && currentRating == rating) {
@@ -163,7 +163,7 @@ $.fn.rating = function(parameters) {
163
163
 
164
164
  getRating: function() {
165
165
  var
166
- currentRating = $icon.filter('.' + className.active).size()
166
+ currentRating = $icon.filter('.' + className.active).length
167
167
  ;
168
168
  module.verbose('Current rating retrieved', currentRating);
169
169
  return currentRating;
@@ -213,7 +213,7 @@ $.fn.rating = function(parameters) {
213
213
  .addClass(className.active)
214
214
  ;
215
215
  }
216
- $.proxy(settings.onRate, element)(rating);
216
+ settings.onRate.call(element, rating);
217
217
  },
218
218
 
219
219
  setting: function(name, value) {
@@ -301,8 +301,8 @@ $.fn.rating = function(parameters) {
301
301
  if(moduleSelector) {
302
302
  title += ' \'' + moduleSelector + '\'';
303
303
  }
304
- if($allModules.size() > 1) {
305
- title += ' ' + '(' + $allModules.size() + ')';
304
+ if($allModules.length > 1) {
305
+ title += ' ' + '(' + $allModules.length + ')';
306
306
  }
307
307
  if( (console.group !== undefined || console.table !== undefined) && performance.length > 0) {
308
308
  console.groupCollapsed(title);
@@ -65,7 +65,7 @@ $.fn.search = function(parameters) {
65
65
  ;
66
66
  if(settings.automatic) {
67
67
  $prompt
68
- .on(inputEvent + eventNamespace, module.search.throttle)
68
+ .on(inputEvent + eventNamespace, module.throttle)
69
69
  ;
70
70
  }
71
71
  $prompt
@@ -74,12 +74,12 @@ $.fn.search = function(parameters) {
74
74
  .on('keydown' + eventNamespace, module.handleKeyboard)
75
75
  ;
76
76
  $searchButton
77
- .on('click' + eventNamespace, module.search.query)
77
+ .on('click' + eventNamespace, module.query)
78
78
  ;
79
79
  $results
80
- .on('mousedown' + eventNamespace, module.event.mousedown)
81
- .on('mouseup' + eventNamespace, module.event.mouseup)
82
- .on('click' + eventNamespace, selector.result, module.results.select)
80
+ .on('mousedown' + eventNamespace, module.event.result.mousedown)
81
+ .on('mouseup' + eventNamespace, module.event.result.mouseup)
82
+ .on('click' + eventNamespace, selector.result, module.event.result.click)
83
83
  ;
84
84
  module.instantiate();
85
85
  },
@@ -111,24 +111,57 @@ $.fn.search = function(parameters) {
111
111
  .addClass(className.focus)
112
112
  ;
113
113
  clearTimeout(module.timer);
114
- module.search.throttle();
115
- if(module.has.minimum()) {
116
- module.results.show();
114
+ module.throttle();
115
+ if( module.has.minimumCharacters() ) {
116
+ module.showResults();
117
117
  }
118
118
  },
119
- mousedown: function() {
120
- module.resultsClicked = true;
121
- },
122
- mouseup: function() {
123
- module.resultsClicked = false;
124
- },
125
119
  blur: function(event) {
126
- module.search.cancel();
120
+ module.cancel();
127
121
  $module
128
122
  .removeClass(className.focus)
129
123
  ;
130
124
  if(!module.resultsClicked) {
131
- module.timer = setTimeout(module.results.hide, settings.hideDelay);
125
+ module.timer = setTimeout(module.hideResults, settings.hideDelay);
126
+ }
127
+ },
128
+ result: {
129
+ mousedown: function() {
130
+ module.resultsClicked = true;
131
+ },
132
+ mouseup: function() {
133
+ module.resultsClicked = false;
134
+ },
135
+ click: function(event) {
136
+ module.debug('Search result selected');
137
+ var
138
+ $result = $(this),
139
+ $title = $result.find('.title'),
140
+ title = $title.html()
141
+ ;
142
+ if(settings.onSelect == 'default' || settings.onSelect.call(this, event) == 'default') {
143
+ var
144
+ $link = $result.find('a[href]').eq(0),
145
+ $title = $result.find(selector.title).eq(0),
146
+ href = $link.attr('href') || false,
147
+ target = $link.attr('target') || false,
148
+ name = ($title.length > 0)
149
+ ? $title.text()
150
+ : false
151
+ ;
152
+ module.hideResults();
153
+ if(name) {
154
+ $prompt.val(name);
155
+ }
156
+ if(href) {
157
+ if(target == '_blank' || event.ctrlKey) {
158
+ window.open(href);
159
+ }
160
+ else {
161
+ window.location.href = (href);
162
+ }
163
+ }
164
+ }
132
165
  }
133
166
  }
134
167
  },
@@ -147,7 +180,7 @@ $.fn.search = function(parameters) {
147
180
  },
148
181
  activeClass = className.active,
149
182
  currentIndex = $result.index( $result.filter('.' + activeClass) ),
150
- resultSize = $result.size(),
183
+ resultSize = $result.length,
151
184
  newIndex
152
185
  ;
153
186
  // search shortcuts
@@ -158,11 +191,11 @@ $.fn.search = function(parameters) {
158
191
  ;
159
192
  }
160
193
  // result shortcuts
161
- if($results.filter(':visible').size() > 0) {
194
+ if($results.filter(':visible').length > 0) {
162
195
  if(keyCode == keys.enter) {
163
196
  module.verbose('Enter key pressed, selecting active result');
164
- if( $result.filter('.' + activeClass).size() > 0 ) {
165
- $.proxy(module.results.select, $result.filter('.' + activeClass) )(event);
197
+ if( $result.filter('.' + activeClass).length > 0 ) {
198
+ module.event.result.click.call($result.filter('.' + activeClass), event);
166
199
  event.preventDefault();
167
200
  return false;
168
201
  }
@@ -208,7 +241,7 @@ $.fn.search = function(parameters) {
208
241
  // query shortcuts
209
242
  if(keyCode == keys.enter) {
210
243
  module.verbose('Enter key pressed, executing query');
211
- module.search.query();
244
+ module.query();
212
245
  $searchButton
213
246
  .addClass(className.down)
214
247
  ;
@@ -222,64 +255,39 @@ $.fn.search = function(parameters) {
222
255
  }
223
256
  }
224
257
  },
225
- has: {
226
- minimum: function() {
227
- var
228
- searchTerm = $prompt.val(),
229
- numCharacters = searchTerm.length
230
- ;
231
- return (numCharacters >= settings.minCharacters);
258
+
259
+ query: function() {
260
+ var
261
+ searchTerm = $prompt.val(),
262
+ cachedHTML = module.read.cache(searchTerm)
263
+ ;
264
+ if(cachedHTML) {
265
+ module.debug('Reading result for ' + searchTerm + ' from cache');
266
+ module.addResults(cachedHTML);
232
267
  }
233
- },
234
- search: {
235
- cancel: function() {
236
- var
237
- xhr = $module.data('xhr') || false
238
- ;
239
- if( xhr && xhr.state() != 'resolved') {
240
- module.debug('Cancelling last search');
241
- xhr.abort();
268
+ else {
269
+ module.debug('Querying for ' + searchTerm);
270
+ if($.isPlainObject(settings.source) || $.isArray(settings.source)) {
271
+ module.search.local(searchTerm);
242
272
  }
243
- },
244
- throttle: function() {
245
- clearTimeout(module.timer);
246
- if(module.has.minimum()) {
247
- module.timer = setTimeout(module.search.query, settings.searchDelay);
273
+ else if(settings.apiSettings) {
274
+ module.search.remote(searchTerm);
248
275
  }
249
- else {
250
- module.results.hide();
251
- }
252
- },
253
- query: function() {
254
- var
255
- searchTerm = $prompt.val(),
256
- cachedHTML = module.search.cache.read(searchTerm)
257
- ;
258
- if(cachedHTML) {
259
- module.debug("Reading result for '" + searchTerm + "' from cache");
260
- module.results.add(cachedHTML);
276
+ else if($.fn.api !== undefined && $.api.settings.api.search !== undefined) {
277
+ module.debug('Searching with default search API endpoint');
278
+ settings.apiSettings = {
279
+ action: 'search'
280
+ };
281
+ module.search.remote(searchTerm);
261
282
  }
262
283
  else {
263
- module.debug("Querying for '" + searchTerm + "'");
264
- if($.isPlainObject(settings.source) || $.isArray(settings.source)) {
265
- module.search.local(searchTerm);
266
- }
267
- else if(settings.apiSettings) {
268
- module.search.remote(searchTerm);
269
- }
270
- else if($.fn.api !== undefined && $.api.settings.api.search !== undefined) {
271
- module.debug('Searching with default search API endpoint');
272
- settings.apiSettings = {
273
- action: 'search'
274
- };
275
- module.search.remote(searchTerm);
276
- }
277
- else {
278
- module.error(error.source);
279
- }
280
- $.proxy(settings.onSearchQuery, $module)(searchTerm);
284
+ module.error(error.source);
281
285
  }
282
- },
286
+ settings.onSearchQuery.call(element, searchTerm);
287
+ }
288
+ },
289
+
290
+ search: {
283
291
  local: function(searchTerm) {
284
292
  var
285
293
  results = [],
@@ -311,14 +319,14 @@ $.fn.search = function(parameters) {
311
319
  }
312
320
  });
313
321
  });
314
- searchHTML = module.results.generate({
322
+ searchHTML = module.generateResults({
315
323
  results: $.merge(results, fullTextResults)
316
324
  });
317
325
  $module
318
326
  .removeClass(className.loading)
319
327
  ;
320
- module.search.cache.write(searchTerm, searchHTML);
321
- module.results.add(searchHTML);
328
+ module.write.cache(searchTerm, searchHTML);
329
+ module.addResults(searchHTML);
322
330
  },
323
331
  remote: function(searchTerm) {
324
332
  var
@@ -328,160 +336,163 @@ $.fn.search = function(parameters) {
328
336
  query: searchTerm
329
337
  },
330
338
  onSuccess : function(response) {
331
- searchHTML = module.results.generate(response);
332
- module.search.cache.write(searchTerm, searchHTML);
333
- module.results.add(searchHTML);
339
+ searchHTML = module.generateResults(response);
340
+ module.write.cache(searchTerm, searchHTML);
341
+ module.addResults(searchHTML);
334
342
  },
335
343
  onFailure : module.error
336
344
  },
337
345
  searchHTML
338
346
  ;
339
- module.search.cancel();
347
+ module.cancel();
340
348
  module.debug('Executing search');
341
349
  $.extend(true, apiSettings, settings.apiSettings);
342
350
  $.api(apiSettings);
343
- },
351
+ }
344
352
 
345
- cache: {
346
- read: function(name) {
347
- var
348
- cache = $module.data('cache')
349
- ;
350
- return (settings.cache && (typeof cache == 'object') && (cache[name] !== undefined) )
351
- ? cache[name]
352
- : false
353
- ;
354
- },
355
- write: function(name, value) {
356
- var
357
- cache = ($module.data('cache') !== undefined)
358
- ? $module.data('cache')
359
- : {}
360
- ;
361
- cache[name] = value;
362
- $module
363
- .data('cache', cache)
364
- ;
365
- }
353
+ },
354
+
355
+ throttle: function() {
356
+ clearTimeout(module.timer);
357
+ if(module.has.minimumCharacters()) {
358
+ module.timer = setTimeout(module.query, settings.searchDelay);
359
+ }
360
+ else {
361
+ module.hideResults();
366
362
  }
367
363
  },
368
364
 
369
- results: {
370
- generate: function(response) {
371
- module.debug('Generating html from response', response);
365
+ cancel: function() {
366
+ var
367
+ xhr = $module.data('xhr') || false
368
+ ;
369
+ if( xhr && xhr.state() != 'resolved') {
370
+ module.debug('Cancelling last search');
371
+ xhr.abort();
372
+ }
373
+ },
374
+
375
+ has: {
376
+ minimumCharacters: function() {
372
377
  var
373
- template = settings.templates[settings.type],
374
- html = ''
378
+ searchTerm = $prompt.val(),
379
+ numCharacters = searchTerm.length
375
380
  ;
376
- if(($.isPlainObject(response.results) && !$.isEmptyObject(response.results)) || ($.isArray(response.results) && response.results.length > 0) ) {
377
- if(settings.maxResults > 0) {
378
- response.results = $.isArray(response.results)
379
- ? response.results.slice(0, settings.maxResults)
380
- : response.results
381
- ;
382
- }
383
- if($.isFunction(template)) {
384
- html = template(response);
385
- }
386
- else {
387
- module.error(error.noTemplate, false);
388
- }
381
+ return (numCharacters >= settings.minCharacters);
382
+ }
383
+ },
384
+
385
+ read: {
386
+ cache: function(name) {
387
+ var
388
+ cache = $module.data('cache')
389
+ ;
390
+ return (settings.cache && (typeof cache == 'object') && (cache[name] !== undefined) )
391
+ ? cache[name]
392
+ : false
393
+ ;
394
+ }
395
+ },
396
+
397
+ write: {
398
+ cache: function(name, value) {
399
+ var
400
+ cache = ($module.data('cache') !== undefined)
401
+ ? $module.data('cache')
402
+ : {}
403
+ ;
404
+ cache[name] = value;
405
+ $module
406
+ .data('cache', cache)
407
+ ;
408
+ }
409
+ },
410
+
411
+ addResults: function(html) {
412
+ if(settings.onResultsAdd == 'default' || settings.onResultsAdd.call($results, html) == 'default') {
413
+ $results
414
+ .html(html)
415
+ ;
416
+ }
417
+ module.showResults();
418
+ },
419
+
420
+ showResults: function() {
421
+ if( ($results.filter(':visible').length === 0) && ($prompt.filter(':focus').length > 0) && $results.html() !== '') {
422
+ if(settings.transition && $.fn.transition !== undefined && $module.transition('is supported') && !$results.transition('is inward')) {
423
+ module.debug('Showing results with css animations');
424
+ $results
425
+ .transition({
426
+ animation : settings.transition + ' in',
427
+ duration : settings.duration,
428
+ queue : true
429
+ })
430
+ ;
389
431
  }
390
432
  else {
391
- html = module.message(error.noResults, 'empty');
392
- }
393
- $.proxy(settings.onResults, $module)(response);
394
- return html;
395
- },
396
- add: function(html) {
397
- if(settings.onResultsAdd == 'default' || $.proxy(settings.onResultsAdd, $results)(html) == 'default') {
433
+ module.debug('Showing results with javascript');
398
434
  $results
399
- .html(html)
435
+ .stop()
436
+ .fadeIn(settings.duration, settings.easing)
400
437
  ;
401
438
  }
402
- module.results.show();
403
- },
404
- show: function() {
405
- if( ($results.filter(':visible').size() === 0) && ($prompt.filter(':focus').size() > 0) && $results.html() !== '') {
406
- if(settings.transition && $.fn.transition !== undefined && $module.transition('is supported') && !$results.transition('is inward')) {
407
- module.debug('Showing results with css animations');
408
- $results
409
- .transition({
410
- animation : settings.transition + ' in',
411
- duration : settings.duration,
412
- queue : true
413
- })
414
- ;
415
- }
416
- else {
417
- module.debug('Showing results with javascript');
418
- $results
419
- .stop()
420
- .fadeIn(settings.duration, settings.easing)
421
- ;
422
- }
423
- $.proxy(settings.onResultsOpen, $results)();
439
+ settings.onResultsOpen.call($results);
440
+ }
441
+ },
442
+ hideResults: function() {
443
+ if($results.filter(':visible').length > 0) {
444
+ if(settings.transition && $.fn.transition !== undefined && $module.transition('is supported') && !$results.transition('is outward')) {
445
+ module.debug('Hiding results with css animations');
446
+ $results
447
+ .transition({
448
+ animation : settings.transition + ' out',
449
+ duration : settings.duration,
450
+ queue : true
451
+ })
452
+ ;
424
453
  }
425
- },
426
- hide: function() {
427
- if($results.filter(':visible').size() > 0) {
428
- if(settings.transition && $.fn.transition !== undefined && $module.transition('is supported') && !$results.transition('is outward')) {
429
- module.debug('Hiding results with css animations');
430
- $results
431
- .transition({
432
- animation : settings.transition + ' out',
433
- duration : settings.duration,
434
- queue : true
435
- })
436
- ;
437
- }
438
- else {
439
- module.debug('Hiding results with javascript');
440
- $results
441
- .stop()
442
- .fadeIn(settings.duration, settings.easing)
443
- ;
444
- }
445
- $.proxy(settings.onResultsClose, $results)();
454
+ else {
455
+ module.debug('Hiding results with javascript');
456
+ $results
457
+ .stop()
458
+ .fadeIn(settings.duration, settings.easing)
459
+ ;
446
460
  }
447
- },
448
- select: function(event) {
449
- module.debug('Search result selected');
450
- var
451
- $result = $(this),
452
- $title = $result.find('.title'),
453
- title = $title.html()
454
- ;
455
- if(settings.onSelect == 'default' || $.proxy(settings.onSelect, this)(event) == 'default') {
456
- var
457
- $link = $result.find('a[href]').eq(0),
458
- $title = $result.find(selector.title).eq(0),
459
- href = $link.attr('href') || false,
460
- target = $link.attr('target') || false,
461
- name = ($title.size() > 0)
462
- ? $title.text()
463
- : false
461
+ settings.onResultsClose.call($results);
462
+ }
463
+ },
464
+
465
+ generateResults: function(response) {
466
+ module.debug('Generating html from response', response);
467
+ var
468
+ template = settings.templates[settings.type],
469
+ html = ''
470
+ ;
471
+ if(($.isPlainObject(response.results) && !$.isEmptyObject(response.results)) || ($.isArray(response.results) && response.results.length > 0) ) {
472
+ if(settings.maxResults > 0) {
473
+ response.results = $.isArray(response.results)
474
+ ? response.results.slice(0, settings.maxResults)
475
+ : response.results
464
476
  ;
465
- module.results.hide();
466
- if(name) {
467
- $prompt.val(name);
468
- }
469
- if(href) {
470
- if(target == '_blank' || event.ctrlKey) {
471
- window.open(href);
472
- }
473
- else {
474
- window.location.href = (href);
475
- }
476
- }
477
477
  }
478
+ if($.isFunction(template)) {
479
+ html = template(response);
480
+ }
481
+ else {
482
+ module.error(error.noTemplate, false);
483
+ }
484
+ }
485
+ else {
486
+ html = module.displayMessage(error.noResults, 'empty');
478
487
  }
488
+ settings.onResults.call(element, response);
489
+ return html;
479
490
  },
480
491
 
481
- // displays mesage visibly in search results
482
- message: function(text, type) {
492
+ displayMessage: function(text, type) {
483
493
  type = type || 'standard';
484
- module.results.add( settings.templates.message(text, type) );
494
+ module.debug('Displaying message', text, type);
495
+ module.addResults( settings.templates.message(text, type) );
485
496
  return settings.templates.message(text, type);
486
497
  },
487
498
 
@@ -569,8 +580,8 @@ $.fn.search = function(parameters) {
569
580
  if(moduleSelector) {
570
581
  title += ' \'' + moduleSelector + '\'';
571
582
  }
572
- if($allModules.size() > 1) {
573
- title += ' ' + '(' + $allModules.size() + ')';
583
+ if($allModules.length > 1) {
584
+ title += ' ' + '(' + $allModules.length + ')';
574
585
  }
575
586
  if( (console.group !== undefined || console.table !== undefined) && performance.length > 0) {
576
587
  console.groupCollapsed(title);