semantic-ui-rails 0.1.0.2 → 0.3.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +7 -0
  3. data/lib/semantic/ui/rails/version.rb +1 -1
  4. data/semantic.thor +3 -3
  5. data/vendor/assets/javascripts/semantic-ui/modules/accordion.js +24 -18
  6. data/vendor/assets/javascripts/semantic-ui/modules/chatroom.js +7 -7
  7. data/vendor/assets/javascripts/semantic-ui/modules/checkbox.js +9 -10
  8. data/vendor/assets/javascripts/semantic-ui/modules/dimmer.js +38 -24
  9. data/vendor/assets/javascripts/semantic-ui/modules/dropdown.js +72 -37
  10. data/vendor/assets/javascripts/semantic-ui/modules/modal.js +62 -48
  11. data/vendor/assets/javascripts/semantic-ui/modules/nag.js +10 -9
  12. data/vendor/assets/javascripts/semantic-ui/modules/popup.js +46 -40
  13. data/vendor/assets/javascripts/semantic-ui/modules/rating.js +15 -15
  14. data/vendor/assets/javascripts/semantic-ui/modules/search.js +19 -19
  15. data/vendor/assets/javascripts/semantic-ui/modules/shape.js +13 -13
  16. data/vendor/assets/javascripts/semantic-ui/modules/sidebar.js +12 -12
  17. data/vendor/assets/javascripts/semantic-ui/modules/transition.js +15 -15
  18. data/vendor/assets/javascripts/semantic-ui/modules/video.js +13 -13
  19. data/vendor/assets/stylesheets/semantic-ui/collections/form.less +42 -25
  20. data/vendor/assets/stylesheets/semantic-ui/collections/grid.less +32 -16
  21. data/vendor/assets/stylesheets/semantic-ui/collections/menu.less +1 -1
  22. data/vendor/assets/stylesheets/semantic-ui/collections/table.less +3 -0
  23. data/vendor/assets/stylesheets/semantic-ui/elements/basic.icon.less +5 -5
  24. data/vendor/assets/stylesheets/semantic-ui/elements/button.less +5 -5
  25. data/vendor/assets/stylesheets/semantic-ui/elements/icon.less +5 -5
  26. data/vendor/assets/stylesheets/semantic-ui/elements/input.less +1 -1
  27. data/vendor/assets/stylesheets/semantic-ui/elements/loader.less +8 -8
  28. data/vendor/assets/stylesheets/semantic-ui/modules/accordion.less +41 -17
  29. data/vendor/assets/stylesheets/semantic-ui/modules/checkbox.less +181 -106
  30. data/vendor/assets/stylesheets/semantic-ui/modules/popup.less +28 -10
  31. data/vendor/assets/stylesheets/semantic-ui/modules/rating.less +2 -2
  32. data/vendor/assets/stylesheets/semantic-ui/modules/search.less +1 -1
  33. data/vendor/assets/stylesheets/semantic-ui/modules/tab.less +1 -1
  34. data/vendor/assets/stylesheets/semantic-ui/views/item.less +5 -6
  35. data/vendor/assets/stylesheets/semantic-ui/views/list.less +14 -7
  36. metadata +2 -2
@@ -17,19 +17,6 @@ $.fn.modal = function(parameters) {
17
17
  $window = $(window),
18
18
  $document = $(document),
19
19
 
20
- settings = ( $.isPlainObject(parameters) )
21
- ? $.extend(true, {}, $.fn.modal.settings, parameters)
22
- : $.fn.modal.settings,
23
-
24
- selector = settings.selector,
25
- className = settings.className,
26
- namespace = settings.namespace,
27
- error = settings.error,
28
-
29
- eventNamespace = '.' + namespace,
30
- moduleNamespace = 'module-' + namespace,
31
- moduleSelector = $allModules.selector || '',
32
-
33
20
  time = new Date().getTime(),
34
21
  performance = [],
35
22
 
@@ -44,6 +31,19 @@ $.fn.modal = function(parameters) {
44
31
  $allModules
45
32
  .each(function() {
46
33
  var
34
+ settings = ( $.isPlainObject(parameters) )
35
+ ? $.extend(true, {}, $.fn.modal.settings, parameters)
36
+ : $.fn.modal.settings,
37
+
38
+ selector = settings.selector,
39
+ className = settings.className,
40
+ namespace = settings.namespace,
41
+ error = settings.error,
42
+
43
+ eventNamespace = '.' + namespace,
44
+ moduleNamespace = 'module-' + namespace,
45
+ moduleSelector = $allModules.selector || '',
46
+
47
47
  $module = $(this),
48
48
  $context = $(settings.context),
49
49
  $otherModals = $allModules.not($module),
@@ -64,7 +64,6 @@ $.fn.modal = function(parameters) {
64
64
 
65
65
  $dimmer = $context
66
66
  .dimmer('add content', $module)
67
- .dimmer('get dimmer')
68
67
  ;
69
68
 
70
69
  module.verbose('Attaching close events', $close);
@@ -107,7 +106,7 @@ $.fn.modal = function(parameters) {
107
106
  ;
108
107
  event = $.isFunction(module[event])
109
108
  ? module[event]
110
- : module.show
109
+ : module.toggle
111
110
  ;
112
111
  if($toggle.size() > 0) {
113
112
  module.debug('Attaching modal events to element', selector, event);
@@ -124,7 +123,7 @@ $.fn.modal = function(parameters) {
124
123
  event: {
125
124
  close: function() {
126
125
  module.verbose('Close button pressed');
127
- $context.dimmer('hide');
126
+ module.hide();
128
127
  },
129
128
  debounce: function(method, delay) {
130
129
  clearTimeout(module.timer);
@@ -137,12 +136,12 @@ $.fn.modal = function(parameters) {
137
136
  ;
138
137
  if(keyCode == escapeKey) {
139
138
  module.debug('Escape key pressed hiding modal');
140
- $context.dimmer('hide');
139
+ module.hide();
141
140
  event.preventDefault();
142
141
  }
143
142
  },
144
143
  resize: function() {
145
- if( $context.dimmer('is active') ) {
144
+ if( $dimmer.dimmer('is active') ) {
146
145
  module.refresh();
147
146
  }
148
147
  }
@@ -164,20 +163,12 @@ $.fn.modal = function(parameters) {
164
163
  module.hideAll();
165
164
  if(settings.transition && $.fn.transition !== undefined) {
166
165
  $module
167
- .transition(settings.transition + ' in', settings.duration, function() {
168
- module.set.active();
169
- module.save.focus();
170
- module.set.type();
171
- })
166
+ .transition(settings.transition + ' in', settings.duration, module.set.active)
172
167
  ;
173
168
  }
174
169
  else {
175
170
  $module
176
- .fadeIn(settings.duration, settings.easing, function() {
177
- module.set.active();
178
- module.save.focus();
179
- module.set.type();
180
- })
171
+ .fadeIn(settings.duration, settings.easing, module.set.active)
181
172
  ;
182
173
  }
183
174
  module.debug('Triggering dimmer');
@@ -187,18 +178,30 @@ $.fn.modal = function(parameters) {
187
178
  showDimmer: function() {
188
179
  module.debug('Showing modal');
189
180
  module.set.dimmerSettings();
190
- $context.dimmer('show');
181
+ $dimmer.dimmer('show');
191
182
  },
183
+
184
+ hide: function() {
185
+ if( $dimmer.dimmer('is active') ) {
186
+ $dimmer.dimmer('hide');
187
+ }
188
+ if( module.is.active() ) {
189
+ module.hideModal();
190
+ $.proxy(settings.onHide, element)();
191
+ }
192
+ else {
193
+ module.debug('Cannot hide modal, modal is not visible');
194
+ }
195
+ },
196
+
192
197
  hideDimmer: function() {
193
- $context.dimmer('hide');
198
+ module.debug('Hiding dimmer');
199
+ $dimmer.dimmer('hide');
194
200
  },
195
201
 
196
- hide: function() {
202
+ hideModal: function() {
197
203
  module.debug('Hiding modal');
198
- // remove keyboard detection
199
- $document
200
- .off('keyup.' + namespace)
201
- ;
204
+ module.remove.keyboardShortcuts();
202
205
  if(settings.transition && $.fn.transition !== undefined) {
203
206
  $module
204
207
  .transition(settings.transition + ' out', settings.duration, function() {
@@ -215,7 +218,6 @@ $.fn.modal = function(parameters) {
215
218
  })
216
219
  ;
217
220
  }
218
- $.proxy(settings.onHide, element)();
219
221
  },
220
222
 
221
223
  hideAll: function() {
@@ -242,7 +244,9 @@ $.fn.modal = function(parameters) {
242
244
 
243
245
  restore: {
244
246
  focus: function() {
245
- $focusedElement.focus();
247
+ if($focusedElement.size() > 0) {
248
+ $focusedElement.focus();
249
+ }
246
250
  }
247
251
  },
248
252
 
@@ -267,7 +271,7 @@ $.fn.modal = function(parameters) {
267
271
  height : $module.outerHeight() + settings.offset,
268
272
  contextHeight : (settings.context == 'body')
269
273
  ? $(window).height()
270
- : $context.height()
274
+ : $dimmer.height()
271
275
  };
272
276
  module.debug('Caching modal and container sizes', module.cache);
273
277
  },
@@ -286,18 +290,28 @@ $.fn.modal = function(parameters) {
286
290
 
287
291
  set: {
288
292
  active: function() {
289
- $module.addClass(className.active);
293
+ module.save.focus();
294
+ module.set.type();
295
+ $module
296
+ .addClass(className.active)
297
+ ;
298
+ if(settings.closable) {
299
+ $dimmer
300
+ .dimmer('get dimmer')
301
+ .on('click', module.hide)
302
+ ;
303
+ }
290
304
  },
291
305
  dimmerSettings: function() {
292
- module.debug('Setting dimmer settings', settings.closable);
293
- $context
294
- .dimmer('setting', 'closable', settings.closable)
295
- .dimmer('setting', 'duration', settings.duration * 0.75)
296
- .dimmer('setting', 'onShow' , module.add.keyboardShortcuts)
297
- .dimmer('setting', 'onHide', function() {
298
- module.hide();
299
- module.remove.keyboardShortcuts();
306
+ module.debug('Setting dimmer settings', $dimmer);
307
+ $dimmer
308
+ .dimmer('setting', 'closable', false)
309
+ .dimmer('setting', 'duration', {
310
+ show : settings.duration * 0.95,
311
+ hide : settings.duration * 1.05
300
312
  })
313
+ .dimmer('setting', 'onShow' , module.add.keyboardShortcuts)
314
+ // destory after changing settings in order to reattach events
301
315
  .dimmer('destroy')
302
316
  .dimmer('initialize')
303
317
  ;
@@ -526,7 +540,7 @@ $.fn.modal.settings = {
526
540
 
527
541
  closable : true,
528
542
  context : 'body',
529
- duration : 600,
543
+ duration : 500,
530
544
  easing : 'easeOutExpo',
531
545
  offset : 0,
532
546
  transition : 'scale',
@@ -14,15 +14,6 @@
14
14
  $.fn.nag = function(parameters) {
15
15
  var
16
16
  $allModules = $(this),
17
- settings = $.extend(true, {}, $.fn.nag.settings, parameters),
18
-
19
- className = settings.className,
20
- selector = settings.selector,
21
- error = settings.error,
22
- namespace = settings.namespace,
23
-
24
- eventNamespace = '.' + namespace,
25
- moduleNamespace = namespace + '-module',
26
17
  moduleSelector = $allModules.selector || '',
27
18
 
28
19
  time = new Date().getTime(),
@@ -36,6 +27,16 @@ $.fn.nag = function(parameters) {
36
27
  $(this)
37
28
  .each(function() {
38
29
  var
30
+ settings = $.extend(true, {}, $.fn.nag.settings, parameters),
31
+
32
+ className = settings.className,
33
+ selector = settings.selector,
34
+ error = settings.error,
35
+ namespace = settings.namespace,
36
+
37
+ eventNamespace = '.' + namespace,
38
+ moduleNamespace = namespace + '-module',
39
+
39
40
  $module = $(this),
40
41
 
41
42
  $close = $module.find(selector.close),
@@ -14,10 +14,7 @@
14
14
  $.fn.popup = function(parameters) {
15
15
  var
16
16
  $allModules = $(this),
17
-
18
- settings = ( $.isPlainObject(parameters) )
19
- ? $.extend(true, {}, $.fn.popup.settings, parameters)
20
- : $.fn.popup.settings,
17
+ $document = $(document),
21
18
 
22
19
  moduleSelector = $allModules.selector || '',
23
20
 
@@ -33,6 +30,19 @@ $.fn.popup = function(parameters) {
33
30
  $allModules
34
31
  .each(function() {
35
32
  var
33
+ settings = ( $.isPlainObject(parameters) )
34
+ ? $.extend(true, {}, $.fn.popup.settings, parameters)
35
+ : $.fn.popup.settings,
36
+
37
+ selector = settings.selector,
38
+ className = settings.className,
39
+ error = settings.error,
40
+ metadata = settings.metadata,
41
+ namespace = settings.namespace,
42
+
43
+ eventNamespace = '.' + settings.namespace,
44
+ moduleNamespace = settings.namespace + '-module',
45
+
36
46
  $module = $(this),
37
47
 
38
48
  $window = $(window),
@@ -43,15 +53,6 @@ $.fn.popup = function(parameters) {
43
53
 
44
54
  searchDepth = 0,
45
55
 
46
- eventNamespace = '.' + settings.namespace,
47
- moduleNamespace = settings.namespace + '-module',
48
-
49
- selector = settings.selector,
50
- className = settings.className,
51
- error = settings.error,
52
- metadata = settings.metadata,
53
- namespace = settings.namespace,
54
-
55
56
  element = this,
56
57
  instance = $module.data(moduleNamespace),
57
58
  module
@@ -154,18 +155,18 @@ $.fn.popup = function(parameters) {
154
155
  .html(html)
155
156
  ;
156
157
  if(settings.inline) {
157
- module.verbose('Inserting popup element inline');
158
+ module.verbose('Inserting popup element inline', $popup);
158
159
  $popup
159
160
  .insertAfter($module)
160
161
  ;
161
162
  }
162
163
  else {
163
- module.verbose('Appending popup element to body');
164
+ module.verbose('Appending popup element to body', $popup);
164
165
  $popup
165
166
  .appendTo( $('body') )
166
167
  ;
167
168
  }
168
- $.proxy(settings.onInit, $popup)();
169
+ $.proxy(settings.onCreate, $popup)();
169
170
  }
170
171
  else {
171
172
  module.error(error.content);
@@ -204,6 +205,7 @@ $.fn.popup = function(parameters) {
204
205
  left : (popup.position.left < boundary.left)
205
206
  };
206
207
  }
208
+ module.verbose('Checking if outside viewable area', popup.position);
207
209
  // return only boundaries that have been surpassed
208
210
  $.each(offstage, function(direction, isOffstage) {
209
211
  if(isOffstage) {
@@ -259,7 +261,7 @@ $.fn.popup = function(parameters) {
259
261
  module.show();
260
262
  }
261
263
  else {
262
- module.hide();
264
+ // module.hide();
263
265
  }
264
266
  },
265
267
 
@@ -291,9 +293,10 @@ $.fn.popup = function(parameters) {
291
293
  switch(position) {
292
294
  case 'top left':
293
295
  positioning = {
294
- top : 'auto',
295
296
  bottom : parentHeight - offset.top + settings.distanceAway,
296
- left : offset.left + arrowOffset
297
+ right : parentWidth - offset.left - width - arrowOffset,
298
+ top : 'auto',
299
+ left : 'auto'
297
300
  };
298
301
  break;
299
302
  case 'top center':
@@ -306,10 +309,9 @@ $.fn.popup = function(parameters) {
306
309
  break;
307
310
  case 'top right':
308
311
  positioning = {
309
- bottom : parentHeight - offset.top + settings.distanceAway,
310
- right : parentWidth - offset.left - width - arrowOffset,
311
312
  top : 'auto',
312
- left : 'auto'
313
+ bottom : parentHeight - offset.top + settings.distanceAway,
314
+ left : offset.left + arrowOffset
313
315
  };
314
316
  break;
315
317
  case 'left center':
@@ -331,9 +333,9 @@ $.fn.popup = function(parameters) {
331
333
  case 'bottom left':
332
334
  positioning = {
333
335
  top : offset.top + height + settings.distanceAway,
334
- left : offset.left + arrowOffset,
335
- bottom : 'auto',
336
- right : 'auto'
336
+ right : parentWidth - offset.left - width - arrowOffset,
337
+ left : 'auto',
338
+ bottom : 'auto'
337
339
  };
338
340
  break;
339
341
  case 'bottom center':
@@ -347,9 +349,9 @@ $.fn.popup = function(parameters) {
347
349
  case 'bottom right':
348
350
  positioning = {
349
351
  top : offset.top + height + settings.distanceAway,
350
- right : parentWidth - offset.left - width - arrowOffset,
351
- left : 'auto',
352
- bottom : 'auto'
352
+ left : offset.left + arrowOffset,
353
+ bottom : 'auto',
354
+ right : 'auto'
353
355
  };
354
356
  break;
355
357
  }
@@ -359,11 +361,9 @@ $.fn.popup = function(parameters) {
359
361
  });
360
362
  // tentatively place on stage
361
363
  $popup
362
- .removeAttr('style')
363
- .removeClass('top right bottom left center')
364
364
  .css(positioning)
365
+ .removeClass(className.position)
365
366
  .addClass(position)
366
- .addClass(className.loading)
367
367
  ;
368
368
  // check if is offstage
369
369
  offstagePosition = module.get.offstagePosition();
@@ -398,9 +398,6 @@ $.fn.popup = function(parameters) {
398
398
  $module
399
399
  .addClass(className.visible)
400
400
  ;
401
- $popup
402
- .removeClass(className.loading)
403
- ;
404
401
  if(settings.transition && $.fn.transition !== undefined) {
405
402
  $popup
406
403
  .transition(settings.transition + ' in', settings.duration)
@@ -414,7 +411,7 @@ $.fn.popup = function(parameters) {
414
411
  }
415
412
  if(settings.on == 'click' && settings.clicktoClose) {
416
413
  module.debug('Binding popup close event');
417
- $(document)
414
+ $document
418
415
  .on('click.' + namespace, module.gracefully.hide)
419
416
  ;
420
417
  }
@@ -436,22 +433,30 @@ $.fn.popup = function(parameters) {
436
433
  module.debug('Hiding pop-up');
437
434
  if(settings.transition && $.fn.transition !== undefined) {
438
435
  $popup
439
- .transition(settings.transition + ' out', settings.duration)
436
+ .transition(settings.transition + ' out', settings.duration, module.reset)
440
437
  ;
441
438
  }
442
439
  else {
443
440
  $popup
444
441
  .stop()
445
- .fadeOut(settings.duration, settings.easing)
442
+ .fadeOut(settings.duration, settings.easing, module.reset)
446
443
  ;
447
444
  }
448
445
  }
449
446
  if(settings.on == 'click' && settings.clicktoClose) {
450
- $(document)
447
+ $document
451
448
  .off('click.' + namespace)
452
449
  ;
453
450
  }
454
451
  $.proxy(settings.onHide, $popup)();
452
+ },
453
+
454
+ reset: function() {
455
+ module.verbose('Resetting inline styles');
456
+ $popup
457
+ .attr('style', '')
458
+ .removeAttr('style')
459
+ ;
455
460
  if(!settings.inline) {
456
461
  module.remove();
457
462
  }
@@ -653,7 +658,7 @@ $.fn.popup.settings = {
653
658
  performance : true,
654
659
  namespace : 'popup',
655
660
 
656
- onInit : function(){},
661
+ onCreate : function(){},
657
662
  onShow : function(){},
658
663
  onHide : function(){},
659
664
 
@@ -695,7 +700,8 @@ $.fn.popup.settings = {
695
700
  className : {
696
701
  popup : 'ui popup',
697
702
  visible : 'visible',
698
- loading : 'loading'
703
+ loading : 'loading',
704
+ position : 'top left center bottom right'
699
705
  },
700
706
 
701
707
  selector : {