colorgy_style 0.0.0.1 → 0.0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/assets/javascripts/colorgy/addons/holder.js +1 -0
  4. data/assets/javascripts/colorgy/components/alert.js +9 -0
  5. data/assets/javascripts/colorgy/components/dropdown.js +8 -0
  6. data/assets/javascripts/colorgy/flash.js +86 -0
  7. data/assets/javascripts/colorgy/lib/interactiveStyle.js +5 -0
  8. data/assets/javascripts/colorgy/lib/jquery.getOrAddChild.js +12 -0
  9. data/assets/javascripts/colorgy/main.js +3 -0
  10. data/assets/javascripts/vendor/holder.js +2471 -0
  11. data/assets/javascripts/vendor/toastr.js +442 -0
  12. data/assets/stylesheets/colorgy/components/_alert.scss +40 -0
  13. data/assets/stylesheets/colorgy/components/_badge.scss +9 -0
  14. data/assets/stylesheets/colorgy/components/_breadcrumb.scss +9 -0
  15. data/assets/stylesheets/colorgy/components/_button.scss +50 -7
  16. data/assets/stylesheets/colorgy/components/_button_group.scss +33 -0
  17. data/assets/stylesheets/colorgy/components/_dropdown.scss +18 -0
  18. data/assets/stylesheets/colorgy/components/_input_group.scss +23 -0
  19. data/assets/stylesheets/colorgy/components/_label.scss +39 -0
  20. data/assets/stylesheets/colorgy/components/_list_group.scss +9 -0
  21. data/assets/stylesheets/colorgy/components/_media.scss +9 -0
  22. data/assets/stylesheets/colorgy/components/_nav.scss +33 -0
  23. data/assets/stylesheets/colorgy/components/_navbar.scss +23 -0
  24. data/assets/stylesheets/colorgy/components/_page_header.scss +11 -0
  25. data/assets/stylesheets/colorgy/components/_pager.scss +9 -0
  26. data/assets/stylesheets/colorgy/components/_pagination.scss +23 -0
  27. data/assets/stylesheets/colorgy/components/_panel.scss +39 -0
  28. data/assets/stylesheets/colorgy/components/_progress_bar.scss +41 -0
  29. data/assets/stylesheets/colorgy/components/_thumbnail.scss +9 -0
  30. data/assets/stylesheets/colorgy/components/_toast.scss +352 -0
  31. data/assets/stylesheets/colorgy/components/_well.scss +23 -0
  32. data/assets/stylesheets/colorgy/core/_base.scss +1 -1
  33. data/assets/stylesheets/colorgy/core/_config.scss +1 -1
  34. data/assets/stylesheets/colorgy/core/_grid.scss +1 -1
  35. data/assets/stylesheets/colorgy/core/_tools.scss +9 -0
  36. data/assets/stylesheets/colorgy/layouts/_default.scss +3 -0
  37. data/assets/stylesheets/colorgy/main.scss +3 -1
  38. data/assets/stylesheets/colorgy/structures/_jumbotron.scss +9 -0
  39. data/assets/stylesheets/vendor/animate.scss +3272 -0
  40. data/lib/colorgy_style/version.rb +1 -1
  41. data/styleguide/index.html.haml +40 -1
  42. data/styleguide/javascripts/body.js +7 -1
  43. data/styleguide/styleblocks/_alert.html.erb +3 -0
  44. data/styleguide/styleblocks/_badge.html.erb +5 -0
  45. data/styleguide/styleblocks/_breadcrumb.html.erb +5 -0
  46. data/styleguide/styleblocks/_button.html.erb +6 -6
  47. data/styleguide/styleblocks/_button_group.html.erb +41 -0
  48. data/styleguide/styleblocks/_dropdown.html.erb +65 -0
  49. data/styleguide/styleblocks/_input_group.html.erb +131 -0
  50. data/styleguide/styleblocks/_label.html.erb +7 -0
  51. data/styleguide/styleblocks/_list_group.html.erb +31 -0
  52. data/styleguide/styleblocks/_media.html.erb +60 -0
  53. data/styleguide/styleblocks/_nav.html.erb +18 -0
  54. data/styleguide/styleblocks/_navbar.html.erb +53 -0
  55. data/styleguide/styleblocks/_page_header.html.erb +3 -0
  56. data/styleguide/styleblocks/_pager.html.erb +6 -0
  57. data/styleguide/styleblocks/_pagination.html.erb +19 -0
  58. data/styleguide/styleblocks/_panel.html.erb +100 -0
  59. data/styleguide/styleblocks/_progress_bar.html.erb +12 -0
  60. data/styleguide/styleblocks/_thumbnail.html.erb +56 -0
  61. data/styleguide/styleblocks/_toast.html.erb +35 -0
  62. data/styleguide/styleblocks/_well.html.erb +1 -0
  63. data/styleguide/stylesheets/styleguide/styles.scss +14 -0
  64. metadata +53 -4
  65. data/assets/stylesheets/colorgy/components/.keep +0 -0
  66. data/assets/stylesheets/colorgy/structures/.keep +0 -0
@@ -0,0 +1,442 @@
1
+ /*
2
+ * Toastr
3
+ * Copyright 2012-2015
4
+ * Authors: John Papa, Hans Fjällemark, and Tim Ferrell.
5
+ * All Rights Reserved.
6
+ * Use, reproduction, distribution, and modification of this code is subject to the terms and
7
+ * conditions of the MIT license, available at http://www.opensource.org/licenses/mit-license.php
8
+ *
9
+ * ARIA Support: Greta Krafsig
10
+ *
11
+ * Project: https://github.com/CodeSeven/toastr
12
+ */
13
+ /* global define */
14
+ ; (function (define) {
15
+ define(['jquery'], function ($) {
16
+ return (function () {
17
+ var $container;
18
+ var listener;
19
+ var toastId = 0;
20
+ var toastType = {
21
+ error: 'error',
22
+ info: 'info',
23
+ success: 'success',
24
+ warning: 'warning'
25
+ };
26
+
27
+ var toastr = {
28
+ clear: clear,
29
+ remove: remove,
30
+ error: error,
31
+ getContainer: getContainer,
32
+ info: info,
33
+ options: {},
34
+ subscribe: subscribe,
35
+ success: success,
36
+ version: '2.1.1',
37
+ warning: warning
38
+ };
39
+
40
+ var previousToast;
41
+
42
+ return toastr;
43
+
44
+ ////////////////
45
+
46
+ function error(message, title, optionsOverride) {
47
+ return notify({
48
+ type: toastType.error,
49
+ iconClass: getOptions().iconClasses.error,
50
+ message: message,
51
+ optionsOverride: optionsOverride,
52
+ title: title
53
+ });
54
+ }
55
+
56
+ function getContainer(options, create) {
57
+ if (!options) { options = getOptions(); }
58
+ $container = $('#' + options.containerId);
59
+ if ($container.length) {
60
+ return $container;
61
+ }
62
+ if (create) {
63
+ $container = createContainer(options);
64
+ }
65
+ return $container;
66
+ }
67
+
68
+ function info(message, title, optionsOverride) {
69
+ return notify({
70
+ type: toastType.info,
71
+ iconClass: getOptions().iconClasses.info,
72
+ message: message,
73
+ optionsOverride: optionsOverride,
74
+ title: title
75
+ });
76
+ }
77
+
78
+ function subscribe(callback) {
79
+ listener = callback;
80
+ }
81
+
82
+ function success(message, title, optionsOverride) {
83
+ return notify({
84
+ type: toastType.success,
85
+ iconClass: getOptions().iconClasses.success,
86
+ message: message,
87
+ optionsOverride: optionsOverride,
88
+ title: title
89
+ });
90
+ }
91
+
92
+ function warning(message, title, optionsOverride) {
93
+ return notify({
94
+ type: toastType.warning,
95
+ iconClass: getOptions().iconClasses.warning,
96
+ message: message,
97
+ optionsOverride: optionsOverride,
98
+ title: title
99
+ });
100
+ }
101
+
102
+ function clear($toastElement, clearOptions) {
103
+ var options = getOptions();
104
+ if (!$container) { getContainer(options); }
105
+ if (!clearToast($toastElement, options, clearOptions)) {
106
+ clearContainer(options);
107
+ }
108
+ }
109
+
110
+ function remove($toastElement) {
111
+ var options = getOptions();
112
+ if (!$container) { getContainer(options); }
113
+ if ($toastElement && $(':focus', $toastElement).length === 0) {
114
+ removeToast($toastElement);
115
+ return;
116
+ }
117
+ if ($container.children().length) {
118
+ $container.remove();
119
+ }
120
+ }
121
+
122
+ // internal functions
123
+
124
+ function clearContainer (options) {
125
+ var toastsToClear = $container.children();
126
+ for (var i = toastsToClear.length - 1; i >= 0; i--) {
127
+ clearToast($(toastsToClear[i]), options);
128
+ }
129
+ }
130
+
131
+ function clearToast ($toastElement, options, clearOptions) {
132
+ var force = clearOptions && clearOptions.force ? clearOptions.force : false;
133
+ if ($toastElement && (force || $(':focus', $toastElement).length === 0)) {
134
+ $toastElement[options.hideMethod]({
135
+ duration: options.hideDuration,
136
+ easing: options.hideEasing,
137
+ complete: function () { removeToast($toastElement); }
138
+ });
139
+ return true;
140
+ }
141
+ return false;
142
+ }
143
+
144
+ function createContainer(options) {
145
+ $container = $('<div/>')
146
+ .attr('id', options.containerId)
147
+ .addClass(options.positionClass)
148
+ .attr('aria-live', 'polite')
149
+ .attr('role', 'alert');
150
+
151
+ $container.appendTo($(options.target));
152
+ return $container;
153
+ }
154
+
155
+ function getDefaults() {
156
+ return {
157
+ tapToDismiss: true,
158
+ toastClass: 'toast',
159
+ containerId: 'toast-container',
160
+ debug: false,
161
+
162
+ showMethod: 'fadeIn', //fadeIn, slideDown, and show are built into jQuery
163
+ showDuration: 300,
164
+ showEasing: 'swing', //swing and linear are built into jQuery
165
+ onShown: undefined,
166
+ hideMethod: 'fadeOut',
167
+ hideDuration: 1000,
168
+ hideEasing: 'swing',
169
+ onHidden: undefined,
170
+
171
+ extendedTimeOut: 1000,
172
+ iconClasses: {
173
+ error: 'toast-error',
174
+ info: 'toast-info',
175
+ success: 'toast-success',
176
+ warning: 'toast-warning'
177
+ },
178
+ iconClass: 'toast-info',
179
+ positionClass: 'toast-top-right',
180
+ timeOut: 5000, // Set timeOut and extendedTimeOut to 0 to make it sticky
181
+ contentClass: 'toast-content',
182
+ titleClass: 'toast-title',
183
+ messageClass: 'toast-message',
184
+ actionsClass: 'toast-actions',
185
+ target: 'body',
186
+ closeHtml: '<button type="button">&times;</button>',
187
+ newestOnTop: true,
188
+ preventDuplicates: false,
189
+ progressBar: false
190
+ };
191
+ }
192
+
193
+ function publish(args) {
194
+ if (!listener) { return; }
195
+ listener(args);
196
+ }
197
+
198
+ function notify(map) {
199
+ var options = getOptions();
200
+ var iconClass = map.iconClass || options.iconClass;
201
+
202
+ if (typeof (map.optionsOverride) !== 'undefined') {
203
+ options = $.extend(options, map.optionsOverride);
204
+ iconClass = map.optionsOverride.iconClass || iconClass;
205
+ }
206
+
207
+ if (shouldExit(options, map)) { return; }
208
+
209
+ toastId++;
210
+
211
+ $container = getContainer(options, true);
212
+
213
+ var intervalId = null;
214
+ var $toastElement = $('<div/>');
215
+ var $titleElement = $('<div/>');
216
+ var $actionsElement = $('<div/>');
217
+ var $messageElement = $('<div/>');
218
+ var $contentElement = $('<div/>');
219
+ $contentElement.addClass(options.contentClass);
220
+ var $progressElement = $('<div/>');
221
+ var $closeElement = $(options.closeHtml);
222
+ var progressBar = {
223
+ intervalId: null,
224
+ hideEta: null,
225
+ maxHideTime: null
226
+ };
227
+ var response = {
228
+ toastId: toastId,
229
+ state: 'visible',
230
+ startTime: new Date(),
231
+ options: options,
232
+ map: map
233
+ };
234
+
235
+ personalizeToast();
236
+
237
+ displayToast();
238
+
239
+ handleEvents();
240
+
241
+ publish(response);
242
+
243
+ if (options.debug && console) {
244
+ console.log(response);
245
+ }
246
+
247
+ return $toastElement;
248
+
249
+ function personalizeToast() {
250
+ setIcon();
251
+ setTitle();
252
+ setMessage();
253
+ $toastElement.append($contentElement);
254
+ setActions();
255
+ setCloseButton();
256
+ setProgressBar();
257
+ setSequence();
258
+ }
259
+
260
+ function handleEvents() {
261
+ $toastElement.hover(stickAround, delayedHideToast);
262
+ if (!options.onclick && options.tapToDismiss) {
263
+ $toastElement.click(hideToast);
264
+ }
265
+
266
+ if (options.closeButton && $closeElement) {
267
+ $closeElement.click(function (event) {
268
+ if (event.stopPropagation) {
269
+ event.stopPropagation();
270
+ } else if (event.cancelBubble !== undefined && event.cancelBubble !== true) {
271
+ event.cancelBubble = true;
272
+ }
273
+ hideToast(true);
274
+ });
275
+ }
276
+
277
+ if (options.onclick) {
278
+ $toastElement.click(function () {
279
+ options.onclick();
280
+ hideToast();
281
+ });
282
+ }
283
+ }
284
+
285
+ function displayToast() {
286
+ $toastElement.hide();
287
+
288
+ $toastElement[options.showMethod](
289
+ {duration: options.showDuration, easing: options.showEasing, complete: options.onShown}
290
+ );
291
+
292
+ if (options.timeOut > 0) {
293
+ intervalId = setTimeout(hideToast, options.timeOut);
294
+ progressBar.maxHideTime = parseFloat(options.timeOut);
295
+ progressBar.hideEta = new Date().getTime() + progressBar.maxHideTime;
296
+ if (options.progressBar) {
297
+ progressBar.intervalId = setInterval(updateProgress, 10);
298
+ }
299
+ }
300
+ }
301
+
302
+ function setIcon() {
303
+ if (map.iconClass) {
304
+ $toastElement.addClass(options.toastClass).addClass(iconClass);
305
+ }
306
+ }
307
+
308
+ function setSequence() {
309
+ if (options.newestOnTop) {
310
+ $container.prepend($toastElement);
311
+ } else {
312
+ $container.append($toastElement);
313
+ }
314
+ }
315
+
316
+ function setActions() {
317
+ if (options.actions) {
318
+ actions = options.actions;
319
+ if (typeof(actions) === 'object') {
320
+ for (var k in actions) {
321
+ var action = actions[k];
322
+ var $action = $('<a/>');
323
+ $action.html(action[0]);
324
+ $action.click(action[1]);
325
+ $actionsElement.append($action);
326
+ }
327
+ $actionsElement.addClass(options.actionsClass);
328
+ $toastElement.append($actionsElement);
329
+ } else {
330
+ $actionsElement.append(options.actions).addClass(options.actionsClass);
331
+ $toastElement.append($actionsElement);
332
+ }
333
+ }
334
+ }
335
+
336
+ function setTitle() {
337
+ if (map.title) {
338
+ $titleElement.append(map.title).addClass(options.titleClass);
339
+ $contentElement.append($titleElement);
340
+ }
341
+ }
342
+
343
+ function setMessage() {
344
+ if (map.message) {
345
+ $messageElement.append(map.message).addClass(options.messageClass);
346
+ $contentElement.append($messageElement);
347
+ }
348
+ }
349
+
350
+ function setCloseButton() {
351
+ if (options.closeButton) {
352
+ $closeElement.addClass('toast-close-button').attr('role', 'button');
353
+ $toastElement.prepend($closeElement);
354
+ }
355
+ }
356
+
357
+ function setProgressBar() {
358
+ if (options.progressBar) {
359
+ $progressElement.addClass('toast-progress');
360
+ $toastElement.prepend($progressElement);
361
+ }
362
+ }
363
+
364
+ function shouldExit(options, map) {
365
+ if (options.preventDuplicates) {
366
+ if (map.message === previousToast) {
367
+ return true;
368
+ } else {
369
+ previousToast = map.message;
370
+ }
371
+ }
372
+ return false;
373
+ }
374
+
375
+ function hideToast(override) {
376
+ if ($(':focus', $toastElement).length && !override) {
377
+ return;
378
+ }
379
+ clearTimeout(progressBar.intervalId);
380
+ return $toastElement[options.hideMethod]({
381
+ duration: options.hideDuration,
382
+ easing: options.hideEasing,
383
+ complete: function () {
384
+ removeToast($toastElement);
385
+ if (options.onHidden && response.state !== 'hidden') {
386
+ options.onHidden();
387
+ }
388
+ response.state = 'hidden';
389
+ response.endTime = new Date();
390
+ publish(response);
391
+ }
392
+ });
393
+ }
394
+
395
+ function delayedHideToast() {
396
+ if (options.timeOut > 0 || options.extendedTimeOut > 0) {
397
+ intervalId = setTimeout(hideToast, options.extendedTimeOut);
398
+ progressBar.maxHideTime = parseFloat(options.extendedTimeOut);
399
+ progressBar.hideEta = new Date().getTime() + progressBar.maxHideTime;
400
+ }
401
+ }
402
+
403
+ function stickAround() {
404
+ clearTimeout(intervalId);
405
+ progressBar.hideEta = 0;
406
+ $toastElement.stop(true, true)[options.showMethod](
407
+ {duration: options.showDuration, easing: options.showEasing}
408
+ );
409
+ }
410
+
411
+ function updateProgress() {
412
+ var percentage = ((progressBar.hideEta - (new Date().getTime())) / progressBar.maxHideTime) * 100;
413
+ $progressElement.width(percentage + '%');
414
+ }
415
+ }
416
+
417
+ function getOptions() {
418
+ return $.extend({}, getDefaults(), toastr.options);
419
+ }
420
+
421
+ function removeToast($toastElement) {
422
+ if (!$container) { $container = getContainer(); }
423
+ if ($toastElement.is(':visible')) {
424
+ return;
425
+ }
426
+ $toastElement.remove();
427
+ $toastElement = null;
428
+ if ($container.children().length === 0) {
429
+ $container.remove();
430
+ previousToast = undefined;
431
+ }
432
+ }
433
+
434
+ })();
435
+ });
436
+ }(typeof define === 'function' && define.amd ? define : function (deps, factory) {
437
+ if (typeof module !== 'undefined' && module.exports) { //Node
438
+ module.exports = factory(require('jquery'));
439
+ } else {
440
+ window['toastr'] = factory(window['jQuery']);
441
+ }
442
+ }));
@@ -0,0 +1,40 @@
1
+ // *************************************
2
+ //
3
+ // Alerts.
4
+ //
5
+ // .success - Success.
6
+ // .info - Info.
7
+ // .warning - Warning.
8
+ // .danger - Danger.
9
+ // .dismissible - Dismissible. Requires <code>components/alert.js</code> to make interactive.
10
+ //
11
+ // Styleguide Alert.
12
+ //
13
+ // *************************************
14
+
15
+ @import "bootstrap/alerts";
16
+ @import "bootstrap/close";
17
+
18
+ .alert {
19
+ @extend .alert-info;
20
+
21
+ &.success {
22
+ @extend .alert-success;
23
+ }
24
+
25
+ &.info {
26
+ @extend .alert-info;
27
+ }
28
+
29
+ &.warning {
30
+ @extend .alert-warning;
31
+ }
32
+
33
+ &.danger {
34
+ @extend .alert-danger;
35
+ }
36
+
37
+ &.dismissible {
38
+ @extend .alert-dismissible;
39
+ }
40
+ }