humdrum-rails 0.0.4 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/humdrum-rails.gemspec +1 -1
- data/lib/humdrum/version.rb +1 -1
- data/lib/rails/generators/humdrum/layout/layout_generator.rb +11 -3
- data/lib/rails/generators/humdrum/layout/templates/images/fonts/icons/entypo.eot +0 -0
- data/lib/rails/generators/humdrum/layout/templates/images/fonts/icons/entypo.ttf +0 -0
- data/lib/rails/generators/humdrum/layout/templates/images/fonts/icons/entypo.woff +0 -0
- data/lib/rails/generators/humdrum/layout/templates/javascripts/application.js +21 -0
- data/lib/rails/generators/humdrum/layout/templates/javascripts/gumby.min.js +1 -0
- data/lib/rails/generators/humdrum/layout/templates/stylesheets/application.css +5 -4
- data/lib/rails/generators/humdrum/layout/templates/stylesheets/gumby.css +383 -375
- data/lib/rails/generators/humdrum/layout/templates/stylesheets/overrides-bootstrap.css +8 -1
- data/lib/rails/generators/humdrum/layout/templates/stylesheets/overrides-gumby.css +10 -3
- data/lib/rails/generators/humdrum/layout/templates/views/gumby/layouts/admin/_footer.html.erb +1 -0
- data/lib/rails/generators/humdrum/layout/templates/views/gumby/layouts/admin.html.erb +1 -1
- data/lib/rails/generators/humdrum/layout/templates/views/gumby/layouts/common/_flash_message.html.erb +5 -6
- data/lib/rails/generators/humdrum/layout/templates/views/gumby/layouts/public/_footer.html.erb +1 -0
- data/lib/rails/generators/humdrum/layout/templates/views/gumby/layouts/public.html.erb +1 -1
- data/lib/rails/generators/humdrum/layout/templates/views/gumby/layouts/user/_footer.html.erb +1 -0
- data/lib/rails/generators/humdrum/layout/templates/views/gumby/layouts/user.html.erb +1 -1
- data/lib/rails/generators/humdrum/resource/resource_generator.rb +99 -19
- data/lib/rails/generators/humdrum/resource/templates/controllers/resource_controller.rb +8 -1
- data/lib/rails/generators/humdrum/resource/templates/javascripts/validations/validator.js +32 -0
- data/lib/rails/generators/humdrum/resource/templates/views/{resource → bootstrap/resource}/_edit.html.erb +0 -0
- data/lib/rails/generators/humdrum/resource/templates/views/{resource → bootstrap/resource}/_filters.html.erb +0 -0
- data/lib/rails/generators/humdrum/resource/templates/views/{resource → bootstrap/resource}/_form.html.erb +0 -0
- data/lib/rails/generators/humdrum/resource/templates/views/{resource → bootstrap/resource}/_index.html.erb +0 -0
- data/lib/rails/generators/humdrum/resource/templates/views/{resource → bootstrap/resource}/_item.html.erb +0 -0
- data/lib/rails/generators/humdrum/resource/templates/views/{resource → bootstrap/resource}/_nav_filters.html.erb +0 -0
- data/lib/rails/generators/humdrum/resource/templates/views/{resource → bootstrap/resource}/_new.html.erb +0 -0
- data/lib/rails/generators/humdrum/resource/templates/views/{resource → bootstrap/resource}/_show.html.erb +0 -0
- data/lib/rails/generators/humdrum/resource/templates/views/{resource → bootstrap/resource}/_summary.html.erb +0 -0
- data/lib/rails/generators/humdrum/resource/templates/views/{resource → bootstrap/resource}/create.js.erb +0 -0
- data/lib/rails/generators/humdrum/resource/templates/views/{resource → bootstrap/resource}/destroy.js.erb +0 -0
- data/lib/rails/generators/humdrum/resource/templates/views/{resource → bootstrap/resource}/edit.js.erb +0 -0
- data/lib/rails/generators/humdrum/resource/templates/views/{resource → bootstrap/resource}/index.html.erb +0 -0
- data/lib/rails/generators/humdrum/resource/templates/views/{resource → bootstrap/resource}/index.js.erb +0 -0
- data/lib/rails/generators/humdrum/resource/templates/views/{resource → bootstrap/resource}/new.js.erb +0 -0
- data/lib/rails/generators/humdrum/resource/templates/views/{resource → bootstrap/resource}/show.js.erb +0 -0
- data/lib/rails/generators/humdrum/resource/templates/views/{resource → bootstrap/resource}/update.js.erb +0 -0
- data/lib/rails/generators/humdrum/resource/templates/views/gumby/resource/_edit.html.erb +7 -0
- data/lib/rails/generators/humdrum/resource/templates/views/gumby/resource/_filters.html.erb +18 -0
- data/lib/rails/generators/humdrum/resource/templates/views/gumby/resource/_form.html.erb +71 -0
- data/lib/rails/generators/humdrum/resource/templates/views/gumby/resource/_index.html.erb +22 -0
- data/lib/rails/generators/humdrum/resource/templates/views/gumby/resource/_item.html.erb +21 -0
- data/lib/rails/generators/humdrum/resource/templates/views/gumby/resource/_nav_filters.html.erb +9 -0
- data/lib/rails/generators/humdrum/resource/templates/views/gumby/resource/_new.html.erb +9 -0
- data/lib/rails/generators/humdrum/resource/templates/views/gumby/resource/_show.html.erb +45 -0
- data/lib/rails/generators/humdrum/resource/templates/views/gumby/resource/_summary.html.erb +10 -0
- data/lib/rails/generators/humdrum/resource/templates/views/gumby/resource/create.js.erb +15 -0
- data/lib/rails/generators/humdrum/resource/templates/views/gumby/resource/destroy.js.erb +14 -0
- data/lib/rails/generators/humdrum/resource/templates/views/gumby/resource/edit.js.erb +3 -0
- data/lib/rails/generators/humdrum/resource/templates/views/gumby/resource/index.html.erb +37 -0
- data/lib/rails/generators/humdrum/resource/templates/views/gumby/resource/index.js.erb +15 -0
- data/lib/rails/generators/humdrum/resource/templates/views/gumby/resource/new.js.erb +3 -0
- data/lib/rails/generators/humdrum/resource/templates/views/gumby/resource/show.js.erb +2 -0
- data/lib/rails/generators/humdrum/resource/templates/views/gumby/resource/update.js.erb +14 -0
- data/lib/rails/generators/humdrum/setup/setup_generator.rb +45 -0
- data/lib/rails/generators/humdrum/setup/templates/config/database.example.sql +59 -0
- data/lib/rails/generators/humdrum/setup/templates/config/database.sql +59 -0
- data/lib/rails/generators/humdrum/setup/templates/gitignore +28 -0
- data/lib/rails/generators/humdrum/setup/templates/ruby-gemset +1 -0
- data/lib/rails/generators/humdrum/setup/templates/ruby-version +1 -0
- metadata +50 -21
data/humdrum-rails.gemspec
CHANGED
@@ -27,7 +27,7 @@ Gem::Specification.new do |gem|
|
|
27
27
|
gem.add_development_dependency 'rails', '~> 3.0.0'
|
28
28
|
gem.add_development_dependency 'rainbow'
|
29
29
|
gem.add_development_dependency 'rainbow'
|
30
|
-
gem.add_development_dependency 'handy-css-rails', '0.0.
|
30
|
+
gem.add_development_dependency 'handy-css-rails', '0.0.4'
|
31
31
|
|
32
32
|
|
33
33
|
end
|
data/lib/humdrum/version.rb
CHANGED
@@ -22,7 +22,7 @@ module Humdrum
|
|
22
22
|
class_option :admin_layout, :type => :boolean, :default => false, :desc => "This will create a public.html.erb which can be used for admin pages."
|
23
23
|
class_option :user_layout, :type => :boolean, :default => false, :desc => "This will create a public.html.erb which can be used for pages shown to a signed in user."
|
24
24
|
|
25
|
-
class_option :front_end_framework, :type => :string, :default => '
|
25
|
+
class_option :front_end_framework, :type => :string, :default => 'gumby', :desc => "Support Twitter Bootstrap (twitter.github.io/bootstrap/) and Gumpy (http://gumbyframework.com/). Default is bootstrap. Pass gumby for Gumby Framework"
|
26
26
|
|
27
27
|
## Parse from config file
|
28
28
|
#class_option :config_file, :type => :string, :desc => "Parse options from the config file."
|
@@ -66,8 +66,13 @@ module Humdrum
|
|
66
66
|
|
67
67
|
def generate_javascripts
|
68
68
|
if options.javascript?
|
69
|
-
|
70
|
-
copy_file "javascripts/modernizr.2.6.2.js", "app/assets/javascripts/
|
69
|
+
template "javascripts/application.js", "app/assets/javascripts/application.js"
|
70
|
+
copy_file "javascripts/modernizr.2.6.2.js", "app/assets/javascripts/modernizr.2.6.2.js"
|
71
|
+
if options.front_end_framework == "bootstrap"
|
72
|
+
copy_file "javascripts/bootstrap.js", "app/assets/javascripts/bootstrap.js"
|
73
|
+
elsif options.front_end_framework == "gumby"
|
74
|
+
copy_file "javascripts/gumby.min.js", "app/assets/javascripts/gumby.min.js"
|
75
|
+
end
|
71
76
|
end
|
72
77
|
end
|
73
78
|
|
@@ -77,7 +82,10 @@ module Humdrum
|
|
77
82
|
if options.front_end_framework == "bootstrap"
|
78
83
|
copy_file "images/glyphicons-halflings.png", "app/assets/images/glyphicons-halflings.png"
|
79
84
|
copy_file "images/glyphicons-halflings-white.png", "app/assets/images/glyphicons-halflings-white.png"
|
85
|
+
elsif options.front_end_framework == "gumby"
|
86
|
+
directory "images/fonts", "app/assets/images/fonts"
|
80
87
|
end
|
88
|
+
|
81
89
|
end
|
82
90
|
end
|
83
91
|
|
@@ -0,0 +1,21 @@
|
|
1
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
2
|
+
// listed below.
|
3
|
+
//
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
5
|
+
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
|
6
|
+
//
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
+
// the compiled file.
|
9
|
+
//
|
10
|
+
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
|
11
|
+
// GO AFTER THE REQUIRES BELOW.
|
12
|
+
//
|
13
|
+
//= require jquery
|
14
|
+
//= require jquery_ujs
|
15
|
+
<% if options.front_end_framework == "bootstrap" -%>
|
16
|
+
//= require bootstrap
|
17
|
+
<% elsif options.front_end_framework == "gumby" -%>
|
18
|
+
//= require gumby.min
|
19
|
+
<% end %>
|
20
|
+
//= require_tree ./validations
|
21
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
!function(){"use strict";function Gumby(){this.$dom=$(document);this.isOldie=!!this.$dom.find("html").hasClass("oldie");this.click="click";this.onReady=this.onOldie=this.onTouch=false;this.uiModules={};this.inits={};this.path=$("script[gumby-path]").attr("gumby-path")||"js/libs";this.breakpoint=Number($("script[gumby-breakpoint]").attr("gumby-breakpoint"))||1024}Gumby.prototype.init=function(){var scope=this;this.$dom.ready(function(){scope.initUIModules();if(scope.onReady){scope.onReady()}if(scope.isOldie&&scope.onOldie){scope.onOldie()}if(Modernizr.touch&&scope.onTouch){scope.onTouch()}})};Gumby.prototype.ready=function(code){if(code&&typeof code==="function"){this.onReady=code}};Gumby.prototype.oldie=function(code){if(code&&typeof code==="function"){this.onOldie=code}};Gumby.prototype.touch=function(code){if(code&&typeof code==="function"){this.onTouch=code}};Gumby.prototype.debug=function(){return{$dom:this.$dom,isOldie:this.isOldie,uiModules:this.uiModules,click:this.click}};Gumby.prototype.selectAttr=function(){var i=0;for(;i<arguments.length;i++){var attr=arguments[i],dataAttr="data-"+arguments[i],gumbyAttr="gumby-"+arguments[i];if(this.is("["+dataAttr+"]")){return this.attr(dataAttr)?this.attr(dataAttr):true}else if(this.is("["+gumbyAttr+"]")){return this.attr(gumbyAttr)?this.attr(gumbyAttr):true}else if(this.is("["+attr+"]")){return this.attr(attr)?this.attr(attr):true}}return false};Gumby.prototype.addInitalisation=function(ref,code){this.inits[ref]=code};Gumby.prototype.initialize=function(ref,all){if(this.inits[ref]&&typeof this.inits[ref]==="function"){this.inits[ref](all)}};Gumby.prototype.UIModule=function(data){var module=data.module;this.uiModules[module]=data};Gumby.prototype.initUIModules=function(){var x;for(x in this.uiModules){this.uiModules[x].init()}};window.Gumby=new Gumby}();!function(){"use strict";function Tabs($el){this.$el=$el;this.$nav=this.$el.find("ul.tab-nav > li");this.$content=this.$el.find(".tab-content");var scope=this;this.$nav.children("a").on(Gumby.click,function(e){e.stopImmediatePropagation();e.preventDefault();scope.click($(this))});this.$el.on("gumby.set",function(e,index){scope.set(e,index)})}Tabs.prototype.click=function($this){var index=$this.parent().index();this.$nav.add(this.$content).removeClass("active");this.$nav.eq(index).add(this.$content.eq(index)).addClass("active");this.$el.trigger("gumby.onChange",index)};Tabs.prototype.set=function(e,index){this.$nav.eq(index).find("a").trigger(Gumby.click)};Gumby.addInitalisation("tabs",function(){$(".tabs").each(function(){var $this=$(this);if($this.data("isTabs")){return true}$this.data("isTabs",true);new Tabs($this)})});Gumby.UIModule({module:"tabs",events:["onChange","set"],init:function(){Gumby.initialize("tabs")}})}();!function(){"use strict";function Checkbox($el){this.$el=$el;var scope=this;this.$el.on(Gumby.click,function(e){e.stopImmediatePropagation();e.preventDefault();if(scope.$el.hasClass("checked")){scope.update(false)}else{scope.update(true)}}).on("gumby.check",function(){scope.update(true)}).on("gumby.uncheck",function(){scope.update(false)});if(scope.$el.hasClass("checked")){scope.update(true)}}Checkbox.prototype.update=function(check){var $input=this.$el.find("input"),$span=this.$el.find("span");if(check){$span.append('<i class="icon-check" />');$input.prop("checked",true).end().addClass("checked").trigger("gumby.onCheck").trigger("gumby.onChange")}else{$input.prop("checked",false).end().find("i").remove().end().removeClass("checked").trigger("gumby.onUncheck").trigger("gumby.onChange")}};Gumby.addInitalisation("checkboxes",function(){$(".checkbox").each(function(){var $this=$(this);if($this.data("isCheckbox")){return true}$this.data("isCheckbox",true);new Checkbox($this)})});Gumby.UIModule({module:"checkbox",events:["onCheck","onUncheck","onChange","check","uncheck"],init:function(){Gumby.initialize("checkboxes")}})}();!function(){"use strict";function RadioBtn($el){this.$el=$el;var scope=this;this.$el.on(Gumby.click,function(e){e.stopImmediatePropagation();e.preventDefault();scope.update()}).on("gumby.check",function(){scope.update()});if(scope.$el.hasClass("checked")){scope.update()}}RadioBtn.prototype.update=function(){var $input=this.$el.find("input[type=radio]"),$span=this.$el.find("span"),group='input[name="'+$input.attr("name")+'"]';$(".radio").has(group).removeClass("checked").find("input").prop("checked",false).end().find("i").remove();$input.prop("checked",true);$span.append('<i class="icon-dot" />');this.$el.addClass("checked").trigger("gumby.onChange")};Gumby.addInitalisation("radiobtns",function(){$(".radio").each(function(){var $this=$(this);if($this.data("isRadioBtn")){return true}$this.data("isRadioBtn",true);new RadioBtn($this)})});Gumby.UIModule({module:"radiobtn",events:["onChange","check"],init:function(){Gumby.initialize("radiobtns")}})}();!function(){"use strict";function Retina($el){this.$el=$el;this.imageSrc=this.$el.attr("src");this.retinaSrc=this.fetchRetinaImage();this.$retinaImg=$(new Image);var scope=this;if(!this.retinaSrc){return false}this.$retinaImg.attr("src",this.retinaSrc).load(function(){scope.retinaImageLoaded()})}Retina.prototype.fetchRetinaImage=function(){var imgSrc=this.imageSrc,index=this.imageSrc.search(/(\.|\/)(gif|jpe?g|png)$/i);if(index<0){return false}return imgSrc.substr(0,index)+"@2x"+imgSrc.substr(index,imgSrc.length)};Retina.prototype.retinaImageLoaded=function(){this.$el.attr("src",this.$retinaImg.attr("src")).trigger("gumby.onRetina")};Gumby.addInitalisation("retina",function(){if(!window.devicePixelRatio||window.devicePixelRatio<=1){return}$("img[data-retina],img[gumby-retina],img[retina]").each(function(){var $this=$(this);if($this.data("isRetina")){return true}$this.data("isRetina",true);new Retina($this)})});Gumby.UIModule({module:"retina",events:["onRetina"],init:function(){Gumby.initialize("retina")}})}();!function(){"use strict";function Fixed($el){this.$el=$el;this.fixedPoint="";this.pinPoint=false;this.offset=0;this.pinOffset=0;this.top=0;this.constrainEl=true;this.state=false;this.measurements={left:0,width:0};this.setup();var scope=this;$(window).on("scroll load",function(){scope.monitorScroll()});this.$el.on("gumby.initialize",function(){scope.setup()})}Fixed.prototype.setup=function(){var scope=this;this.fixedPoint=this.parseAttrValue(Gumby.selectAttr.apply(this.$el,["fixed"]));this.pinPoint=Gumby.selectAttr.apply(this.$el,["pin"])||false;this.offset=Number(Gumby.selectAttr.apply(this.$el,["offset"]))||0;this.pinOffset=Number(Gumby.selectAttr.apply(this.$el,["pinoffset"]))||0;this.top=Number(Gumby.selectAttr.apply(this.$el,["top"]))||0;this.constrainEl=Gumby.selectAttr.apply(this.$el,["constrain"])||true;if(this.constrainEl==="false"){this.constrainEl=false}this.$parent=this.$el.parents(".columns, .column, .row");this.$parent=this.$parent.length?this.$parent.first():false;this.parentRow=this.$parent?!!this.$parent.hasClass("row"):false;if(this.pinPoint){this.pinPoint=this.parseAttrValue(this.pinPoint)}if(this.$parent&&this.constrainEl){this.measure();$(window).resize(function(){if(scope.state){scope.measure();scope.constrain()}})}};Fixed.prototype.monitorScroll=function(){var scrollAmount=$(window).scrollTop(),fixedPoint=this.fixedPoint instanceof jQuery?this.fixedPoint.offset().top:this.fixedPoint,pinPoint=false;if(this.pinPoint){pinPoint=this.pinPoint instanceof jQuery?this.pinPoint.offset().top:this.pinPoint}if(this.offset){fixedPoint-=this.offset}if(this.pinOffset){pinPoint-=this.pinOffset}if(scrollAmount>=fixedPoint&&this.state!=="fixed"){if(!pinPoint||scrollAmount<pinPoint){this.fix()}}else if(scrollAmount<fixedPoint&&this.state==="fixed"){this.unfix()}else if(pinPoint&&scrollAmount>=pinPoint&&this.state!=="pinned"){this.pin()}};Fixed.prototype.fix=function(){this.state="fixed";this.$el.css({top:0+this.top}).addClass("fixed").removeClass("unfixed pinned").trigger("gumby.onFixed");if(this.$parent){this.constrain()}};Fixed.prototype.unfix=function(){this.state="unfixed";this.$el.addClass("unfixed").removeClass("fixed pinned").trigger("gumby.onUnfixed")};Fixed.prototype.pin=function(){this.state="pinned";this.$el.css({top:this.$el.offset().top}).addClass("pinned fixed").removeClass("unfixed").trigger("gumby.onPinned")};Fixed.prototype.constrain=function(){this.$el.css({left:this.measurements.left,width:this.measurements.width})};Fixed.prototype.measure=function(){var offsets=this.$parent.offset(),parentPadding;this.measurements.left=offsets.left;this.measurements.width=this.$parent.width();if(this.parentRow){parentPadding=Number(this.$parent.css("paddingLeft").replace(/px/,""));if(parentPadding){this.measurements.left+=parentPadding}}};Fixed.prototype.parseAttrValue=function(attr){if($.isNumeric(attr)){return Number(attr)}else if(attr==="top"){return this.$el.offset().top}else{var $el=$(attr);return $el}};Gumby.addInitalisation("fixed",function(){$("[data-fixed],[gumby-fixed],[fixed]").each(function(){var $this=$(this);if($this.data("isFixed")){return true}$this.data("isFixed",true);new Fixed($this)})});Gumby.UIModule({module:"fixed",events:["onFixed","onUnfixed"],init:function(){Gumby.initialize("fixed")}})}();!function($){"use strict";function Validation($this,req){this.$this=$this;this.$field=this.$this.parents(".field");this.req=req||function(){return!!this.$this.val().length};var scope=this;if(this.$this.is("[type=checkbox], [type=radio]")){this.$field=this.$this.parent("label");this.$field.on("gumby.onChange",function(){scope.validate()})}else if(this.$this.is("select")){this.$field=this.$this.parents(".picker");this.$field.on("change",function(){scope.validate()})}else{this.$this.on("blur",function(e){if(e.which!==9){scope.validate()}})}}Validation.prototype.validate=function(){var result=this.req(this.$this);if(!result){this.$field.removeClass("success").addClass("danger")}else{this.$field.removeClass("danger").addClass("success")}return result};$.fn.validation=function(options){var settings=$.extend({submit:false,fail:false,required:[]},options),validations=[];return this.each(function(){if(!settings.required.length){return false}var $this=$(this),reqLength=settings.required.length,i;for(i=0;i<reqLength;i++){validations.push(new Validation($this.find('[name="'+settings.required[i].name+'"]'),settings.required[i].validate||false))}$this.on("submit",function(e){var failed=false;if(!$this.data("passed")){e.preventDefault();var reqLength=validations.length,i;for(i=0;i<reqLength;i++){if(!validations[i].validate()){failed=true}}if(!failed){if(settings.submit&&typeof settings.submit==="function"){settings.submit($this.serializeArray());return}$this.data("passed",true).submit()}else{if(settings.fail&&typeof settings.fail==="function"){settings.fail();return}}}})})}}(jQuery);!function(){"use strict";function SkipLink($el){this.$el=$el;this.targetPos=0;this.duration=0;this.offset=false;this.easing="";this.update=false;this.setup();var scope=this;this.$el.on(Gumby.click+" gumby.skip",function(e){e.stopImmediatePropagation();e.preventDefault();if(scope.update){scope.calculateTarget(scope.skipTo)}else{scope.skipTo()}}).on("gumby.initialize",function(){scope.setup()})}SkipLink.prototype.setup=function(){this.duration=Number(Gumby.selectAttr.apply(this.$el,["duration"]))||200;this.offset=Gumby.selectAttr.apply(this.$el,["offset"])||false;this.easing=Gumby.selectAttr.apply(this.$el,["easing"])||"swing";this.update=Gumby.selectAttr.apply(this.$el,["update"])?true:false;this.calculateTarget()};SkipLink.prototype.calculateTarget=function(cb){var scope=this,target=Gumby.selectAttr.apply(this.$el,["goto"]),$target;if(target=="top"){this.targetPos=0}else if($.isNumeric(target)){this.targetPos=Number(target)}else{$target=$(target);if(!$target){return false}this.targetPos=$target.offset().top}if(cb){cb.apply(this)}};SkipLink.prototype.skipTo=function(){var scope=this;$("html,body").animate({scrollTop:this.calculateOffset()},this.duration,this.easing).promise().done(function(){scope.$el.trigger("gumby.onComplete")})};SkipLink.prototype.calculateOffset=function(){if(!this.offset){return this.targetPos}var op=this.offset.substr(0,1),off=Number(this.offset.substr(1,this.offset.length));if(op==="-"){return this.targetPos-off}else if(op==="+"){return this.targetPos+off}};Gumby.addInitalisation("skiplinks",function(all){$(".skiplink > a, .skip").each(function(){var $this=$(this);if($this.data("isSkipLink")&&!all){return true}else if($this.data("isSkipLink")&&all){$this.trigger("gumby.initialize");return true}$this.data("isSkipLink",true);new SkipLink($this)})});Gumby.UIModule({module:"skiplink",events:["onComplete","skip"],init:function(){Gumby.initialize("skiplinks")}})}();!function(){"use strict";function Toggle($el){this.$el=$($el);this.targets=[];this.on="";if(this.$el.length){this.init()}}function Switch($el){this.$el=$($el);this.targets=[];this.on="";if(this.$el.length){this.init()}}Toggle.prototype.init=function(){var scope=this;this.setup();this.$el.on(this.on,function(e){e.stopImmediatePropagation();if($(this).prop("tagName")==="A"){e.preventDefault()}scope.trigger(scope.triggered)}).on("gumby.trigger",function(){scope.trigger(scope.triggered)}).on("gumby.initialize",function(){scope.setup()})};Toggle.prototype.setup=function(){this.targets=this.parseTargets();this.on=Gumby.selectAttr.apply(this.$el,["on"])||Gumby.click;this.className=Gumby.selectAttr.apply(this.$el,["classname"])||"active"};Toggle.prototype.parseTargets=function(){var targetStr=Gumby.selectAttr.apply(this.$el,["trigger"]),secondaryTargets=0,targets=[];if(!targetStr){return false}secondaryTargets=targetStr.indexOf("|");if(secondaryTargets===-1){return[$(targetStr)]}targets=targetStr.split("|");return targets.length>1?[$(targets[0]),$(targets[1])]:[$(targets[0])]};Toggle.prototype.triggered=function(){this.$el.trigger("gumby.onTrigger",[this.$el.hasClass(this.className)])};Switch.prototype=new Toggle;Toggle.prototype.trigger=function(cb){if(!this.targets){this.$el.toggleClass(this.className)}else if(this.targets.length==1){this.$el.add(this.targets[0]).toggleClass(this.className)}else if(this.targets.length>1){if(this.targets[0].hasClass(this.className)){this.$el.add(this.targets[0]).removeClass(this.className);this.targets[1].addClass(this.className)}else{this.targets[1].removeClass(this.className);this.$el.add(this.targets[0]).addClass(this.className)}}if(cb&&typeof cb==="function"){cb.apply(this)}};Switch.prototype.trigger=function(cb){if(!this.targets){this.$el.addClass(this.className)}else if(this.targets.length==1){this.$el.add(this.targets[0]).addClass(this.className)}else if(this.targets.length>1){this.$el.add(this.targets[0]).addClass(this.className);this.targets[1].removeClass(this.className)}if(cb&&typeof cb==="function"){cb.apply(this)}};Gumby.addInitalisation("toggles",function(all){$(".toggle").each(function(){var $this=$(this);if($this.data("isToggle")&&!all){return true}else if($this.data("isToggle")&&all){$this.trigger("gumby.initialize")}$this.data("isToggle",true);new Toggle($this)})});Gumby.addInitalisation("switches",function(all){$(".switch").each(function(){var $this=$(this);if($this.data("isSwitch")&&!all){return true}else if($this.data("isSwitch")&&all){$this.trigger("gumby.initialize");return true}$this.data("isSwitch",true);new Switch($this)})});Gumby.UIModule({module:"toggleswitch",events:["trigger","onTrigger"],init:function(){Gumby.initialize("switches");Gumby.initialize("toggles")}})}();Modernizr.load({test:Modernizr.touch,yep:Gumby.path+"/jquery.mobile.custom.min.js",callback:function(url,result,key){if($.mobile){window.Gumby.click+=" tap"}},complete:function(){window.Gumby.init();if(typeof define=="function"&&define.amd){define(window.Gumby)}}});
|
@@ -9,6 +9,11 @@
|
|
9
9
|
* compiled file, but it's generally better to create a new file per style scope.
|
10
10
|
*
|
11
11
|
*= require_self
|
12
|
+
|
13
|
+
*= require handyCSS.css
|
14
|
+
*= require handyCSS.box.css
|
15
|
+
*= require handyCSS.backdrops.css
|
16
|
+
|
12
17
|
<% if options.front_end_framework == "bootstrap" -%>
|
13
18
|
* require bootstrap-rails
|
14
19
|
*= require bootstrap
|
@@ -18,8 +23,4 @@
|
|
18
23
|
*= require gumby
|
19
24
|
*= require overrides-gumby
|
20
25
|
<% end %>
|
21
|
-
*= require handyCSS.css
|
22
|
-
*= require handyCSS.box.css
|
23
|
-
*= require handyCSS.backdrops.css
|
24
|
-
|
25
26
|
*/
|