semantic-ui-rails 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (90) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +17 -0
  3. data/Gemfile +4 -0
  4. data/LICENSE.txt +22 -0
  5. data/README.md +26 -0
  6. data/Rakefile +1 -0
  7. data/lib/generators/semantic/install/install_generator.rb +38 -0
  8. data/lib/generators/semantic/install/templates/semantic-ui.js +21 -0
  9. data/lib/generators/semantic/install/templates/semantic-ui/collections.less +6 -0
  10. data/lib/generators/semantic/install/templates/semantic-ui/elements.less +11 -0
  11. data/lib/generators/semantic/install/templates/semantic-ui/modules.less +18 -0
  12. data/lib/generators/semantic/install/templates/semantic-ui/views.less +6 -0
  13. data/lib/semantic/ui/rails.rb +10 -0
  14. data/lib/semantic/ui/rails/engine.rb +8 -0
  15. data/lib/semantic/ui/rails/version.rb +7 -0
  16. data/semantic-ui-rails.gemspec +23 -0
  17. data/vendor/assets/fonts/icons.eot +0 -0
  18. data/vendor/assets/fonts/icons.svg +450 -0
  19. data/vendor/assets/fonts/icons.ttf +0 -0
  20. data/vendor/assets/fonts/icons.woff +0 -0
  21. data/vendor/assets/images/semantic-ui/loader-large-inverted.gif +0 -0
  22. data/vendor/assets/images/semantic-ui/loader-large.gif +0 -0
  23. data/vendor/assets/images/semantic-ui/loader-medium-inverted.gif +0 -0
  24. data/vendor/assets/images/semantic-ui/loader-medium.gif +0 -0
  25. data/vendor/assets/images/semantic-ui/loader-mini-inverted.gif +0 -0
  26. data/vendor/assets/images/semantic-ui/loader-mini.gif +0 -0
  27. data/vendor/assets/images/semantic-ui/loader-small-inverted.gif +0 -0
  28. data/vendor/assets/images/semantic-ui/loader-small.gif +0 -0
  29. data/vendor/assets/javascripts/semantic-ui/accordion.js +411 -0
  30. data/vendor/assets/javascripts/semantic-ui/behavior/api.js +666 -0
  31. data/vendor/assets/javascripts/semantic-ui/behavior/colorize.js +271 -0
  32. data/vendor/assets/javascripts/semantic-ui/behavior/form.js +657 -0
  33. data/vendor/assets/javascripts/semantic-ui/behavior/state.js +752 -0
  34. data/vendor/assets/javascripts/semantic-ui/carousel.js +327 -0
  35. data/vendor/assets/javascripts/semantic-ui/chatroom.js +766 -0
  36. data/vendor/assets/javascripts/semantic-ui/checkbox.js +348 -0
  37. data/vendor/assets/javascripts/semantic-ui/dimmer.js +525 -0
  38. data/vendor/assets/javascripts/semantic-ui/dropdown.js +697 -0
  39. data/vendor/assets/javascripts/semantic-ui/modal.js +478 -0
  40. data/vendor/assets/javascripts/semantic-ui/nag.js +542 -0
  41. data/vendor/assets/javascripts/semantic-ui/popup.js +721 -0
  42. data/vendor/assets/javascripts/semantic-ui/rating.js +358 -0
  43. data/vendor/assets/javascripts/semantic-ui/search.js +770 -0
  44. data/vendor/assets/javascripts/semantic-ui/shape.js +776 -0
  45. data/vendor/assets/javascripts/semantic-ui/sidebar.js +489 -0
  46. data/vendor/assets/javascripts/semantic-ui/tab.js +674 -0
  47. data/vendor/assets/javascripts/semantic-ui/transition.js +645 -0
  48. data/vendor/assets/javascripts/semantic-ui/video.js +459 -0
  49. data/vendor/assets/stylesheets/semantic-ui/collections/breadcrumb.less +79 -0
  50. data/vendor/assets/stylesheets/semantic-ui/collections/form.less +536 -0
  51. data/vendor/assets/stylesheets/semantic-ui/collections/grid.less +655 -0
  52. data/vendor/assets/stylesheets/semantic-ui/collections/menu.less +1736 -0
  53. data/vendor/assets/stylesheets/semantic-ui/collections/message.less +337 -0
  54. data/vendor/assets/stylesheets/semantic-ui/collections/table.less +526 -0
  55. data/vendor/assets/stylesheets/semantic-ui/elements/button.less +1294 -0
  56. data/vendor/assets/stylesheets/semantic-ui/elements/divider.less +200 -0
  57. data/vendor/assets/stylesheets/semantic-ui/elements/header.less +325 -0
  58. data/vendor/assets/stylesheets/semantic-ui/elements/icon.less +449 -0
  59. data/vendor/assets/stylesheets/semantic-ui/elements/image.less +170 -0
  60. data/vendor/assets/stylesheets/semantic-ui/elements/input.less +287 -0
  61. data/vendor/assets/stylesheets/semantic-ui/elements/label.less +805 -0
  62. data/vendor/assets/stylesheets/semantic-ui/elements/loader.less +178 -0
  63. data/vendor/assets/stylesheets/semantic-ui/elements/progress.less +353 -0
  64. data/vendor/assets/stylesheets/semantic-ui/elements/segment.less +465 -0
  65. data/vendor/assets/stylesheets/semantic-ui/elements/step.less +294 -0
  66. data/vendor/assets/stylesheets/semantic-ui/modules/accordion.less +135 -0
  67. data/vendor/assets/stylesheets/semantic-ui/modules/carousel.less +71 -0
  68. data/vendor/assets/stylesheets/semantic-ui/modules/chatroom.less +271 -0
  69. data/vendor/assets/stylesheets/semantic-ui/modules/checkbox.less +378 -0
  70. data/vendor/assets/stylesheets/semantic-ui/modules/dimmer.less +230 -0
  71. data/vendor/assets/stylesheets/semantic-ui/modules/dropdown.less +506 -0
  72. data/vendor/assets/stylesheets/semantic-ui/modules/extra.transition.less +1197 -0
  73. data/vendor/assets/stylesheets/semantic-ui/modules/modal.less +154 -0
  74. data/vendor/assets/stylesheets/semantic-ui/modules/nag.less +175 -0
  75. data/vendor/assets/stylesheets/semantic-ui/modules/popup.less +238 -0
  76. data/vendor/assets/stylesheets/semantic-ui/modules/rating.less +151 -0
  77. data/vendor/assets/stylesheets/semantic-ui/modules/reveal.less +367 -0
  78. data/vendor/assets/stylesheets/semantic-ui/modules/search.less +275 -0
  79. data/vendor/assets/stylesheets/semantic-ui/modules/shape.less +115 -0
  80. data/vendor/assets/stylesheets/semantic-ui/modules/sidebar.less +147 -0
  81. data/vendor/assets/stylesheets/semantic-ui/modules/tab.less +59 -0
  82. data/vendor/assets/stylesheets/semantic-ui/modules/transition.less +839 -0
  83. data/vendor/assets/stylesheets/semantic-ui/modules/video.less +99 -0
  84. data/vendor/assets/stylesheets/semantic-ui/views/comment.less +221 -0
  85. data/vendor/assets/stylesheets/semantic-ui/views/feed.less +151 -0
  86. data/vendor/assets/stylesheets/semantic-ui/views/item.less +641 -0
  87. data/vendor/assets/stylesheets/semantic-ui/views/list.less +491 -0
  88. data/vendor/assets/stylesheets/semantic-ui/views/sitemap.less +47 -0
  89. data/vendor/assets/stylesheets/semantic-ui/views/statistic.less +34 -0
  90. metadata +161 -0
@@ -0,0 +1,489 @@
1
+ /* ******************************
2
+ Semantic Module: Dropdown
3
+ Author: Jack Lukic
4
+ Notes: First Commit May 25, 2013
5
+
6
+ ****************************** */
7
+
8
+ ;(function ( $, window, document, undefined ) {
9
+
10
+ $.fn.sidebar = function(parameters) {
11
+ var
12
+ $allModules = $(this),
13
+
14
+ settings = ( $.isPlainObject(parameters) )
15
+ ? $.extend(true, {}, $.fn.sidebar.settings, parameters)
16
+ : $.fn.sidebar.settings,
17
+
18
+ selector = settings.selector,
19
+ className = settings.className,
20
+ namespace = settings.namespace,
21
+ error = settings.error,
22
+
23
+ eventNamespace = '.' + namespace,
24
+ moduleNamespace = 'module-' + namespace,
25
+ moduleSelector = $allModules.selector || '',
26
+
27
+ time = new Date().getTime(),
28
+ performance = [],
29
+
30
+ query = arguments[0],
31
+ methodInvoked = (typeof query == 'string'),
32
+ queryArguments = [].slice.call(arguments, 1),
33
+ invokedResponse
34
+ ;
35
+
36
+ $allModules
37
+ .each(function() {
38
+ var
39
+ $module = $(this),
40
+
41
+ $body = $('body'),
42
+ $head = $('head'),
43
+ $style = $('style[title=' + namespace + ']'),
44
+
45
+ element = this,
46
+ instance = $module.data(moduleNamespace),
47
+ module
48
+ ;
49
+
50
+ module = {
51
+
52
+ initialize: function() {
53
+ module.debug('Initializing sidebar', $module);
54
+ module.instantiate();
55
+ },
56
+
57
+ instantiate: function() {
58
+ module.verbose('Storing instance of module', module);
59
+ instance = module;
60
+ $module
61
+ .data(moduleNamespace, module)
62
+ ;
63
+ },
64
+
65
+ destroy: function() {
66
+ module.verbose('Destroying previous module for', $module);
67
+ $module
68
+ .off(eventNamespace)
69
+ .removeData(moduleNamespace)
70
+ ;
71
+ },
72
+
73
+ refresh: function() {
74
+ module.verbose('Refreshing selector cache');
75
+ $style = $('style[title=' + namespace + ']');
76
+ },
77
+
78
+ attach: {
79
+
80
+ events: function(selector, event) {
81
+ var
82
+ $toggle = $(selector)
83
+ ;
84
+ event = $.isFunction(module[event])
85
+ ? module[event]
86
+ : module.toggle
87
+ ;
88
+ if($toggle.size() > 0) {
89
+ module.debug('Attaching sidebar events to element', selector, event);
90
+ $toggle
91
+ .off(eventNamespace)
92
+ .on('click' + eventNamespace, event)
93
+ ;
94
+ }
95
+ else {
96
+ module.error(error.notFound);
97
+ }
98
+ }
99
+
100
+ },
101
+
102
+ show: function() {
103
+ module.debug('Showing sidebar');
104
+ if(module.is.closed()) {
105
+ if(!settings.overlay) {
106
+ module.pushPage();
107
+ }
108
+ module.set.active();
109
+ }
110
+ else {
111
+ module.debug('Sidebar is already visible');
112
+ }
113
+ },
114
+
115
+ hide: function() {
116
+ if(module.is.open()) {
117
+ if(!settings.overlay) {
118
+ module.pullPage();
119
+ module.remove.pushed();
120
+ }
121
+ module.remove.active();
122
+ }
123
+ },
124
+
125
+ toggle: function() {
126
+ if(module.is.closed()) {
127
+ module.show();
128
+ }
129
+ else {
130
+ module.hide();
131
+ }
132
+ },
133
+
134
+ pushPage: function() {
135
+ var
136
+ direction = module.get.direction(),
137
+ distance = (module.is.vertical())
138
+ ? $module.outerHeight()
139
+ : $module.outerWidth()
140
+ ;
141
+ if(settings.useCSS) {
142
+ module.debug('Using CSS to animate body');
143
+ module.add.bodyCSS(direction, distance);
144
+ module.set.pushed();
145
+ }
146
+ else {
147
+ module.animatePage(direction, distance, module.set.pushed);
148
+ }
149
+ },
150
+
151
+ pullPage: function() {
152
+ var
153
+ direction = module.get.direction()
154
+ ;
155
+ if(settings.useCSS) {
156
+ module.debug('Resetting body position css');
157
+ module.remove.bodyCSS();
158
+ }
159
+ else {
160
+ module.debug('Resetting body position using javascript');
161
+ module.animatePage(direction, 0);
162
+ }
163
+ module.remove.pushed();
164
+ },
165
+
166
+ animatePage: function(direction, distance) {
167
+ var
168
+ animateSettings = {}
169
+ ;
170
+ animateSettings['padding-' + direction] = distance;
171
+ module.debug('Using javascript to animate body', animateSettings);
172
+ $body
173
+ .animate(animateSettings, settings.duration, module.set.pushed)
174
+ ;
175
+ },
176
+
177
+ add: {
178
+ bodyCSS: function(direction, distance) {
179
+ var
180
+ style
181
+ ;
182
+ if(direction !== className.bottom) {
183
+ style = ''
184
+ + '<style title="' + namespace + '">'
185
+ + 'body.pushed {'
186
+ + ' margin-' + direction + ': ' + distance + 'px !important;'
187
+ + '}'
188
+ + '</style>'
189
+ ;
190
+ }
191
+ $head.append(style);
192
+ module.debug('Adding body css to head', $style);
193
+ }
194
+ },
195
+
196
+ remove: {
197
+ bodyCSS: function() {
198
+ module.debug('Removing body css styles', $style);
199
+ module.refresh();
200
+ $style.remove();
201
+ },
202
+ active: function() {
203
+ $module.removeClass(className.active);
204
+ },
205
+ pushed: function() {
206
+ module.verbose('Removing body push state', module.get.direction());
207
+ $body
208
+ .removeClass(className[ module.get.direction() ])
209
+ .removeClass(className.pushed)
210
+ ;
211
+ }
212
+ },
213
+
214
+ set: {
215
+ active: function() {
216
+ $module.addClass(className.active);
217
+ },
218
+ pushed: function() {
219
+ module.verbose('Adding body push state', module.get.direction());
220
+ $body
221
+ .addClass(className[ module.get.direction() ])
222
+ .addClass(className.pushed)
223
+ ;
224
+ }
225
+ },
226
+
227
+ get: {
228
+ direction: function() {
229
+ if($module.hasClass(className.top)) {
230
+ return className.top;
231
+ }
232
+ else if($module.hasClass(className.right)) {
233
+ return className.right;
234
+ }
235
+ else if($module.hasClass(className.bottom)) {
236
+ return className.bottom;
237
+ }
238
+ else {
239
+ return className.left;
240
+ }
241
+ },
242
+ transitionEvent: function() {
243
+ var
244
+ element = document.createElement('element'),
245
+ transitions = {
246
+ 'transition' :'transitionend',
247
+ 'OTransition' :'oTransitionEnd',
248
+ 'MozTransition' :'transitionend',
249
+ 'WebkitTransition' :'webkitTransitionEnd'
250
+ },
251
+ transition
252
+ ;
253
+ for(transition in transitions){
254
+ if( element.style[transition] !== undefined ){
255
+ return transitions[transition];
256
+ }
257
+ }
258
+ }
259
+ },
260
+
261
+ is: {
262
+ open: function() {
263
+ return $module.is(':animated') || $module.hasClass(className.active);
264
+ },
265
+ closed: function() {
266
+ return !module.is.open();
267
+ },
268
+ vertical: function() {
269
+ return $module.hasClass(className.top);
270
+ }
271
+ },
272
+
273
+ setting: function(name, value) {
274
+ if(value !== undefined) {
275
+ if( $.isPlainObject(name) ) {
276
+ $.extend(true, settings, name);
277
+ }
278
+ else {
279
+ settings[name] = value;
280
+ }
281
+ }
282
+ else {
283
+ return settings[name];
284
+ }
285
+ },
286
+ internal: function(name, value) {
287
+ if(value !== undefined) {
288
+ if( $.isPlainObject(name) ) {
289
+ $.extend(true, module, name);
290
+ }
291
+ else {
292
+ module[name] = value;
293
+ }
294
+ }
295
+ else {
296
+ return module[name];
297
+ }
298
+ },
299
+ debug: function() {
300
+ if(settings.debug) {
301
+ if(settings.performance) {
302
+ module.performance.log(arguments);
303
+ }
304
+ else {
305
+ module.debug = Function.prototype.bind.call(console.info, console, settings.moduleName + ':');
306
+ module.debug.apply(console, arguments);
307
+ }
308
+ }
309
+ },
310
+ verbose: function() {
311
+ if(settings.verbose && settings.debug) {
312
+ if(settings.performance) {
313
+ module.performance.log(arguments);
314
+ }
315
+ else {
316
+ module.verbose = Function.prototype.bind.call(console.info, console, settings.moduleName + ':');
317
+ module.verbose.apply(console, arguments);
318
+ }
319
+ }
320
+ },
321
+ error: function() {
322
+ module.error = Function.prototype.bind.call(console.error, console, settings.moduleName + ':');
323
+ module.error.apply(console, arguments);
324
+ },
325
+ performance: {
326
+ log: function(message) {
327
+ var
328
+ currentTime,
329
+ executionTime,
330
+ previousTime
331
+ ;
332
+ if(settings.performance) {
333
+ currentTime = new Date().getTime();
334
+ previousTime = time || currentTime;
335
+ executionTime = currentTime - previousTime;
336
+ time = currentTime;
337
+ performance.push({
338
+ 'Element' : element,
339
+ 'Name' : message[0],
340
+ 'Arguments' : [].slice.call(message, 1) || '',
341
+ 'Execution Time' : executionTime
342
+ });
343
+ }
344
+ clearTimeout(module.performance.timer);
345
+ module.performance.timer = setTimeout(module.performance.display, 100);
346
+ },
347
+ display: function() {
348
+ var
349
+ title = settings.name + ':',
350
+ totalTime = 0
351
+ ;
352
+ time = false;
353
+ clearTimeout(module.performance.timer);
354
+ $.each(performance, function(index, data) {
355
+ totalTime += data['Execution Time'];
356
+ });
357
+ title += ' ' + totalTime + 'ms';
358
+ if(moduleSelector) {
359
+ title += ' \'' + moduleSelector + '\'';
360
+ }
361
+ if($allModules.size() > 1) {
362
+ title += ' ' + '(' + $allModules.size() + ')';
363
+ }
364
+ if( (console.group !== undefined || console.table !== undefined) && performance.length > 0) {
365
+ console.groupCollapsed(title);
366
+ if(console.table) {
367
+ console.table(performance);
368
+ }
369
+ else {
370
+ $.each(performance, function(index, data) {
371
+ console.log(data['Name'] + ': ' + data['Execution Time']+'ms');
372
+ });
373
+ }
374
+ console.groupEnd();
375
+ }
376
+ performance = [];
377
+ }
378
+ },
379
+ invoke: function(query, passedArguments, context) {
380
+ var
381
+ maxDepth,
382
+ found,
383
+ response
384
+ ;
385
+ passedArguments = passedArguments || queryArguments;
386
+ context = element || context;
387
+ if(typeof query == 'string' && instance !== undefined) {
388
+ query = query.split(/[\. ]/);
389
+ maxDepth = query.length - 1;
390
+ $.each(query, function(depth, value) {
391
+ var camelCaseValue = (depth != maxDepth)
392
+ ? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
393
+ : query
394
+ ;
395
+ if( $.isPlainObject( instance[value] ) && (depth != maxDepth) ) {
396
+ instance = instance[value];
397
+ }
398
+ else if( $.isPlainObject( instance[camelCaseValue] ) && (depth != maxDepth) ) {
399
+ instance = instance[camelCaseValue];
400
+ }
401
+ else if( instance[value] !== undefined ) {
402
+ found = instance[value];
403
+ return false;
404
+ }
405
+ else if( instance[camelCaseValue] !== undefined ) {
406
+ found = instance[camelCaseValue];
407
+ return false;
408
+ }
409
+ else {
410
+ module.error(error.method);
411
+ return false;
412
+ }
413
+ });
414
+ }
415
+ if ( $.isFunction( found ) ) {
416
+ response = found.apply(context, passedArguments);
417
+ }
418
+ else if(found !== undefined) {
419
+ response = found;
420
+ }
421
+ if($.isArray(invokedResponse)) {
422
+ invokedResponse.push(response);
423
+ }
424
+ else if(typeof invokedResponse == 'string') {
425
+ invokedResponse = [invokedResponse, response];
426
+ }
427
+ else if(response !== undefined) {
428
+ invokedResponse = response;
429
+ }
430
+ return found;
431
+ }
432
+ };
433
+ if(methodInvoked) {
434
+ if(instance === undefined) {
435
+ module.initialize();
436
+ }
437
+ module.invoke(query);
438
+ }
439
+ else {
440
+ if(instance !== undefined) {
441
+ module.destroy();
442
+ }
443
+ module.initialize();
444
+ }
445
+ })
446
+ ;
447
+
448
+ return (invokedResponse !== undefined)
449
+ ? invokedResponse
450
+ : this
451
+ ;
452
+ };
453
+
454
+ $.fn.sidebar.settings = {
455
+
456
+ name : 'Sidebar',
457
+ namespace : 'sidebar',
458
+
459
+ verbose : true,
460
+ debug : true,
461
+ performance : true,
462
+
463
+ useCSS : true,
464
+ overlay : false,
465
+ duration : 300,
466
+
467
+ side : 'left',
468
+
469
+ onChange : function(){},
470
+ onShow : function(){},
471
+ onHide : function(){},
472
+
473
+ className: {
474
+ active : 'active',
475
+ pushed : 'pushed',
476
+ top : 'top',
477
+ left : 'left',
478
+ right : 'right',
479
+ bottom : 'bottom'
480
+ },
481
+
482
+ error : {
483
+ method : 'The method you called is not defined.',
484
+ notFound : 'There were no elements that matched the specified selector'
485
+ }
486
+
487
+ };
488
+
489
+ })( jQuery, window , document );