semantic-ui-rails 0.1.0 → 0.1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/lib/generators/semantic/install/install_generator.rb +3 -3
  3. data/lib/generators/semantic/install/templates/semantic-ui.css.less +47 -0
  4. data/lib/semantic/ui/rails/version.rb +1 -1
  5. data/semantic.thor +29 -25
  6. data/vendor/assets/javascripts/semantic-ui/modules/accordion.js +7 -0
  7. data/vendor/assets/javascripts/semantic-ui/modules/chatroom.js +1 -1
  8. data/vendor/assets/javascripts/semantic-ui/modules/checkbox.js +2 -5
  9. data/vendor/assets/javascripts/semantic-ui/modules/dimmer.js +73 -49
  10. data/vendor/assets/javascripts/semantic-ui/modules/dropdown.js +135 -136
  11. data/vendor/assets/javascripts/semantic-ui/modules/modal.js +196 -125
  12. data/vendor/assets/javascripts/semantic-ui/modules/popup.js +3 -6
  13. data/vendor/assets/javascripts/semantic-ui/modules/rating.js +80 -38
  14. data/vendor/assets/javascripts/semantic-ui/modules/sidebar.js +17 -20
  15. data/vendor/assets/javascripts/semantic-ui/modules/tab.js +32 -20
  16. data/vendor/assets/javascripts/semantic-ui/modules/transition.js +2 -0
  17. data/vendor/assets/stylesheets/semantic-ui/collections/form.less +15 -2
  18. data/vendor/assets/stylesheets/semantic-ui/collections/grid.less +20 -39
  19. data/vendor/assets/stylesheets/semantic-ui/collections/menu.less +12 -12
  20. data/vendor/assets/stylesheets/semantic-ui/elements/basic.icon.less +203 -198
  21. data/vendor/assets/stylesheets/semantic-ui/elements/button.less +17 -6
  22. data/vendor/assets/stylesheets/semantic-ui/elements/header.less +49 -31
  23. data/vendor/assets/stylesheets/semantic-ui/elements/icon.less +9 -13
  24. data/vendor/assets/stylesheets/semantic-ui/elements/image.less +13 -1
  25. data/vendor/assets/stylesheets/semantic-ui/elements/input.less +1 -1
  26. data/vendor/assets/stylesheets/semantic-ui/elements/loader.less +8 -8
  27. data/vendor/assets/stylesheets/semantic-ui/modules/checkbox.less +1 -1
  28. data/vendor/assets/stylesheets/semantic-ui/modules/dimmer.less +13 -5
  29. data/vendor/assets/stylesheets/semantic-ui/modules/dropdown.less +48 -8
  30. data/vendor/assets/stylesheets/semantic-ui/modules/modal.less +72 -13
  31. data/vendor/assets/stylesheets/semantic-ui/modules/rating.less +38 -35
  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/modules/transition.less +283 -25
  35. data/vendor/assets/stylesheets/semantic-ui/views/list.less +24 -2
  36. metadata +3 -7
  37. data/lib/generators/semantic/install/templates/semantic-ui/collections.less +0 -6
  38. data/lib/generators/semantic/install/templates/semantic-ui/elements.less +0 -12
  39. data/lib/generators/semantic/install/templates/semantic-ui/modules.less +0 -16
  40. data/lib/generators/semantic/install/templates/semantic-ui/views.less +0 -6
  41. data/vendor/assets/stylesheets/semantic-ui/views/statistic.css +0 -27
@@ -253,7 +253,9 @@ $.fn.popup = function(parameters) {
253
253
  // refresh state of module
254
254
  module.refresh();
255
255
  if( !$module.hasClass(className.visible) ) {
256
- module.hideAll();
256
+ if(settings.on == 'click') {
257
+ module.hideAll();
258
+ }
257
259
  module.show();
258
260
  }
259
261
  else {
@@ -552,11 +554,6 @@ $.fn.popup = function(parameters) {
552
554
  if(moduleSelector) {
553
555
  title += ' \'' + moduleSelector + '\'';
554
556
  }
555
- if($allModules.size() > 1) {
556
- if($allModules.size() > 1) {
557
- title += ' ' + '(' + $allModules.size() + ')';
558
- }
559
- }
560
557
  if( (console.group !== undefined || console.table !== undefined) && performance.length > 0) {
561
558
  console.groupCollapsed(title);
562
559
  if(console.table) {
@@ -49,14 +49,15 @@ $.fn.rating = function(parameters) {
49
49
  module = {
50
50
 
51
51
  initialize: function() {
52
- module.verbose('Initializing rating module');
52
+ module.verbose('Initializing rating module', settings);
53
+
53
54
  if(settings.interactive) {
54
- $icon
55
- .bind('mouseenter' + eventNamespace, module.event.mouseenter)
56
- .bind('mouseleave' + eventNamespace, module.event.mouseleave)
57
- .bind('click' + eventNamespace, module.event.click)
58
- ;
55
+ module.enable();
56
+ }
57
+ else {
58
+ module.disable();
59
59
  }
60
+
60
61
  if(settings.initialRating) {
61
62
  module.debug('Setting initial rating');
62
63
  module.setRating(settings.initialRating);
@@ -65,9 +66,6 @@ $.fn.rating = function(parameters) {
65
66
  module.debug('Rating found in metadata');
66
67
  module.setRating( $module.data(metadata.rating) );
67
68
  }
68
- $module
69
- .addClass(className.active)
70
- ;
71
69
  module.instantiate();
72
70
  },
73
71
 
@@ -87,29 +85,6 @@ $.fn.rating = function(parameters) {
87
85
  ;
88
86
  },
89
87
 
90
- setRating: function(rating) {
91
- var
92
- $activeIcon = $icon.eq(rating - 1)
93
- ;
94
- module.verbose('Setting current rating to', rating);
95
- $module
96
- .removeClass(className.hover)
97
- ;
98
- $icon
99
- .removeClass(className.hover)
100
- ;
101
- $activeIcon
102
- .nextAll()
103
- .removeClass(className.active)
104
- ;
105
- $activeIcon
106
- .addClass(className.active)
107
- .prevAll()
108
- .addClass(className.active)
109
- ;
110
- $.proxy(settings.onRate, element)();
111
- },
112
-
113
88
  event: {
114
89
  mouseenter: function() {
115
90
  var
@@ -138,11 +113,79 @@ $.fn.rating = function(parameters) {
138
113
  },
139
114
  click: function() {
140
115
  var
141
- $activeIcon = $(this)
116
+ $activeIcon = $(this),
117
+ currentRating = module.getRating(),
118
+ rating = $icon.index($activeIcon) + 1
142
119
  ;
143
- module.setRating( $icon.index($activeIcon) + 1);
120
+ if(settings.clearable && currentRating == rating) {
121
+ module.clearRating();
122
+ }
123
+ else {
124
+ module.setRating( rating );
125
+ }
144
126
  }
145
127
  },
128
+
129
+ clearRating: function() {
130
+ module.debug('Clearing current rating');
131
+ module.setRating(0);
132
+ },
133
+
134
+ getRating: function() {
135
+ var
136
+ currentRating = $icon.filter('.' + className.active).size()
137
+ ;
138
+ module.verbose('Current rating retrieved', currentRating);
139
+ return currentRating;
140
+ },
141
+
142
+ enable: function() {
143
+ module.debug('Setting rating to interactive mode');
144
+ $icon
145
+ .on('mouseenter' + eventNamespace, module.event.mouseenter)
146
+ .on('mouseleave' + eventNamespace, module.event.mouseleave)
147
+ .on('click' + eventNamespace, module.event.click)
148
+ ;
149
+ $module
150
+ .addClass(className.active)
151
+ ;
152
+ },
153
+
154
+ disable: function() {
155
+ module.debug('Setting rating to read-only mode');
156
+ $icon
157
+ .off(eventNamespace)
158
+ ;
159
+ $module
160
+ .removeClass(className.active)
161
+ ;
162
+ },
163
+
164
+ setRating: function(rating) {
165
+ var
166
+ ratingIndex = (rating - 1 >= 0)
167
+ ? (rating - 1)
168
+ : 0,
169
+ $activeIcon = $icon.eq(ratingIndex)
170
+ ;
171
+ $module
172
+ .removeClass(className.hover)
173
+ ;
174
+ $icon
175
+ .removeClass(className.hover)
176
+ .removeClass(className.active)
177
+ ;
178
+ if(rating > 0) {
179
+ module.verbose('Setting current rating to', rating);
180
+ $activeIcon
181
+ .addClass(className.active)
182
+ .prevAll()
183
+ .addClass(className.active)
184
+ ;
185
+ }
186
+ $.proxy(settings.onRate, element)(rating);
187
+ },
188
+
146
189
  setting: function(name, value) {
147
190
  if(value !== undefined) {
148
191
  if( $.isPlainObject(name) ) {
@@ -231,9 +274,6 @@ $.fn.rating = function(parameters) {
231
274
  if(moduleSelector) {
232
275
  title += ' \'' + moduleSelector + '\'';
233
276
  }
234
- if($allModules.size() > 1) {
235
- title += ' ' + '(' + $allModules.size() + ')';
236
- }
237
277
  if( (console.group !== undefined || console.table !== undefined) && performance.length > 0) {
238
278
  console.groupCollapsed(title);
239
279
  if(console.table) {
@@ -336,7 +376,9 @@ $.fn.rating.settings = {
336
376
 
337
377
  initialRating : 0,
338
378
  interactive : true,
339
- onRate : function(){},
379
+ clearable : false,
380
+
381
+ onRate : function(rating){},
340
382
 
341
383
  error : {
342
384
  method : 'The method you called is not defined'
@@ -79,30 +79,27 @@ $.fn.sidebar = function(parameters) {
79
79
  $style = $('style[title=' + namespace + ']');
80
80
  },
81
81
 
82
- attach: {
83
-
84
- events: function(selector, event) {
85
- var
86
- $toggle = $(selector)
87
- ;
88
- event = $.isFunction(module[event])
89
- ? module[event]
90
- : module.toggle
82
+ attachEvents: function(selector, event) {
83
+ var
84
+ $toggle = $(selector)
85
+ ;
86
+ event = $.isFunction(module[event])
87
+ ? module[event]
88
+ : module.toggle
89
+ ;
90
+ if($toggle.size() > 0) {
91
+ module.debug('Attaching sidebar events to element', selector, event);
92
+ $toggle
93
+ .off(eventNamespace)
94
+ .on('click' + eventNamespace, event)
91
95
  ;
92
- if($toggle.size() > 0) {
93
- module.debug('Attaching sidebar events to element', selector, event);
94
- $toggle
95
- .off(eventNamespace)
96
- .on('click' + eventNamespace, event)
97
- ;
98
- }
99
- else {
100
- module.error(error.notFound);
101
- }
102
96
  }
103
-
97
+ else {
98
+ module.error(error.notFound);
99
+ }
104
100
  },
105
101
 
102
+
106
103
  show: function() {
107
104
  module.debug('Showing sidebar');
108
105
  if(module.is.closed()) {
@@ -54,6 +54,15 @@
54
54
 
55
55
  initialize: function() {
56
56
  module.debug('Initializing Tabs', $module);
57
+
58
+ // set up automatic routing
59
+ if(settings.auto) {
60
+ module.verbose('Setting up automatic tab retrieval from server');
61
+ settings.apiSettings = {
62
+ url: settings.path + '/{$tab}'
63
+ };
64
+ }
65
+
57
66
  // attach history events
58
67
  if(settings.history) {
59
68
  if( $.address === undefined ) {
@@ -65,11 +74,6 @@
65
74
  return false;
66
75
  }
67
76
  else {
68
- if(settings.auto) {
69
- settings.apiSettings = {
70
- url: settings.path + '/{$tab}'
71
- };
72
- }
73
77
  module.verbose('Address library found adding state change event');
74
78
  $.address
75
79
  .state(settings.path)
@@ -78,8 +82,10 @@
78
82
  ;
79
83
  }
80
84
  }
85
+
81
86
  // attach events if navigation wasn't set to window
82
87
  if( !$.isWindow( element ) ) {
88
+ module.debug('Attaching tab activation events to element', $module);
83
89
  $module
84
90
  .on('click' + eventNamespace, module.event.click)
85
91
  ;
@@ -102,7 +108,7 @@
102
108
  },
103
109
 
104
110
  event: {
105
- click: function() {
111
+ click: function(event) {
106
112
  module.debug('Navigation clicked');
107
113
  var
108
114
  tabPath = $(this).data(metadata.tab)
@@ -114,6 +120,7 @@
114
120
  else {
115
121
  module.changeTab(tabPath);
116
122
  }
123
+ event.preventDefault();
117
124
  }
118
125
  else {
119
126
  module.debug('No tab specified');
@@ -172,9 +179,9 @@
172
179
  // only get default path if not remote content
173
180
  pathArray = (remoteContent && !shouldIgnoreLoad)
174
181
  ? module.utilities.pathToArray(tabPath)
175
- : module.get.defaultPathArray(tabPath),
176
- tabPath = module.utilities.arrayToPath(pathArray)
182
+ : module.get.defaultPathArray(tabPath)
177
183
  ;
184
+ tabPath = module.utilities.arrayToPath(pathArray);
178
185
  module.deactivate.all();
179
186
  $.each(pathArray, function(index, tab) {
180
187
  var
@@ -241,8 +248,6 @@
241
248
  fetch: function(tabPath, fullTabPath) {
242
249
  var
243
250
  $tab = module.get.tabElement(tabPath),
244
- fullTabPath = fullTabPath || tabPath,
245
- cachedContent = module.cache.read(fullTabPath),
246
251
  apiSettings = {
247
252
  dataType : 'html',
248
253
  stateContext : $tab,
@@ -262,8 +267,14 @@
262
267
  urlData: { tab: fullTabPath }
263
268
  },
264
269
  request = $tab.data(metadata.promise) || false,
265
- existingRequest = ( request && request.state() === 'pending' )
270
+ existingRequest = ( request && request.state() === 'pending' ),
271
+ requestSettings,
272
+ cachedContent
266
273
  ;
274
+
275
+ fullTabPath = fullTabPath || tabPath;
276
+ cachedContent = module.cache.read(fullTabPath);
277
+
267
278
  if(settings.cache && cachedContent) {
268
279
  module.debug('Showing existing content', fullTabPath);
269
280
  module.content.update(tabPath, cachedContent);
@@ -277,8 +288,10 @@
277
288
  ;
278
289
  }
279
290
  else if($.api !== undefined) {
280
- module.debug('Retrieving remote content', fullTabPath);
281
- $.api( $.extend(true, { headers: { 'X-Remote': true } }, settings.apiSettings, apiSettings) );
291
+ console.log(settings.apiSettings);
292
+ requestSettings = $.extend(true, { headers: { 'X-Remote': true } }, settings.apiSettings, apiSettings);
293
+ module.debug('Retrieving remote content', fullTabPath, requestSettings);
294
+ $.api( requestSettings );
282
295
  }
283
296
  else {
284
297
  module.error(error.api);
@@ -368,7 +381,7 @@
368
381
  module.error(error.recursion);
369
382
  }
370
383
  else {
371
- module.debug('No default tabs found for', tabPath);
384
+ module.debug('No default tabs found for', tabPath, $tabs);
372
385
  }
373
386
  recursionDepth = 0;
374
387
  return tabPath;
@@ -630,7 +643,6 @@
630
643
 
631
644
  // uses pjax style endpoints fetching content from same url with remote-content headers
632
645
  auto : false,
633
-
634
646
  history : false,
635
647
  path : false,
636
648
 
@@ -639,7 +651,7 @@
639
651
  // max depth a tab can be nested
640
652
  maxDepth : 25,
641
653
  // dont load content on first load
642
- ignoreFirstLoad : true,
654
+ ignoreFirstLoad : false,
643
655
  // load tab content new every tab click
644
656
  alwaysRefresh : false,
645
657
  // cache the content requests to pull locally
@@ -649,12 +661,12 @@
649
661
 
650
662
  error: {
651
663
  api : 'You attempted to load content without API module',
652
- noContent : 'The tab you specified is missing a content url.',
653
664
  method : 'The method you called is not defined',
654
- state : 'The state library has not been initialized',
655
665
  missingTab : 'Tab cannot be found',
666
+ noContent : 'The tab you specified is missing a content url.',
656
667
  path : 'History enabled, but no path was specified',
657
- recursion : 'Max recursive depth reached'
668
+ recursion : 'Max recursive depth reached',
669
+ state : 'The state library has not been initialized'
658
670
  },
659
671
 
660
672
  metadata : {
@@ -669,7 +681,7 @@
669
681
  },
670
682
 
671
683
  selector : {
672
- tabs : '.tab'
684
+ tabs : '.ui.tab'
673
685
  }
674
686
 
675
687
  };
@@ -408,6 +408,7 @@ $.fn.transition = function() {
408
408
  .addClass(className.transition)
409
409
  .addClass(className.hidden)
410
410
  ;
411
+ module.repaint();
411
412
  },
412
413
  show: function() {
413
414
  module.verbose('Showing element');
@@ -416,6 +417,7 @@ $.fn.transition = function() {
416
417
  .addClass(className.transition)
417
418
  .addClass(className.visible)
418
419
  ;
420
+ module.repaint();
419
421
  },
420
422
 
421
423
  start: function() {
@@ -65,6 +65,7 @@
65
65
 
66
66
  .ui.form textarea,
67
67
  .ui.form input[type="text"],
68
+ .ui.form input[type="email"],
68
69
  .ui.form input[type="date"],
69
70
  .ui.form input[type="password"],
70
71
  .ui.form .ui.input {
@@ -73,6 +74,7 @@
73
74
 
74
75
  .ui.form textarea,
75
76
  .ui.form input[type="text"],
77
+ .ui.form input[type="email"],
76
78
  .ui.form input[type="date"],
77
79
  .ui.form input[type="password"] {
78
80
 
@@ -201,6 +203,8 @@
201
203
  ---------------------*/
202
204
 
203
205
  .ui.form input[type="text"]:focus,
206
+ .ui.form input[type="email"]:focus,
207
+ .ui.form input[type="date"]:focus,
204
208
  .ui.form input[type="password"]:focus,
205
209
  .ui.form textarea:focus {
206
210
  color: rgba(0, 0, 0, 0.85);
@@ -240,10 +244,12 @@
240
244
  }
241
245
  .ui.form .fields.error .field textarea,
242
246
  .ui.form .fields.error .field input[type="text"],
247
+ .ui.form .fields.error .field input[type="email"],
243
248
  .ui.form .fields.error .field input[type="date"],
244
249
  .ui.form .fields.error .field input[type="password"],
245
250
  .ui.form .field.error textarea,
246
251
  .ui.form .field.error input[type="text"],
252
+ .ui.form .field.error input[type="email"],
247
253
  .ui.form .field.error input[type="date"],
248
254
  .ui.form .field.error input[type="password"] {
249
255
  background-color: #FFFAFA;
@@ -263,6 +269,8 @@
263
269
  }
264
270
  .ui.form .field.error textarea:focus,
265
271
  .ui.form .field.error input[type="text"]:focus,
272
+ .ui.form .field.error input[type="email"]:focus,
273
+ .ui.form .field.error input[type="date"]:focus,
266
274
  .ui.form .field.error input[type="password"]:focus {
267
275
  border-color: rgba(255, 80, 80, 1);
268
276
  color: rgba(255, 80, 80, 1);
@@ -337,7 +345,7 @@
337
345
 
338
346
  width: 100%;
339
347
  height: 100%;
340
- background: rgba(255, 255, 255, 0.8) url(../images/loader-large.gif) no-repeat 50% 50%;
348
+ background: rgba(255, 255, 255, 0.8) url(/assets/semantic-ui/loader-large.gif) no-repeat 50% 50%;
341
349
  visibility: visible;
342
350
  }
343
351
 
@@ -395,7 +403,10 @@
395
403
  color: #FFFFFF;
396
404
  }
397
405
  .ui.inverted.form .field.error textarea,
398
- .ui.inverted.form .field.error input[type="text"] {
406
+ .ui.inverted.form .field.error input[type="text"],
407
+ .ui.inverted.form .field.error input[type="email"],
408
+ .ui.inverted.form .field.error input[type="date"],
409
+ .ui.inverted.form .field.error input[type="password"]{
399
410
  background-color: #FFCCCC;
400
411
  }
401
412
 
@@ -527,6 +538,8 @@
527
538
  }
528
539
  .ui.small.form textarea,
529
540
  .ui.small.form input[type="text"],
541
+ .ui.small.form input[type="email"],
542
+ .ui.small.form input[type="date"],
530
543
  .ui.small.form input[type="password"],
531
544
  .ui.small.form label {
532
545
  font-size: 1em;