gumby2-rails 0.0.1

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 (72) hide show
  1. data/.gitignore +17 -0
  2. data/Gemfile +4 -0
  3. data/LICENSE.txt +22 -0
  4. data/README.md +29 -0
  5. data/Rakefile +1 -0
  6. data/gumby2-rails.gemspec +19 -0
  7. data/lib/gumby2-rails/version.rb +5 -0
  8. data/lib/gumby2-rails.rb +9 -0
  9. data/vendor/assets/.DS_Store +0 -0
  10. data/vendor/assets/fonts/icons/entypo.eot +0 -0
  11. data/vendor/assets/fonts/icons/entypo.ttf +0 -0
  12. data/vendor/assets/fonts/icons/entypo.woff +0 -0
  13. data/vendor/assets/js/libs/gumby.init.js +27 -0
  14. data/vendor/assets/js/libs/gumby.js +150 -0
  15. data/vendor/assets/js/libs/gumby.min.js +1 -0
  16. data/vendor/assets/js/libs/jquery-1.10.1.min.js +6 -0
  17. data/vendor/assets/js/libs/jquery-2.0.2.min.js +6 -0
  18. data/vendor/assets/js/libs/jquery.mobile.custom.min.js +3 -0
  19. data/vendor/assets/js/libs/modernizr-2.6.2.min.js +4 -0
  20. data/vendor/assets/js/libs/ui/gumby.checkbox.js +90 -0
  21. data/vendor/assets/js/libs/ui/gumby.fittext.js +107 -0
  22. data/vendor/assets/js/libs/ui/gumby.fixed.js +206 -0
  23. data/vendor/assets/js/libs/ui/gumby.navbar.js +115 -0
  24. data/vendor/assets/js/libs/ui/gumby.radiobtn.js +79 -0
  25. data/vendor/assets/js/libs/ui/gumby.retina.js +74 -0
  26. data/vendor/assets/js/libs/ui/gumby.skiplink.js +145 -0
  27. data/vendor/assets/js/libs/ui/gumby.tabs.js +71 -0
  28. data/vendor/assets/js/libs/ui/gumby.toggleswitch.js +203 -0
  29. data/vendor/assets/js/libs/ui/jquery.validation.js +138 -0
  30. data/vendor/assets/js/main.js +25 -0
  31. data/vendor/assets/js/plugins.js +8 -0
  32. data/vendor/assets/stylesheets/.DS_Store +0 -0
  33. data/vendor/assets/stylesheets/gumby.css +1876 -0
  34. data/vendor/assets/stylesheets/sass/_base.scss +71 -0
  35. data/vendor/assets/stylesheets/sass/_custom.scss +1 -0
  36. data/vendor/assets/stylesheets/sass/_fonts.scss +28 -0
  37. data/vendor/assets/stylesheets/sass/_grid.scss +273 -0
  38. data/vendor/assets/stylesheets/sass/_typography.scss +274 -0
  39. data/vendor/assets/stylesheets/sass/extensions/modular-scale/lib/modular-scale.rb +129 -0
  40. data/vendor/assets/stylesheets/sass/extensions/modular-scale/stylesheets/_modular-scale.scss +310 -0
  41. data/vendor/assets/stylesheets/sass/extensions/sassy-math/lib/sassy-math.rb +159 -0
  42. data/vendor/assets/stylesheets/sass/extensions/sassy-math/stylesheets/_math.scss +310 -0
  43. data/vendor/assets/stylesheets/sass/functions/_all.scss +15 -0
  44. data/vendor/assets/stylesheets/sass/functions/_breakpoints.scss +11 -0
  45. data/vendor/assets/stylesheets/sass/functions/_buttons.scss +44 -0
  46. data/vendor/assets/stylesheets/sass/functions/_clearfix.scss +25 -0
  47. data/vendor/assets/stylesheets/sass/functions/_forms.scss +18 -0
  48. data/vendor/assets/stylesheets/sass/functions/_grid-calc.scss +59 -0
  49. data/vendor/assets/stylesheets/sass/functions/_height-calc.scss +6 -0
  50. data/vendor/assets/stylesheets/sass/functions/_line-and-height.scss +7 -0
  51. data/vendor/assets/stylesheets/sass/functions/_responsivity.scss +34 -0
  52. data/vendor/assets/stylesheets/sass/functions/_semantic-grid.scss +187 -0
  53. data/vendor/assets/stylesheets/sass/functions/_strip-units.scss +5 -0
  54. data/vendor/assets/stylesheets/sass/functions/_typography.scss +15 -0
  55. data/vendor/assets/stylesheets/sass/functions/_visibility.scss +17 -0
  56. data/vendor/assets/stylesheets/sass/gumby.scss +37 -0
  57. data/vendor/assets/stylesheets/sass/ui/_all.scss +10 -0
  58. data/vendor/assets/stylesheets/sass/ui/_buttons.scss +151 -0
  59. data/vendor/assets/stylesheets/sass/ui/_forms.scss +379 -0
  60. data/vendor/assets/stylesheets/sass/ui/_icons.scss +37 -0
  61. data/vendor/assets/stylesheets/sass/ui/_images.scss +21 -0
  62. data/vendor/assets/stylesheets/sass/ui/_labels.scss +86 -0
  63. data/vendor/assets/stylesheets/sass/ui/_navbar.scss +417 -0
  64. data/vendor/assets/stylesheets/sass/ui/_tables.scss +87 -0
  65. data/vendor/assets/stylesheets/sass/ui/_tabs.scss +109 -0
  66. data/vendor/assets/stylesheets/sass/ui/_toggles.scss +69 -0
  67. data/vendor/assets/stylesheets/sass/ui/_video.scss +22 -0
  68. data/vendor/assets/stylesheets/sass/var/_lists.scss +20 -0
  69. data/vendor/assets/stylesheets/sass/var/_settings.scss +149 -0
  70. data/vendor/assets/stylesheets/sass/var/icons/_entypo-icon-list.scss +286 -0
  71. data/vendor/assets/stylesheets/sass/var/icons/_entypo.scss +294 -0
  72. metadata +116 -0
@@ -0,0 +1,203 @@
1
+ /**
2
+ * Gumby Toggles/Switches
3
+ */
4
+ !function() {
5
+
6
+ 'use strict';
7
+
8
+ // Toggle constructor
9
+ function Toggle($el) {
10
+ this.$el = $($el);
11
+ this.targets = [];
12
+ this.on = '';
13
+
14
+ if(this.$el.length) {
15
+ this.init();
16
+ }
17
+ }
18
+
19
+ // Switch constructor
20
+ function Switch($el) {
21
+ this.$el = $($el);
22
+ this.targets = [];
23
+ this.on = '';
24
+
25
+ if(this.$el.length) {
26
+ this.init();
27
+ }
28
+ }
29
+
30
+ // intialise toggles, switches will inherit method
31
+ Toggle.prototype.init = function() {
32
+ var scope = this;
33
+
34
+ // set up module based on attributes
35
+ this.setup();
36
+
37
+ // bind to specified event and trigger
38
+ this.$el.on(this.on, function(e) {
39
+ // stop propagation
40
+ e.stopImmediatePropagation();
41
+
42
+ // only disable default if <a>
43
+ if($(this).prop('tagName') === 'A') {
44
+ e.preventDefault();
45
+ }
46
+
47
+ scope.trigger(scope.triggered);
48
+
49
+ // listen for gumby.trigger to dynamically trigger toggle/switch
50
+ }).on('gumby.trigger', function() {
51
+ scope.trigger(scope.triggered);
52
+ // re-initialize module
53
+ }).on('gumby.initialize', function() {
54
+ scope.setup();
55
+ });
56
+ };
57
+
58
+ // set up module based on attributes
59
+ Toggle.prototype.setup = function() {
60
+ this.targets = this.parseTargets();
61
+ this.on = Gumby.selectAttr.apply(this.$el, ['on']) || Gumby.click;
62
+ this.className = Gumby.selectAttr.apply(this.$el, ['classname']) || 'active';
63
+ };
64
+
65
+ // parse data-for attribute, switches will inherit method
66
+ Toggle.prototype.parseTargets = function() {
67
+ var targetStr = Gumby.selectAttr.apply(this.$el, ['trigger']),
68
+ secondaryTargets = 0,
69
+ targets = [];
70
+
71
+ // no targets so return false
72
+ if(!targetStr) {
73
+ return false;
74
+ }
75
+
76
+ secondaryTargets = targetStr.indexOf('|');
77
+
78
+ // no secondary targets specified so return single target
79
+ if(secondaryTargets === -1) {
80
+ return [$(targetStr)];
81
+ }
82
+
83
+ // return array of both targets, split and return 0, 1
84
+ targets = targetStr.split('|');
85
+ return targets.length > 1 ? [$(targets[0]), $(targets[1])] : [$(targets[0])];
86
+ };
87
+
88
+ // call triggered event and pass target data
89
+ Toggle.prototype.triggered = function() {
90
+ // trigger gumby.onTrigger event and pass array of target status data
91
+ this.$el.trigger('gumby.onTrigger', [this.$el.hasClass(this.className)]);
92
+ };
93
+
94
+ // Switch object inherits from Toggle
95
+ Switch.prototype = new Toggle();
96
+
97
+ // Toggle specific trigger method
98
+ Toggle.prototype.trigger = function(cb) {
99
+ // no targets just toggle active class on toggle
100
+ if(!this.targets) {
101
+ this.$el.toggleClass(this.className);
102
+
103
+ // combine single target with toggle and toggle active class
104
+ } else if(this.targets.length == 1) {
105
+ this.$el.add(this.targets[0]).toggleClass(this.className);
106
+
107
+ // if two targets check active state of first
108
+ // always combine toggle and first target
109
+ } else if(this.targets.length > 1) {
110
+ if(this.targets[0].hasClass(this.className)) {
111
+ this.$el.add(this.targets[0]).removeClass(this.className);
112
+ this.targets[1].addClass(this.className);
113
+ } else {
114
+ this.targets[1].removeClass(this.className);
115
+ this.$el.add(this.targets[0]).addClass(this.className);
116
+ }
117
+ }
118
+
119
+ // call event handler here, applying scope of object Switch/Toggle
120
+ if(cb && typeof cb === 'function') {
121
+ cb.apply(this);
122
+ }
123
+ };
124
+
125
+ // Switch specific trigger method
126
+ Switch.prototype.trigger = function(cb) {
127
+ // no targets just add active class to switch
128
+ if(!this.targets) {
129
+ this.$el.addClass(this.className);
130
+
131
+ // combine single target with switch and add active class
132
+ } else if(this.targets.length == 1) {
133
+ this.$el.add(this.targets[0]).addClass(this.className);
134
+
135
+ // if two targets check active state of first
136
+ // always combine switch and first target
137
+ } else if(this.targets.length > 1) {
138
+ this.$el.add(this.targets[0]).addClass(this.className);
139
+ this.targets[1].removeClass(this.className);
140
+ }
141
+
142
+ // call event handler here, applying scope of object Switch/Toggle
143
+ if(cb && typeof cb === 'function') {
144
+ cb.apply(this);
145
+ }
146
+ };
147
+
148
+ // add toggle initialisation
149
+ Gumby.addInitalisation('toggles', function(all) {
150
+ $('.toggle').each(function() {
151
+ var $this = $(this);
152
+
153
+ // this element has already been initialized
154
+ // and we're only initializing new modules
155
+ if($this.data('isToggle') && !all) {
156
+ return true;
157
+
158
+ // this element has already been initialized
159
+ // and we need to reinitialize it
160
+ } else if($this.data('isToggle') && all) {
161
+ $this.trigger('gumby.initialize');
162
+ }
163
+
164
+ // mark element as initialized
165
+ $this.data('isToggle', true);
166
+ new Toggle($this);
167
+ });
168
+ });
169
+
170
+ // add switches initialisation
171
+ Gumby.addInitalisation('switches', function(all) {
172
+ $('.switch').each(function() {
173
+ var $this = $(this);
174
+
175
+ // this element has already been initialized
176
+ // and we're only initializing new modules
177
+ if($this.data('isSwitch') && !all) {
178
+ return true;
179
+
180
+ // this element has already been initialized
181
+ // and we need to reinitialize it
182
+ } else if($this.data('isSwitch') && all) {
183
+ $this.trigger('gumby.initialize');
184
+ return true;
185
+ }
186
+
187
+ // mark element as initialized
188
+ $this.data('isSwitch', true);
189
+ new Switch($this);
190
+ });
191
+ });
192
+
193
+ // register UI module
194
+ Gumby.UIModule({
195
+ module: 'toggleswitch',
196
+ events: ['trigger', 'onTrigger'],
197
+ init: function() {
198
+ // Run initialize methods
199
+ Gumby.initialize('switches');
200
+ Gumby.initialize('toggles');
201
+ }
202
+ });
203
+ }();
@@ -0,0 +1,138 @@
1
+ /**
2
+ * Gumby jQuery Validation Plugin
3
+ */
4
+ !function($) {
5
+
6
+ 'use strict';
7
+
8
+ function Validation($this, req) {
9
+
10
+ // input and holder .field
11
+ this.$this = $this;
12
+ this.$field = this.$this.parents('.field');
13
+
14
+ // supplied validation function with default length check
15
+ this.req = req || function() {
16
+ return !!this.$this.val().length;
17
+ };
18
+
19
+ // reference to this class
20
+ var scope = this;
21
+
22
+ // checkboxes and radio buttons use gumby.onChange event to validate
23
+ if(this.$this.is('[type=checkbox], [type=radio]')) {
24
+ this.$field = this.$this.parent('label');
25
+ this.$field.on('gumby.onChange', function() {
26
+ scope.validate();
27
+ });
28
+
29
+ // selects validate on change
30
+ } else if(this.$this.is('select')) {
31
+ this.$field = this.$this.parents('.picker');
32
+ this.$field.on('change', function() {
33
+ scope.validate();
34
+ });
35
+
36
+ // others (text input, textarea) use blur
37
+ } else {
38
+ this.$this.on('blur', function(e) {
39
+ // ignore tab
40
+ if(e.which !== 9) {
41
+ scope.validate();
42
+ }
43
+ });
44
+ }
45
+ }
46
+
47
+ // validate field
48
+ Validation.prototype.validate = function() {
49
+
50
+ var result = this.req(this.$this);
51
+
52
+ // failed
53
+ if(!result) {
54
+ this.$field.removeClass('success').addClass('danger');
55
+
56
+ // passed
57
+ } else {
58
+ //} else if(this.$field.hasClass('danger')) {
59
+ this.$field.removeClass('danger').addClass('success');
60
+ }
61
+
62
+ return result;
63
+ };
64
+
65
+ // jQuery plugin definition
66
+ $.fn.validation = function(options) {
67
+
68
+ var // extend params with defaults
69
+ settings = $.extend({
70
+ submit : false,
71
+ fail: false,
72
+ required : []
73
+ }, options),
74
+ // store validation objects
75
+ validations = [];
76
+
77
+ // init each form plugin is called on
78
+ return this.each(function() {
79
+
80
+ // no required fields so plugin is pointless
81
+ if(!settings.required.length) {
82
+ return false;
83
+ }
84
+
85
+ var $this = $(this),
86
+ reqLength = settings.required.length,
87
+ i;
88
+
89
+ // loop round each required field and instantiate new validation object
90
+ for(i = 0; i < reqLength; i++) {
91
+ validations.push(new Validation(
92
+ $this.find('[name="'+settings.required[i].name+'"]'),
93
+ settings.required[i].validate || false
94
+ ));
95
+ }
96
+
97
+ // hijack submit event
98
+ $this.on('submit', function(e) {
99
+
100
+ // reference to whole form pass/fail
101
+ var failed = false;
102
+
103
+ // if no passed attribute found we should halt form submit
104
+ if(!$this.data('passed')) {
105
+ e.preventDefault();
106
+
107
+ // loop round validation objects and validate each
108
+ var reqLength = validations.length, i;
109
+ for(i = 0; i < reqLength; i++) {
110
+ if(!validations[i].validate()) {
111
+ failed = true;
112
+ }
113
+ }
114
+
115
+ // passed
116
+ if(!failed) {
117
+ // if submit method present call that otherwise submit form
118
+ if(settings.submit && typeof settings.submit === 'function') {
119
+ settings.submit($this.serializeArray());
120
+ return;
121
+ }
122
+
123
+ // store passed bool and re-submit
124
+ $this.data('passed', true).submit();
125
+
126
+ // failed
127
+ } else {
128
+ // call fail method if present
129
+ if(settings.fail && typeof settings.fail === 'function') {
130
+ settings.fail();
131
+ return;
132
+ }
133
+ }
134
+ }
135
+ });
136
+ });
137
+ };
138
+ }(jQuery);
@@ -0,0 +1,25 @@
1
+ // Gumby is ready to go
2
+ Gumby.ready(function() {
3
+ console.log('Gumby is ready to go...', Gumby.debug());
4
+
5
+ // placeholder polyfil
6
+ if(Gumby.isOldie || Gumby.$dom.find('html').hasClass('ie9')) {
7
+ $('input, textarea').placeholder();
8
+ }
9
+ });
10
+
11
+ // Oldie document loaded
12
+ Gumby.oldie(function() {
13
+ console.log("This is an oldie browser...");
14
+ });
15
+
16
+ // Touch devices loaded
17
+ Gumby.touch(function() {
18
+ console.log("This is a touch enabled device...");
19
+ });
20
+
21
+ // Document ready
22
+ $(function() {
23
+
24
+ });
25
+
@@ -0,0 +1,8 @@
1
+ window.log=function(){log.history=log.history||[];log.history.push(arguments);if(this.console){arguments.callee=arguments.callee.caller;var a=[].slice.call(arguments);(typeof console.log==="object"?log.apply.call(console.log,console,a):console.log.apply(console,a))}};
2
+ (function(b){function c(){}for(var d="assert,count,debug,dir,dirxml,error,exception,group,groupCollapsed,groupEnd,info,log,timeStamp,profile,profileEnd,time,timeEnd,trace,warn".split(","),a;a=d.pop();){b[a]=b[a]||c}})((function(){try
3
+ {console.log();return window.console;}catch(err){return window.console={};}})());
4
+
5
+ /*! http://mths.be/placeholder v2.0.7 by @mathias */
6
+ ;(function(f,h,$){var a='placeholder' in h.createElement('input'),d='placeholder' in h.createElement('textarea'),i=$.fn,c=$.valHooks,k,j;if(a&&d){j=i.placeholder=function(){return this};j.input=j.textarea=true}else{j=i.placeholder=function(){var l=this;l.filter((a?'textarea':':input')+'[placeholder]').not('.placeholder').bind({'focus.placeholder':b,'blur.placeholder':e}).data('placeholder-enabled',true).trigger('blur.placeholder');return l};j.input=a;j.textarea=d;k={get:function(m){var l=$(m);return l.data('placeholder-enabled')&&l.hasClass('placeholder')?'':m.value},set:function(m,n){var l=$(m);if(!l.data('placeholder-enabled')){return m.value=n}if(n==''){m.value=n;if(m!=h.activeElement){e.call(m)}}else{if(l.hasClass('placeholder')){b.call(m,true,n)||(m.value=n)}else{m.value=n}}return l}};a||(c.input=k);d||(c.textarea=k);$(function(){$(h).delegate('form','submit.placeholder',function(){var l=$('.placeholder',this).each(b);setTimeout(function(){l.each(e)},10)})});$(f).bind('beforeunload.placeholder',function(){$('.placeholder').each(function(){this.value=''})})}function g(m){var l={},n=/^jQuery\d+$/;$.each(m.attributes,function(p,o){if(o.specified&&!n.test(o.name)){l[o.name]=o.value}});return l}function b(m,n){var l=this,o=$(l);if(l.value==o.attr('placeholder')&&o.hasClass('placeholder')){if(o.data('placeholder-password')){o=o.hide().next().show().attr('id',o.removeAttr('id').data('placeholder-id'));if(m===true){return o[0].value=n}o.focus()}else{l.value='';o.removeClass('placeholder');l==h.activeElement&&l.select()}}}function e(){var q,l=this,p=$(l),m=p,o=this.id;if(l.value==''){if(l.type=='password'){if(!p.data('placeholder-textinput')){try{q=p.clone().attr({type:'text'})}catch(n){q=$('<input>').attr($.extend(g(this),{type:'text'}))}q.removeAttr('name').data({'placeholder-password':true,'placeholder-id':o}).bind('focus.placeholder',b);p.data({'placeholder-textinput':q,'placeholder-id':o}).before(q)}p=p.removeAttr('id').hide().prev().attr('id',o).show()}p.addClass('placeholder');p[0].value=p.attr('placeholder')}else{p.removeClass('placeholder')}}}(this,document,jQuery));
7
+
8
+ // place any jQuery/helper plugins in here, instead of separate, slower script files.
Binary file