semantic_ui_rails 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +17 -0
  3. data/Gemfile +4 -0
  4. data/LICENSE +20 -0
  5. data/README.md +4 -0
  6. data/Rakefile +1 -0
  7. data/app/assets/fonts/semantic/icons.eot +0 -0
  8. data/app/assets/fonts/semantic/icons.svg +450 -0
  9. data/app/assets/fonts/semantic/icons.ttf +0 -0
  10. data/app/assets/fonts/semantic/icons.woff +0 -0
  11. data/app/assets/images/semantic/loader-large-inverted.gif +0 -0
  12. data/app/assets/images/semantic/loader-large.gif +0 -0
  13. data/app/assets/images/semantic/loader-medium-inverted.gif +0 -0
  14. data/app/assets/images/semantic/loader-medium.gif +0 -0
  15. data/app/assets/images/semantic/loader-mini-inverted.gif +0 -0
  16. data/app/assets/images/semantic/loader-mini.gif +0 -0
  17. data/app/assets/images/semantic/loader-small-inverted.gif +0 -0
  18. data/app/assets/images/semantic/loader-small.gif +0 -0
  19. data/app/assets/javascript/semantic/accordion.js +411 -0
  20. data/app/assets/javascript/semantic/behavior/api.js +666 -0
  21. data/app/assets/javascript/semantic/behavior/colorize.js +271 -0
  22. data/app/assets/javascript/semantic/behavior/form.js +703 -0
  23. data/app/assets/javascript/semantic/behavior/state.js +752 -0
  24. data/app/assets/javascript/semantic/chatroom.js +766 -0
  25. data/app/assets/javascript/semantic/checkbox.js +348 -0
  26. data/app/assets/javascript/semantic/dimmer.js +524 -0
  27. data/app/assets/javascript/semantic/dropdown.js +707 -0
  28. data/app/assets/javascript/semantic/modal.js +478 -0
  29. data/app/assets/javascript/semantic/nag.js +542 -0
  30. data/app/assets/javascript/semantic/popup.js +721 -0
  31. data/app/assets/javascript/semantic/rating.js +358 -0
  32. data/app/assets/javascript/semantic/search.js +769 -0
  33. data/app/assets/javascript/semantic/shape.js +776 -0
  34. data/app/assets/javascript/semantic/sidebar.js +489 -0
  35. data/app/assets/javascript/semantic/tab.js +674 -0
  36. data/app/assets/javascript/semantic/transition.js +650 -0
  37. data/app/assets/javascript/semantic/video.js +459 -0
  38. data/app/assets/stylesheets/semantic/accordion.css +97 -0
  39. data/app/assets/stylesheets/semantic/breadcrumb.css +66 -0
  40. data/app/assets/stylesheets/semantic/button.css +993 -0
  41. data/app/assets/stylesheets/semantic/chatroom.css +242 -0
  42. data/app/assets/stylesheets/semantic/checkbox.css +300 -0
  43. data/app/assets/stylesheets/semantic/comment.css +178 -0
  44. data/app/assets/stylesheets/semantic/dimmer.css +185 -0
  45. data/app/assets/stylesheets/semantic/divider.css +155 -0
  46. data/app/assets/stylesheets/semantic/dropdown.css +415 -0
  47. data/app/assets/stylesheets/semantic/feed.css +126 -0
  48. data/app/assets/stylesheets/semantic/form.css +427 -0
  49. data/app/assets/stylesheets/semantic/grid.css +561 -0
  50. data/app/assets/stylesheets/semantic/header.css +277 -0
  51. data/app/assets/stylesheets/semantic/icon.css +811 -0
  52. data/app/assets/stylesheets/semantic/image.css +143 -0
  53. data/app/assets/stylesheets/semantic/input.css +225 -0
  54. data/app/assets/stylesheets/semantic/item.css +564 -0
  55. data/app/assets/stylesheets/semantic/label.css +687 -0
  56. data/app/assets/stylesheets/semantic/list.css +418 -0
  57. data/app/assets/stylesheets/semantic/loader.css +148 -0
  58. data/app/assets/stylesheets/semantic/menu.css +1409 -0
  59. data/app/assets/stylesheets/semantic/message.css +242 -0
  60. data/app/assets/stylesheets/semantic/modal.css +123 -0
  61. data/app/assets/stylesheets/semantic/nag.css +130 -0
  62. data/app/assets/stylesheets/semantic/popup.css +209 -0
  63. data/app/assets/stylesheets/semantic/progress.css +257 -0
  64. data/app/assets/stylesheets/semantic/rating.css +120 -0
  65. data/app/assets/stylesheets/semantic/reveal.css +283 -0
  66. data/app/assets/stylesheets/semantic/search.css +222 -0
  67. data/app/assets/stylesheets/semantic/segment.css +362 -0
  68. data/app/assets/stylesheets/semantic/shape.css +87 -0
  69. data/app/assets/stylesheets/semantic/sidebar.css +100 -0
  70. data/app/assets/stylesheets/semantic/step.css +240 -0
  71. data/app/assets/stylesheets/semantic/tab.css +52 -0
  72. data/app/assets/stylesheets/semantic/table.css +468 -0
  73. data/app/assets/stylesheets/semantic/transition.css +867 -0
  74. data/app/assets/stylesheets/semantic/video.css +81 -0
  75. data/lib/semantic_ui_rails/version.rb +3 -0
  76. data/lib/semantic_ui_rails.rb +7 -0
  77. data/semantic_ui_rails.gemspec +23 -0
  78. metadata +149 -0
@@ -0,0 +1,271 @@
1
+ /* ******************************
2
+ Colorizer
3
+ Author: Jack Lukic
4
+ Notes: First Commit June 06, 2012
5
+
6
+ Tooltip Wrapper for loading
7
+ colorizes of ideations, concepts and users
8
+
9
+ Will eventually rewrite to use own tooltip lib
10
+
11
+ ****************************** */
12
+
13
+ ;(function ( $, window, document, undefined ) {
14
+
15
+ $.fn.colorize = function(parameters) {
16
+ var
17
+ settings = $.extend(true, {}, $.fn.colorize.settings, parameters),
18
+ // hoist arguments
19
+ moduleArguments = arguments || false
20
+ ;
21
+ $(this)
22
+ .each(function(instanceIndex) {
23
+
24
+ var
25
+ $module = $(this),
26
+
27
+ mainCanvas = $('<canvas />')[0],
28
+ imageCanvas = $('<canvas />')[0],
29
+ overlayCanvas = $('<canvas />')[0],
30
+
31
+ backgroundImage = new Image(),
32
+
33
+ // defs
34
+ mainContext,
35
+ imageContext,
36
+ overlayContext,
37
+
38
+ image,
39
+ imageName,
40
+
41
+ width,
42
+ height,
43
+
44
+ // shortucts
45
+ colors = settings.colors,
46
+ paths = settings.paths,
47
+ namespace = settings.namespace,
48
+ error = settings.error,
49
+
50
+ // boilerplate
51
+ instance = $module.data('module-' + namespace),
52
+ module
53
+ ;
54
+
55
+ module = {
56
+
57
+ checkPreconditions: function() {
58
+ module.debug('Checking pre-conditions');
59
+
60
+ if( !$.isPlainObject(colors) || $.isEmptyObject(colors) ) {
61
+ module.error(error.undefinedColors);
62
+ return false;
63
+ }
64
+ return true;
65
+ },
66
+
67
+ async: function(callback) {
68
+ if(settings.async) {
69
+ setTimeout(callback, 0);
70
+ }
71
+ else {
72
+ callback();
73
+ }
74
+ },
75
+
76
+ getMetadata: function() {
77
+ module.debug('Grabbing metadata');
78
+ image = $module.data('image') || settings.image || undefined;
79
+ imageName = $module.data('name') || settings.name || instanceIndex;
80
+ width = settings.width || $module.width();
81
+ height = settings.height || $module.height();
82
+ if(width === 0 || height === 0) {
83
+ module.error(error.undefinedSize);
84
+ }
85
+ },
86
+
87
+ initialize: function() {
88
+ module.debug('Initializing with colors', colors);
89
+ if( module.checkPreconditions() ) {
90
+
91
+ module.async(function() {
92
+ module.getMetadata();
93
+ module.canvas.create();
94
+
95
+ module.draw.image(function() {
96
+ module.draw.colors();
97
+ module.canvas.merge();
98
+ });
99
+ $module
100
+ .data('module-' + namespace, module)
101
+ ;
102
+ });
103
+ }
104
+ },
105
+
106
+ redraw: function() {
107
+ module.debug('Redrawing image');
108
+ module.async(function() {
109
+ module.canvas.clear();
110
+ module.draw.colors();
111
+ module.canvas.merge();
112
+ });
113
+ },
114
+
115
+ change: {
116
+ color: function(colorName, color) {
117
+ module.debug('Changing color', colorName);
118
+ if(colors[colorName] === undefined) {
119
+ module.error(error.missingColor);
120
+ return false;
121
+ }
122
+ colors[colorName] = color;
123
+ module.redraw();
124
+ }
125
+ },
126
+
127
+ canvas: {
128
+ create: function() {
129
+ module.debug('Creating canvases');
130
+
131
+ mainCanvas.width = width;
132
+ mainCanvas.height = height;
133
+ imageCanvas.width = width;
134
+ imageCanvas.height = height;
135
+ overlayCanvas.width = width;
136
+ overlayCanvas.height = height;
137
+
138
+ mainContext = mainCanvas.getContext('2d');
139
+ imageContext = imageCanvas.getContext('2d');
140
+ overlayContext = overlayCanvas.getContext('2d');
141
+
142
+ $module
143
+ .append( mainCanvas )
144
+ ;
145
+ mainContext = $module.children('canvas')[0].getContext('2d');
146
+ },
147
+ clear: function(context) {
148
+ module.debug('Clearing canvas');
149
+ overlayContext.fillStyle = '#FFFFFF';
150
+ overlayContext.fillRect(0, 0, width, height);
151
+ },
152
+ merge: function() {
153
+ if( !$.isFunction(mainContext.blendOnto) ) {
154
+ module.error(error.missingPlugin);
155
+ return;
156
+ }
157
+ mainContext.putImageData( imageContext.getImageData(0, 0, width, height), 0, 0);
158
+ overlayContext.blendOnto(mainContext, 'multiply');
159
+ }
160
+ },
161
+
162
+ draw: {
163
+
164
+ image: function(callback) {
165
+ module.debug('Drawing image');
166
+ callback = callback || function(){};
167
+ if(image) {
168
+ backgroundImage.src = image;
169
+ backgroundImage.onload = function() {
170
+ imageContext.drawImage(backgroundImage, 0, 0);
171
+ callback();
172
+ };
173
+ }
174
+ else {
175
+ module.error(error.noImage);
176
+ callback();
177
+ }
178
+ },
179
+
180
+ colors: function() {
181
+ module.debug('Drawing color overlays', colors);
182
+ $.each(colors, function(colorName, color) {
183
+ settings.onDraw(overlayContext, imageName, colorName, color);
184
+ });
185
+ }
186
+
187
+ },
188
+
189
+ debug: function(message, variableName) {
190
+ if(settings.debug) {
191
+ if(variableName !== undefined) {
192
+ console.info(settings.moduleName + ': ' + message, variableName);
193
+ }
194
+ else {
195
+ console.info(settings.moduleName + ': ' + message);
196
+ }
197
+ }
198
+ },
199
+ error: function(errorMessage) {
200
+ console.warn(settings.moduleName + ': ' + errorMessage);
201
+ },
202
+ invoke: function(methodName, context, methodArguments) {
203
+ var
204
+ method
205
+ ;
206
+ methodArguments = methodArguments || Array.prototype.slice.call( arguments, 2 );
207
+
208
+ if(typeof methodName == 'string' && instance !== undefined) {
209
+ methodName = methodName.split('.');
210
+ $.each(methodName, function(index, name) {
211
+ if( $.isPlainObject( instance[name] ) ) {
212
+ instance = instance[name];
213
+ return true;
214
+ }
215
+ else if( $.isFunction( instance[name] ) ) {
216
+ method = instance[name];
217
+ return true;
218
+ }
219
+ module.error(settings.error.method);
220
+ return false;
221
+ });
222
+ }
223
+ return ( $.isFunction( method ) )
224
+ ? method.apply(context, methodArguments)
225
+ : false
226
+ ;
227
+ }
228
+
229
+ };
230
+ if(instance !== undefined && moduleArguments) {
231
+ // simpler than invoke realizing to invoke itself (and losing scope due prototype.call()
232
+ if(moduleArguments[0] == 'invoke') {
233
+ moduleArguments = Array.prototype.slice.call( moduleArguments, 1 );
234
+ }
235
+ return module.invoke(moduleArguments[0], this, Array.prototype.slice.call( moduleArguments, 1 ) );
236
+ }
237
+ // initializing
238
+ module.initialize();
239
+ })
240
+ ;
241
+ return this;
242
+ };
243
+
244
+ $.fn.colorize.settings = {
245
+ name : 'Image Colorizer',
246
+ debug : true,
247
+ namespace : 'colorize',
248
+
249
+ onDraw: function(overlayContext, imageName, colorName, color) {},
250
+
251
+ // whether to block execution while updating canvas
252
+ async: true,
253
+ // object containing names and default values of color regions
254
+ colors: {},
255
+
256
+ metadata: {
257
+ image : 'image',
258
+ name : 'name'
259
+ },
260
+
261
+ error: {
262
+ noImage : 'No tracing image specified',
263
+ undefinedColors : 'No default colors specified.',
264
+ missingColor : 'Attempted to change color that does not exist',
265
+ missingPlugin : 'Blend onto plug-in must be included',
266
+ undefinedHeight : 'The width or height of image canvas could not be automatically determined. Please specify a height.'
267
+ }
268
+
269
+ };
270
+
271
+ })( jQuery, window , document );