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,459 @@
1
+ /* ******************************
2
+ Module - Video Component
3
+ Author: Jack Lukic
4
+ Notes: First Commit June 30, 2012
5
+
6
+ This is a video playlist and video embed plugin which helps
7
+ provide helpers for adding embed code for vimeo and youtube and
8
+ abstracting event handlers for each library
9
+
10
+ ****************************** */
11
+
12
+ ;(function ($, window, document, undefined) {
13
+
14
+ $.fn.video = function(parameters) {
15
+
16
+ var
17
+ $allModules = $(this),
18
+
19
+ settings = ( $.isPlainObject(parameters) )
20
+ ? $.extend(true, {}, $.fn.video.settings, parameters)
21
+ : $.fn.video.settings,
22
+
23
+ moduleSelector = $allModules.selector || '',
24
+
25
+ time = new Date().getTime(),
26
+ performance = [],
27
+
28
+ query = arguments[0],
29
+ methodInvoked = (typeof query == 'string'),
30
+ queryArguments = [].slice.call(arguments, 1),
31
+
32
+ selector = settings.selector,
33
+ className = settings.className,
34
+ error = settings.error,
35
+ metadata = settings.metadata,
36
+ namespace = settings.namespace,
37
+
38
+ eventNamespace = '.' + namespace,
39
+ moduleNamespace = namespace + '-module',
40
+
41
+ invokedResponse
42
+ ;
43
+
44
+ $allModules
45
+ .each(function() {
46
+ var
47
+ $module = $(this),
48
+ $placeholder = $module.find(selector.placeholder),
49
+ $playButton = $module.find(selector.playButton),
50
+ $embed = $module.find(selector.embed),
51
+
52
+ element = this,
53
+ instance = $module.data(moduleNamespace),
54
+ module
55
+ ;
56
+
57
+ module = {
58
+
59
+ initialize: function() {
60
+ module.debug('Initializing video');
61
+ $placeholder
62
+ .on('click' + eventNamespace, module.play)
63
+ ;
64
+ $playButton
65
+ .on('click' + eventNamespace, module.play)
66
+ ;
67
+ module.instantiate();
68
+ },
69
+
70
+ instantiate: function() {
71
+ module.verbose('Storing instance of module', module);
72
+ instance = module;
73
+ $module
74
+ .data(moduleNamespace, module)
75
+ ;
76
+ },
77
+
78
+ destroy: function() {
79
+ module.verbose('Destroying previous instance of video');
80
+ $module
81
+ .removeData(moduleNamespace)
82
+ .off(eventNamespace)
83
+ ;
84
+ },
85
+
86
+ // sets new video
87
+ change: function(source, id, url) {
88
+ module.debug('Changing video to ', source, id, url);
89
+ $module
90
+ .data(metadata.source, source)
91
+ .data(metadata.id, id)
92
+ .data(metadata.url, url)
93
+ ;
94
+ settings.onChange();
95
+ },
96
+
97
+ // clears video embed
98
+ reset: function() {
99
+ module.debug('Clearing video embed and showing placeholder');
100
+ $module
101
+ .removeClass(className.active)
102
+ ;
103
+ $embed
104
+ .html(' ')
105
+ ;
106
+ $placeholder
107
+ .show()
108
+ ;
109
+ settings.onReset();
110
+ },
111
+
112
+ // plays current video
113
+ play: function() {
114
+ module.debug('Playing video');
115
+ var
116
+ source = $module.data(metadata.source) || false,
117
+ url = $module.data(metadata.url) || false,
118
+ id = $module.data(metadata.id) || false
119
+ ;
120
+ $embed
121
+ .html( module.generate.html(source, id, url) )
122
+ ;
123
+ $module
124
+ .addClass(className.active)
125
+ ;
126
+ settings.onPlay();
127
+ },
128
+
129
+ generate: {
130
+ // generates iframe html
131
+ html: function(source, id, url) {
132
+ module.debug('Generating embed html');
133
+ var
134
+ width = (settings.width == 'auto')
135
+ ? $module.width()
136
+ : settings.width,
137
+ height = (settings.height == 'auto')
138
+ ? $module.height()
139
+ : settings.height,
140
+ html
141
+ ;
142
+ if(source && id) {
143
+ if(source == 'vimeo') {
144
+ html = ''
145
+ + '<iframe src="http://player.vimeo.com/video/' + id + '?=' + module.generate.url(source) + '"'
146
+ + ' width="' + width + '" height="' + height + '"'
147
+ + ' frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>'
148
+ ;
149
+ }
150
+ else if(source == 'youtube') {
151
+ html = ''
152
+ + '<iframe src="http://www.youtube.com/embed/' + id + '?=' + module.generate.url(source) + '"'
153
+ + ' width="' + width + '" height="' + height + '"'
154
+ + ' frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>'
155
+ ;
156
+ }
157
+ }
158
+ else if(url) {
159
+ html = ''
160
+ + '<iframe src="' + url + '"'
161
+ + ' width="' + width + '" height="' + height + '"'
162
+ + ' frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>'
163
+ ;
164
+ }
165
+ else {
166
+ module.error(error.noVideo);
167
+ }
168
+ return html;
169
+ },
170
+
171
+ // generate url parameters
172
+ url: function(source) {
173
+ var
174
+ api = (settings.api)
175
+ ? 1
176
+ : 0,
177
+ autoplay = (settings.autoplay)
178
+ ? 1
179
+ : 0,
180
+ hd = (settings.hd)
181
+ ? 1
182
+ : 0,
183
+ showUI = (settings.showUI)
184
+ ? 1
185
+ : 0,
186
+ // opposite used for some params
187
+ hideUI = !(settings.showUI)
188
+ ? 1
189
+ : 0,
190
+ url = ''
191
+ ;
192
+ if(source == 'vimeo') {
193
+ url = ''
194
+ + 'api=' + api
195
+ + '&amp;title=' + showUI
196
+ + '&amp;byline=' + showUI
197
+ + '&amp;portrait=' + showUI
198
+ + '&amp;autoplay=' + autoplay
199
+ ;
200
+ if(settings.color) {
201
+ url += '&amp;color=' + settings.color;
202
+ }
203
+ }
204
+ if(source == 'ustream') {
205
+ url = ''
206
+ + 'autoplay=' + autoplay
207
+ ;
208
+ if(settings.color) {
209
+ url += '&amp;color=' + settings.color;
210
+ }
211
+ }
212
+ else if(source == 'youtube') {
213
+ url = ''
214
+ + 'enablejsapi=' + api
215
+ + '&amp;autoplay=' + autoplay
216
+ + '&amp;autohide=' + hideUI
217
+ + '&amp;hq=' + hd
218
+ + '&amp;modestbranding=1'
219
+ ;
220
+ if(settings.color) {
221
+ url += '&amp;color=' + settings.color;
222
+ }
223
+ }
224
+ return url;
225
+ }
226
+ },
227
+
228
+ setting: function(name, value) {
229
+ if(value !== undefined) {
230
+ if( $.isPlainObject(name) ) {
231
+ $.extend(true, settings, name);
232
+ }
233
+ else {
234
+ settings[name] = value;
235
+ }
236
+ }
237
+ else {
238
+ return settings[name];
239
+ }
240
+ },
241
+ internal: function(name, value) {
242
+ if(value !== undefined) {
243
+ if( $.isPlainObject(name) ) {
244
+ $.extend(true, module, name);
245
+ }
246
+ else {
247
+ module[name] = value;
248
+ }
249
+ }
250
+ else {
251
+ return module[name];
252
+ }
253
+ },
254
+ debug: function() {
255
+ if(settings.debug) {
256
+ if(settings.performance) {
257
+ module.performance.log(arguments);
258
+ }
259
+ else {
260
+ module.debug = Function.prototype.bind.call(console.info, console, settings.moduleName + ':');
261
+ module.debug.apply(console, arguments);
262
+ }
263
+ }
264
+ },
265
+ verbose: function() {
266
+ if(settings.verbose && settings.debug) {
267
+ if(settings.performance) {
268
+ module.performance.log(arguments);
269
+ }
270
+ else {
271
+ module.verbose = Function.prototype.bind.call(console.info, console, settings.moduleName + ':');
272
+ module.verbose.apply(console, arguments);
273
+ }
274
+ }
275
+ },
276
+ error: function() {
277
+ module.error = Function.prototype.bind.call(console.error, console, settings.moduleName + ':');
278
+ module.error.apply(console, arguments);
279
+ },
280
+ performance: {
281
+ log: function(message) {
282
+ var
283
+ currentTime,
284
+ executionTime,
285
+ previousTime
286
+ ;
287
+ if(settings.performance) {
288
+ currentTime = new Date().getTime();
289
+ previousTime = time || currentTime;
290
+ executionTime = currentTime - previousTime;
291
+ time = currentTime;
292
+ performance.push({
293
+ 'Element' : element,
294
+ 'Name' : message[0],
295
+ 'Arguments' : [].slice.call(message, 1) || '',
296
+ 'Execution Time' : executionTime
297
+ });
298
+ }
299
+ clearTimeout(module.performance.timer);
300
+ module.performance.timer = setTimeout(module.performance.display, 100);
301
+ },
302
+ display: function() {
303
+ var
304
+ title = settings.name + ':',
305
+ totalTime = 0
306
+ ;
307
+ time = false;
308
+ clearTimeout(module.performance.timer);
309
+ $.each(performance, function(index, data) {
310
+ totalTime += data['Execution Time'];
311
+ });
312
+ title += ' ' + totalTime + 'ms';
313
+ if(moduleSelector) {
314
+ title += ' \'' + moduleSelector + '\'';
315
+ }
316
+ if($allModules.size() > 1) {
317
+ title += ' ' + '(' + $allModules.size() + ')';
318
+ }
319
+ if( (console.group !== undefined || console.table !== undefined) && performance.length > 0) {
320
+ console.groupCollapsed(title);
321
+ if(console.table) {
322
+ console.table(performance);
323
+ }
324
+ else {
325
+ $.each(performance, function(index, data) {
326
+ console.log(data['Name'] + ': ' + data['Execution Time']+'ms');
327
+ });
328
+ }
329
+ console.groupEnd();
330
+ }
331
+ performance = [];
332
+ }
333
+ },
334
+ invoke: function(query, passedArguments, context) {
335
+ var
336
+ maxDepth,
337
+ found,
338
+ response
339
+ ;
340
+ passedArguments = passedArguments || queryArguments;
341
+ context = element || context;
342
+ if(typeof query == 'string' && instance !== undefined) {
343
+ query = query.split(/[\. ]/);
344
+ maxDepth = query.length - 1;
345
+ $.each(query, function(depth, value) {
346
+ var camelCaseValue = (depth != maxDepth)
347
+ ? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
348
+ : query
349
+ ;
350
+ if( $.isPlainObject( instance[value] ) && (depth != maxDepth) ) {
351
+ instance = instance[value];
352
+ }
353
+ else if( $.isPlainObject( instance[camelCaseValue] ) && (depth != maxDepth) ) {
354
+ instance = instance[camelCaseValue];
355
+ }
356
+ else if( instance[value] !== undefined ) {
357
+ found = instance[value];
358
+ return false;
359
+ }
360
+ else if( instance[camelCaseValue] !== undefined ) {
361
+ found = instance[camelCaseValue];
362
+ return false;
363
+ }
364
+ else {
365
+ module.error(error.method);
366
+ return false;
367
+ }
368
+ });
369
+ }
370
+ if ( $.isFunction( found ) ) {
371
+ response = found.apply(context, passedArguments);
372
+ }
373
+ else if(found !== undefined) {
374
+ response = found;
375
+ }
376
+ if($.isArray(invokedResponse)) {
377
+ invokedResponse.push(response);
378
+ }
379
+ else if(typeof invokedResponse == 'string') {
380
+ invokedResponse = [invokedResponse, response];
381
+ }
382
+ else if(response !== undefined) {
383
+ invokedResponse = response;
384
+ }
385
+ return found;
386
+ }
387
+ };
388
+
389
+ if(methodInvoked) {
390
+ if(instance === undefined) {
391
+ module.initialize();
392
+ }
393
+ module.invoke(query);
394
+ }
395
+ else {
396
+ if(instance !== undefined) {
397
+ module.destroy();
398
+ }
399
+ module.initialize();
400
+ }
401
+ })
402
+ ;
403
+ return (invokedResponse !== undefined)
404
+ ? invokedResponse
405
+ : this
406
+ ;
407
+ };
408
+
409
+ $.fn.video.settings = {
410
+
411
+ name : 'Video',
412
+ namespace : 'video',
413
+
414
+ debug : true,
415
+ verbose : true,
416
+ performance : true,
417
+
418
+
419
+ metadata : {
420
+ source : 'source',
421
+ id : 'id',
422
+ url : 'url'
423
+ },
424
+
425
+ onPlay : function(){},
426
+ onReset : function(){},
427
+ onChange : function(){},
428
+
429
+ // callbacks not coded yet (needs to use jsapi)
430
+ onPause : function() {},
431
+ onStop : function() {},
432
+
433
+ width : 'auto',
434
+ height : 'auto',
435
+
436
+ autoplay : false,
437
+ color : '#442359',
438
+ hd : true,
439
+ showUI : false,
440
+ api : true,
441
+
442
+ error : {
443
+ noVideo : 'No video specified',
444
+ method : 'The method you called is not defined'
445
+ },
446
+
447
+ className : {
448
+ active : 'active'
449
+ },
450
+
451
+ selector : {
452
+ embed : '.embed',
453
+ placeholder : '.placeholder',
454
+ playButton : '.play'
455
+ }
456
+ };
457
+
458
+
459
+ })( jQuery, window , document );