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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ea82ae6b074f7adff9d90da5beaceb4b5c878cf3
4
- data.tar.gz: a08895b4359cc501c64e5140662ede6d93ed008a
3
+ metadata.gz: 2fb864ef0d530e5ceb2175dd1477cbca0d801e14
4
+ data.tar.gz: a52103e576eb46d6f6a76878cba1f408da53149c
5
5
  SHA512:
6
- metadata.gz: a5c6769b183c15e1f6e589fab69cc3fe04d707b052b4159c8d8634bd17a945b6c925613e8df38d2e09a0584a800d3b856dfc044be0a07e073b7718a55a3b1bbd
7
- data.tar.gz: 13a25830b203316628da5e46afb8d6dba3a7eb62b04d79357f14385a5e1606bb9fb66911d38514c6291649cbc4953ba28b935ab16992e3265cba8e4e262f19c8
6
+ metadata.gz: e1be62a4e5e636fdbc29a65279f5c4ccbf4b914ccacb048245c1be599ea0def9dff16a3fd196c8fbbd89762c8d54be9c6ba1dba14aa58c9485453d5333036b40
7
+ data.tar.gz: 9488e207fce9f0ae28b5e3a99e7198543e60c44a9e9ed5f4a707994bf2641ee1e3e409db99e50ba6949fcf2b23ab6357347cc1493d63806118161f9a10db354b
data/README.md CHANGED
@@ -19,6 +19,13 @@ Run generator to include assets to your project
19
19
  rails g semantic:install
20
20
  ```
21
21
 
22
+ ## Versioning
23
+ First three numbers are the version of Semantic UI.
24
+
25
+ Last single number is the version of this gem with the same Semantic UI version.
26
+
27
+ i.e. `0.3.5.3` means that `0.3.5` is Semantic UI version and `.3` is the rails gem version.
28
+
22
29
  ## Contributing
23
30
 
24
31
  1. Fork it
@@ -1,7 +1,7 @@
1
1
  module Semantic
2
2
  module Ui
3
3
  module Rails
4
- VERSION = "0.1.0.2"
4
+ VERSION = "0.3.5"
5
5
  end
6
6
  end
7
7
  end
@@ -51,7 +51,7 @@ class Semantic < Thor
51
51
  say_status "STEP", "PARSE VERSION"
52
52
  Dir.chdir git_root
53
53
 
54
- bower = JSON.parse( IO.read('bower.json'), :quirks_mode => true)
54
+ bower = JSON.parse( IO.read('composer.json'), :quirks_mode => true)
55
55
  version = bower["version"]
56
56
 
57
57
  version_file = source_root + "lib/semantic/ui/rails/version.rb"
@@ -61,7 +61,7 @@ class Semantic < Thor
61
61
 
62
62
  def fix_paths
63
63
  Dir.glob(source_root + "vendor" + "**/*.less") do |file|
64
- gsub_file file, /(?<=url\()(.+\/\w+)(?=\/)/, '/assets/semantic-ui'
64
+ gsub_file file, /(?<=url\()(.+\/\w+)(?=\/)/, '..'
65
65
  end
66
66
  end
67
67
 
@@ -77,7 +77,7 @@ class Semantic < Thor
77
77
  run "rsync -avm --include='*.js' -f 'hide,! */' #{git_root + 'src/'} #{source_root + javascripts_path}"
78
78
 
79
79
  # FONTS
80
- fonts_path = "vendor/assets/fonts/semantic-ui"
80
+ fonts_path = "vendor/assets/fonts/semantic-ui/"
81
81
  run "rsync -avm --include='*.*' -f 'hide,! */' #{git_root + 'src/fonts/'} #{source_root + fonts_path}"
82
82
 
83
83
  # IMAGES
@@ -15,19 +15,6 @@ $.fn.accordion = function(parameters) {
15
15
  var
16
16
  $allModules = $(this),
17
17
 
18
- settings = ( $.isPlainObject(parameters) )
19
- ? $.extend(true, {}, $.fn.accordion.settings, parameters)
20
- : $.fn.accordion.settings,
21
-
22
- className = settings.className,
23
- namespace = settings.namespace,
24
- selector = settings.selector,
25
- error = settings.error,
26
-
27
- eventNamespace = '.' + namespace,
28
- moduleNamespace = 'module-' + namespace,
29
- moduleSelector = $allModules.selector || '',
30
-
31
18
  time = new Date().getTime(),
32
19
  performance = [],
33
20
 
@@ -39,6 +26,19 @@ $.fn.accordion = function(parameters) {
39
26
  $allModules
40
27
  .each(function() {
41
28
  var
29
+ settings = ( $.isPlainObject(parameters) )
30
+ ? $.extend(true, {}, $.fn.accordion.settings, parameters)
31
+ : $.fn.accordion.settings,
32
+
33
+ className = settings.className,
34
+ namespace = settings.namespace,
35
+ selector = settings.selector,
36
+ error = settings.error,
37
+
38
+ eventNamespace = '.' + namespace,
39
+ moduleNamespace = 'module-' + namespace,
40
+ moduleSelector = $allModules.selector || '',
41
+
42
42
  $module = $(this),
43
43
  $title = $module.find(selector.title),
44
44
  $content = $module.find(selector.content),
@@ -290,9 +290,6 @@ $.fn.accordion = function(parameters) {
290
290
  if(moduleSelector) {
291
291
  title += ' \'' + moduleSelector + '\'';
292
292
  }
293
- if($allModules.size() > 1) {
294
- title += ' ' + '(' + $allModules.size() + ')';
295
- }
296
293
  if( (console.group !== undefined || console.table !== undefined) && performance.length > 0) {
297
294
  console.groupCollapsed(title);
298
295
  if(console.table) {
@@ -393,8 +390,8 @@ $.fn.accordion.settings = {
393
390
  exclusive : true,
394
391
  collapsible : true,
395
392
 
396
- duration : 300,
397
- easing : 'linear',
393
+ duration : 500,
394
+ easing : 'easeInOutQuint',
398
395
 
399
396
  onOpen : function(){},
400
397
  onClose : function(){},
@@ -416,4 +413,13 @@ $.fn.accordion.settings = {
416
413
 
417
414
  };
418
415
 
416
+ // Adds easing
417
+ $.extend( $.easing, {
418
+ easeInOutQuint: function (x, t, b, c, d) {
419
+ if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
420
+ return c/2*((t-=2)*t*t*t*t + 2) + b;
421
+ }
422
+ });
423
+
419
424
  })( jQuery, window , document );
425
+
@@ -13,19 +13,19 @@
13
13
 
14
14
  $.fn.chatroom = function(parameters) {
15
15
  var
16
- settings = $.extend(true, {}, $.fn.chatroom.settings, parameters),
17
-
18
- className = settings.className,
19
- namespace = settings.namespace,
20
- selector = settings.selector,
21
- error = settings.error,
22
-
23
16
  // hoist arguments
24
17
  moduleArguments = arguments || false
25
18
  ;
26
19
  $(this)
27
20
  .each(function() {
28
21
  var
22
+ settings = $.extend(true, {}, $.fn.chatroom.settings, parameters),
23
+
24
+ className = settings.className,
25
+ namespace = settings.namespace,
26
+ selector = settings.selector,
27
+ error = settings.error,
28
+
29
29
  $module = $(this),
30
30
 
31
31
  $expandButton = $module.find(selector.expandButton),
@@ -14,16 +14,6 @@
14
14
  $.fn.checkbox = function(parameters) {
15
15
  var
16
16
  $allModules = $(this),
17
-
18
- settings = $.extend(true, {}, $.fn.checkbox.settings, parameters),
19
-
20
- className = settings.className,
21
- namespace = settings.namespace,
22
- error = settings.error,
23
-
24
- eventNamespace = '.' + namespace,
25
- moduleNamespace = 'module-' + namespace,
26
-
27
17
  moduleSelector = $allModules.selector || '',
28
18
 
29
19
  time = new Date().getTime(),
@@ -38,6 +28,15 @@ $.fn.checkbox = function(parameters) {
38
28
  $allModules
39
29
  .each(function() {
40
30
  var
31
+ settings = $.extend(true, {}, $.fn.checkbox.settings, parameters),
32
+
33
+ className = settings.className,
34
+ namespace = settings.namespace,
35
+ error = settings.error,
36
+
37
+ eventNamespace = '.' + namespace,
38
+ moduleNamespace = 'module-' + namespace,
39
+
41
40
  $module = $(this),
42
41
  $label = $(this).next(settings.selector.label).first(),
43
42
  $input = $(this).find(settings.selector.input),
@@ -15,28 +15,12 @@ $.fn.dimmer = function(parameters) {
15
15
  var
16
16
  $allModules = $(this),
17
17
 
18
- settings = ( $.isPlainObject(parameters) )
19
- ? $.extend(true, {}, $.fn.dimmer.settings, parameters)
20
- : $.fn.dimmer.settings,
21
-
22
- selector = settings.selector,
23
- namespace = settings.namespace,
24
- className = settings.className,
25
- error = settings.error,
26
-
27
- eventNamespace = '.' + namespace,
28
- moduleNamespace = 'module-' + namespace,
29
- moduleSelector = $allModules.selector || '',
30
-
31
18
  time = new Date().getTime(),
32
19
  performance = [],
33
20
 
34
21
  query = arguments[0],
35
22
  methodInvoked = (typeof query == 'string'),
36
23
  queryArguments = [].slice.call(arguments, 1),
37
- clickEvent = ('ontouchstart' in document.documentElement)
38
- ? 'touchstart'
39
- : 'click',
40
24
 
41
25
  invokedResponse
42
26
  ;
@@ -44,6 +28,23 @@ $.fn.dimmer = function(parameters) {
44
28
  $allModules
45
29
  .each(function() {
46
30
  var
31
+ settings = ( $.isPlainObject(parameters) )
32
+ ? $.extend(true, {}, $.fn.dimmer.settings, parameters)
33
+ : $.fn.dimmer.settings,
34
+
35
+ selector = settings.selector,
36
+ namespace = settings.namespace,
37
+ className = settings.className,
38
+ error = settings.error,
39
+
40
+ eventNamespace = '.' + namespace,
41
+ moduleNamespace = 'module-' + namespace,
42
+ moduleSelector = $allModules.selector || '',
43
+
44
+ clickEvent = ('ontouchstart' in document.documentElement)
45
+ ? 'touchstart'
46
+ : 'click',
47
+
47
48
  $module = $(this),
48
49
  $dimmer,
49
50
  $dimmable,
@@ -66,7 +67,7 @@ $.fn.dimmer = function(parameters) {
66
67
  $dimmer = $dimmable.children(selector.dimmer).first();
67
68
  }
68
69
  else {
69
- module.create();
70
+ $dimmer = module.create();
70
71
  }
71
72
  }
72
73
  },
@@ -141,8 +142,7 @@ $.fn.dimmer = function(parameters) {
141
142
  },
142
143
 
143
144
  create: function() {
144
- $dimmer = $( settings.template.dimmer() );
145
- return $dimmer.appendTo($dimmable);
145
+ return $( settings.template.dimmer() ).appendTo($dimmable);
146
146
  },
147
147
 
148
148
  animate: {
@@ -151,7 +151,7 @@ $.fn.dimmer = function(parameters) {
151
151
  module.set.dimmed();
152
152
  if($.fn.transition !== undefined) {
153
153
  $dimmer
154
- .transition(settings.transition + ' in', settings.duration, function() {
154
+ .transition(settings.transition + ' in', module.get.duration(), function() {
155
155
  module.set.active();
156
156
  callback();
157
157
  })
@@ -166,7 +166,7 @@ $.fn.dimmer = function(parameters) {
166
166
  width : '100%',
167
167
  height : '100%'
168
168
  })
169
- .fadeTo(settings.duration, 1, function() {
169
+ .fadeTo(module.get.duration(), 1, function() {
170
170
  $dimmer.removeAttr('style');
171
171
  module.set.active();
172
172
  callback();
@@ -180,7 +180,7 @@ $.fn.dimmer = function(parameters) {
180
180
  if($.fn.transition !== undefined) {
181
181
  module.verbose('Hiding dimmer with css');
182
182
  $dimmer
183
- .transition(settings.transition + ' out', settings.duration, function() {
183
+ .transition(settings.transition + ' out', module.get.duration(), function() {
184
184
  module.remove.active();
185
185
  callback();
186
186
  })
@@ -190,7 +190,7 @@ $.fn.dimmer = function(parameters) {
190
190
  module.verbose('Hiding dimmer with javascript');
191
191
  $dimmer
192
192
  .stop()
193
- .fadeOut(settings.duration, function() {
193
+ .fadeOut(module.get.duration(), function() {
194
194
  $dimmer.removeAttr('style');
195
195
  module.remove.active();
196
196
  callback();
@@ -203,6 +203,17 @@ $.fn.dimmer = function(parameters) {
203
203
  get: {
204
204
  dimmer: function() {
205
205
  return $dimmer;
206
+ },
207
+ duration: function() {
208
+ if(typeof settings.duration == 'object') {
209
+ if( module.is.active() ) {
210
+ return settings.duration.hide;
211
+ }
212
+ else {
213
+ return settings.duration.show;
214
+ }
215
+ }
216
+ return settings.duration;
206
217
  }
207
218
  },
208
219
 
@@ -512,7 +523,10 @@ $.fn.dimmer.settings = {
512
523
 
513
524
  on : false,
514
525
  closable : true,
515
- duration : 500,
526
+ duration : {
527
+ show : 500,
528
+ hide : 500
529
+ },
516
530
 
517
531
  onChange : function(){},
518
532
  onShow : function(){},
@@ -8,7 +8,6 @@
8
8
  * http://opensource.org/licenses/MIT
9
9
  *
10
10
  */
11
-
12
11
  ;(function ( $, window, document, undefined ) {
13
12
 
14
13
  $.fn.dropdown = function(parameters) {
@@ -16,19 +15,7 @@ $.fn.dropdown = function(parameters) {
16
15
  $allModules = $(this),
17
16
  $document = $(document),
18
17
 
19
- settings = ( $.isPlainObject(parameters) )
20
- ? $.extend(true, {}, $.fn.dropdown.settings, parameters)
21
- : $.fn.dropdown.settings,
22
-
23
- className = settings.className,
24
- metadata = settings.metadata,
25
- namespace = settings.namespace,
26
- selector = settings.selector,
27
- error = settings.error,
28
-
29
- eventNamespace = '.' + namespace,
30
- dropdownNamespace = 'module-' + namespace,
31
- dropdownSelector = $allModules.selector || '',
18
+ moduleSelector = $allModules.selector || '',
32
19
 
33
20
  time = new Date().getTime(),
34
21
  performance = [],
@@ -42,17 +29,30 @@ $.fn.dropdown = function(parameters) {
42
29
  $allModules
43
30
  .each(function() {
44
31
  var
45
- $module = $(this),
46
- $item = $module.find(selector.item),
47
- $text = $module.find(selector.text),
48
- $input = $module.find(selector.input),
32
+ settings = ( $.isPlainObject(parameters) )
33
+ ? $.extend(true, {}, $.fn.dropdown.settings, parameters)
34
+ : $.fn.dropdown.settings,
35
+
36
+ className = settings.className,
37
+ metadata = settings.metadata,
38
+ namespace = settings.namespace,
39
+ selector = settings.selector,
40
+ error = settings.error,
41
+
42
+ eventNamespace = '.' + namespace,
43
+ dropdownNamespace = 'module-' + namespace,
44
+ isTouchDevice = ('ontouchstart' in document.documentElement),
49
45
 
50
- $menu = $module.children(selector.menu),
46
+ $module = $(this),
47
+ $item = $module.find(selector.item),
48
+ $text = $module.find(selector.text),
49
+ $input = $module.find(selector.input),
51
50
 
52
- isTouchDevice = ('ontouchstart' in document.documentElement),
51
+ $menu = $module.children(selector.menu),
53
52
 
54
- element = this,
55
- instance = $module.data(dropdownNamespace),
53
+
54
+ element = this,
55
+ instance = $module.data(dropdownNamespace),
56
56
  module
57
57
  ;
58
58
 
@@ -112,10 +112,6 @@ $.fn.dropdown = function(parameters) {
112
112
 
113
113
  event: {
114
114
 
115
- stopPropagation: function(event) {
116
- event.stopPropagation();
117
- },
118
-
119
115
  test: {
120
116
  toggle: function(event) {
121
117
  module.determine.intent(event, module.toggle);
@@ -173,7 +169,6 @@ $.fn.dropdown = function(parameters) {
173
169
  ;
174
170
  module.determine.selectAction(text, value);
175
171
  $.proxy(settings.onChange, element)(value, text);
176
- event.stopPropagation();
177
172
  }
178
173
  }
179
174
 
@@ -188,12 +183,22 @@ $.fn.dropdown = function(parameters) {
188
183
  determine: {
189
184
  selectAction: function(text, value) {
190
185
  module.verbose('Determining action', settings.action);
191
- if( $.isFunction( module[settings.action] ) ) {
192
- module.verbose('Triggering preset action', settings.action);
186
+ if(settings.action == 'auto') {
187
+ if(module.is.selection()) {
188
+ module.debug('Selection dropdown used updating form', text, value);
189
+ module.updateForm(text, value);
190
+ }
191
+ else {
192
+ module.debug('No action specified hiding dropdown', text, value);
193
+ module.hide();
194
+ }
195
+ }
196
+ else if( $.isFunction( module[settings.action] ) ) {
197
+ module.verbose('Triggering preset action', settings.action, text, value);
193
198
  module[ settings.action ](text, value);
194
199
  }
195
200
  else if( $.isFunction(settings.action) ) {
196
- module.verbose('Triggering user action', settings.action);
201
+ module.verbose('Triggering user action', settings.action, text, value);
197
202
  settings.action(text, value);
198
203
  }
199
204
  else {
@@ -318,6 +323,9 @@ $.fn.dropdown = function(parameters) {
318
323
  },
319
324
 
320
325
  is: {
326
+ selection: function() {
327
+ return $module.hasClass(className.selection);
328
+ },
321
329
  visible: function($subMenu) {
322
330
  return ($subMenu)
323
331
  ? $subMenu.is(':animated, :visible')
@@ -588,8 +596,8 @@ $.fn.dropdown = function(parameters) {
588
596
  totalTime += data['Execution Time'];
589
597
  });
590
598
  title += ' ' + totalTime + 'ms';
591
- if(dropdownSelector) {
592
- title += ' \'' + dropdownSelector + '\'';
599
+ if(moduleSelector) {
600
+ title += ' \'' + moduleSelector + '\'';
593
601
  }
594
602
  if( (console.group !== undefined || console.table !== undefined) && performance.length > 0) {
595
603
  console.groupCollapsed(title);
@@ -609,7 +617,8 @@ $.fn.dropdown = function(parameters) {
609
617
  invoke: function(query, passedArguments, context) {
610
618
  var
611
619
  maxDepth,
612
- found
620
+ found,
621
+ response
613
622
  ;
614
623
  passedArguments = passedArguments || queryArguments;
615
624
  context = element || context;
@@ -617,21 +626,46 @@ $.fn.dropdown = function(parameters) {
617
626
  query = query.split(/[\. ]/);
618
627
  maxDepth = query.length - 1;
619
628
  $.each(query, function(depth, value) {
629
+ var camelCaseValue = (depth != maxDepth)
630
+ ? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
631
+ : query
632
+ ;
620
633
  if( $.isPlainObject( instance[value] ) && (depth != maxDepth) ) {
621
634
  instance = instance[value];
622
635
  }
636
+ else if( $.isPlainObject( instance[camelCaseValue] ) && (depth != maxDepth) ) {
637
+ instance = instance[camelCaseValue];
638
+ }
623
639
  else if( instance[value] !== undefined ) {
624
640
  found = instance[value];
641
+ return false;
642
+ }
643
+ else if( instance[camelCaseValue] !== undefined ) {
644
+ found = instance[camelCaseValue];
645
+ return false;
625
646
  }
626
647
  else {
627
648
  module.error(error.method);
649
+ return false;
628
650
  }
629
651
  });
630
652
  }
631
653
  if ( $.isFunction( found ) ) {
632
- return found.apply(context, passedArguments);
654
+ response = found.apply(context, passedArguments);
655
+ }
656
+ else if(found !== undefined) {
657
+ response = found;
658
+ }
659
+ if($.isArray(invokedResponse)) {
660
+ invokedResponse.push(response);
661
+ }
662
+ else if(typeof invokedResponse == 'string') {
663
+ invokedResponse = [invokedResponse, response];
664
+ }
665
+ else if(response !== undefined) {
666
+ invokedResponse = response;
633
667
  }
634
- return found || false;
668
+ return found;
635
669
  }
636
670
  };
637
671
 
@@ -666,7 +700,7 @@ $.fn.dropdown.settings = {
666
700
  performance : true,
667
701
 
668
702
  on : 'click',
669
- action : 'hide',
703
+ action : 'auto',
670
704
 
671
705
  delay: {
672
706
  show: 200,
@@ -702,7 +736,8 @@ $.fn.dropdown.settings = {
702
736
  active : 'active',
703
737
  placeholder : 'default',
704
738
  disabled : 'disabled',
705
- visible : 'visible'
739
+ visible : 'visible',
740
+ selection : 'selection'
706
741
  }
707
742
 
708
743
  };