ratchet_design 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5d2320e24c510e2e6703b715afa95bcd04b706e7
4
- data.tar.gz: 1fba8086569909bace533d6c966f620d69e95dfa
3
+ metadata.gz: 9854474d864b29d5388bc282aecad7fc7a3f8760
4
+ data.tar.gz: 3b1eb0f65c9eefa2d94cca6781911eead681e4fd
5
5
  SHA512:
6
- metadata.gz: 4699c0e4c66e216bb29999e88259871a35f65d4014d998486d5a45de9f1172c934b15887e04a912c7b82226c3fd1a572450017e85da617a50dc6e046cb5c8186
7
- data.tar.gz: ad613599b9c83604a992d12cb1ac09ca154a46c9b78a20673b9f28c80704dc8cbfa25f01ce563d569bdd9935b177378cd3cb82f8bbe11ee6fa40cd1ea94924c7
6
+ metadata.gz: 4948c22ed7802902649afd43073d4f68f343218ef55d9a8aeab7164a7ee8ccbee6b4aec7a00996c338b7547cc2d9179a625676eb4d1fc9e9d37ac4f361f149f3
7
+ data.tar.gz: 518a7a7bc903d003065d93d83488924c3631a449752771afe684bc464b5938e59260f14987b921a14917c254549217fbf72cc39a06abd9c3f9e73476f43dea5c
@@ -21,6 +21,11 @@ module Ratchet
21
21
  content_for :blank, &block
22
22
  end
23
23
 
24
+ # Blank slate layout
25
+ def footer(&block)
26
+ content_for :footer, &block
27
+ end
28
+
24
29
  # Set custom page title
25
30
  def title(title = nil)
26
31
  title ? content_for(:title) { title + " | " + Site.name } : content_for(:title).presence
@@ -42,9 +47,25 @@ module Ratchet
42
47
  end
43
48
 
44
49
  # Consolidated page class output
45
- def page_classes
46
- request.path_parameters[:page].split("/").last + (selector ? " #{selector}" : "")
50
+ def page_class( classnames = nil )
51
+ if ( classnames )
52
+ @page_classes ||= ''
53
+ @page_classes = @page_classes + ' ' + classnames
54
+ @page_classes.strip!
55
+ else
56
+ @page_classes || ''
57
+ end
47
58
  end
48
59
 
60
+ # Consolidated page class output
61
+ def main_class( classnames = nil )
62
+ if ( classnames )
63
+ @main_classes ||= ''
64
+ @main_classes = @main_classes + ' ' + classnames
65
+ @main_classes.strip!
66
+ else
67
+ @main_classes || ''
68
+ end
69
+ end
49
70
  end
50
71
  end
@@ -41,7 +41,7 @@ html
41
41
  / Head
42
42
  = yield :head
43
43
 
44
- body class="#{page_classes}"
44
+ body class=page_class
45
45
 
46
46
  / Icon inclusion
47
47
  = render "shared/ratchet/icons"
@@ -56,7 +56,7 @@ html
56
56
  = render "shared/ratchet/header"
57
57
 
58
58
  / Document main
59
- main role="main"= yield
59
+ main class=main_class role="main"= yield
60
60
 
61
61
  / Document footer
62
62
  = render "shared/ratchet/footer"
@@ -1,2 +1,3 @@
1
- footer role="contentinfo"
2
- p © #{Time.now.year} #{Site.name}
1
+ - if content_for?(:footer)
2
+ footer role="contentinfo"
3
+ = yield :footer
@@ -1,3 +1,3 @@
1
1
  module RatchetDesign
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
@@ -97,9 +97,9 @@ var debounce=require("./debounce"),throttle=function(e,t,a){return"object"==type
97
97
  },{"./debounce":36}],47:[function(require,module,exports){
98
98
  var validation=require("./lib/validation"),progressive=require("./lib/progressive");module.exports={validate:validation.validate,next:progressive.next};
99
99
  },{"./lib/progressive":48,"./lib/validation":49}],48:[function(require,module,exports){
100
- function reset(){formCallbacks={next:[]},registerdForms=[]}function newForm(e){function t(){return l[s]}function o(){return l[s+1]}function n(){return t()&&!t().disabled}function r(e){return n()?c(function(){r(e)}):void(o()&&(s+=1,e?Event.delay(a,e):a()))}function i(e){e?Event.delay(a,e):a()}function c(e){t().classList.remove("step-visited","arrived"),t().classList.add("departed"),Event.afterAnimation(t(),function(){f(),"function"==typeof e&&e()})}function a(){t().disabled=!1,t().classList.add("arrived");var e=t().querySelector("input:not([hidden])");e&&e.focus()}function f(){t().disabled=!0,t().classList.add("step-visited"),t().classList.remove("departed","arrived")}if(e){var l=toolbox.slice(e.querySelectorAll(".form-step")),s=-1;0!=l.length&&(l.forEach(function(e){e.disabled=!0}),r(),registerdForms.push(function(n){if(e==n.target&&!t().querySelector(":invalid")){o()&&n.preventDefault();var a=getCallbacks(e);a?(n.preventDefault(),c(function(){a(n,{fieldset:t(),form:e,forward:r,back:i,complete:!!o(),formData:toolbox.formData(t())})})):r()}}))}}function fire(e){registerdForms.forEach(function(t){t(e)})}function getCallbacks(e,t){t=t||"next";var o,n=[];return formCallbacks[t].forEach(function(t){(o=t(e))&&n.push(o)}),!!n.length&&function(){var e=toolbox.slice(arguments);n.forEach(function(t){t.apply(t,e)})}}function next(e,t){on(e,"next",t)}function on(e,t,o){if("object"==typeof t)for(type in t)on(e,type,t[type]);else if(formCallbacks[t]){var n=function(t){if(t==e)return o};formCallbacks[t].push(n)}}var toolbox=require("compose-toolbox"),Event=toolbox.event,Callback=toolbox.event.callback,formSelector="form.progressive",watching=!1,formCallbacks,registerdForms;Event.ready(function(){reset(),Event.bubbleFormEvents(),Event.on(document,"submit",formSelector,fire),Event.change(function(){reset(),toolbox.each(document.querySelectorAll(formSelector),function(e){newForm(e)})})}),module.exports={next:next,new:newForm};
100
+ function reset(){formCallbacks={next:[]},registerdForms=[]}function newForm(e){function t(){return f[s]}function o(){return f[s+1]}function n(){return t()&&!t().disabled}function r(e){return n()?a(function(){r(e)}):void(o()&&(s+=1,e?Event.delay(c,e):c()))}function i(e){e?Event.delay(c,e):c(),Event.afterAnimation(t(),function(){Event.fire(toolbox.getClosest(t(),"form"),"validate")})}function a(e){t().classList.remove("step-visited","arrived"),t().classList.add("departed"),Event.afterAnimation(t(),function(){l(),"function"==typeof e&&e()})}function c(){t().disabled=!1,t().classList.add("arrived");var e=t().querySelector("input:not([hidden])");e&&e.focus()}function l(){t().disabled=!0,t().classList.add("step-visited"),t().classList.remove("departed","arrived")}if(e){var f=toolbox.slice(e.querySelectorAll(".form-step")),s=-1;0!=f.length&&(f.forEach(function(e){e.disabled=!0}),r(),registerdForms.push(function(n){var c="FORM"==n.target.tagName?n.target:toolbox.getClosest(n.target,"form");if(e==c&&!t().querySelector(":invalid")){o()&&n.preventDefault();var l=getCallbacks(e);l?(n.preventDefault(),a(function(){l(n,{fieldset:t(),form:e,forward:r,back:i,complete:!!o(),formData:toolbox.formData(t())})})):r()}}))}}function fire(e){registerdForms.forEach(function(t){t(e)})}function getCallbacks(e,t){t=t||"next";var o,n=[];return formCallbacks[t].forEach(function(t){(o=t(e))&&n.push(o)}),!!n.length&&function(){var e=toolbox.slice(arguments);n.forEach(function(t){t.apply(t,e)})}}function next(e,t){on(e,"next",t)}function on(e,t,o){if("object"==typeof t)for(type in t)on(e,type,t[type]);else if(formCallbacks[t]){var n=function(t){if(t==e)return o};formCallbacks[t].push(n)}}var toolbox=require("compose-toolbox"),Event=toolbox.event,Callback=toolbox.event.callback,formSelector="form.progressive",watching=!1,formCallbacks,registerdForms;Event.ready(function(){reset(),Event.bubbleFormEvents(),Event.on(document,"click",formSelector+" [type=submit]",fire),Event.change(function(){reset(),toolbox.each(document.querySelectorAll(formSelector),function(e){newForm(e)})})}),module.exports={next:next,new:newForm};
101
101
  },{"compose-toolbox":51}],49:[function(require,module,exports){
102
- function supported(){return"function"==typeof document.createElement("input").checkValidity}function validateForm(e){var t=e.querySelector("input:invalid, textarea:invalid, select:invalid");return!t||(checkInput(t),showMessage(t),focus(t),!1)}function checkInput(e,t){var a=statusEl(e),n=isValid(e),i=!n&&"input"==t;i&&e==document.activeElement?a.classList.remove("invalid","valid"):(a.classList.toggle("invalid",!n),a.classList.toggle("valid",n))}function isValid(e){e.value.replace(/\s/g,"").length||(e.value="");var t=checkCount(e,"min")||checkCount(e,"max")||checkValue(e)||"";return e.setCustomValidity(t),e.checkValidity()}function checkValue(e){var t=e.dataset.invalidValue;if(t&&e.value.match(new RegExp("^"+t+"$","i")))return e.dataset.invalidValueMessage||"Cannot equal '"+t+"'"}function checkCount(e,t){var a=e.dataset[t+"Words"];if(a){var n=wordCount(e.value)<a;if(phrasing="min"==t?"at least ":"no more than ",valid="min"==t?!n:n,e.value&&!valid)return"Please write "+phrasing+a+" words."}}function statusEl(e){return getClosest(e,"label")||e}function focus(e){e="none"!==e.style.display?e:e.nextSibling,e.focus()}function submit(e){validateForm(e.target)||(checkValidation.stop(),Event.delay(checkValidation.start,500),e.preventDefault())}function hideMessage(e){var t=getClosest(e,"form"),a=t.querySelector(".validation-message");a&&a.parentNode.removeChild(a)}function showMessage(e){hideMessage(e);var t=getClosest(e,"label"),a=e.dataset.message||e.validationMessage;t&&t.insertAdjacentHTML("beforeend",'<aside class="validation-message"><p>'+a+"</p></aside>")}var toolbox=require("compose-toolbox"),Event=toolbox.event,matches=toolbox.matches,getClosest=toolbox.getClosest,wordCount=toolbox.wordCount,textSelectors="[required]";Event.ready(function(){supported()&&(Event.bubbleFormEvents(),document.addEventListener("invalid",function(e){e.preventDefault()},!0),Event.on(document.body,"submit",submit),Event.on(document,"blur","[required]",checkValidation),Event.on(document,"input","[required]",Event.debounce(checkValidation,200)))});var checkValidation=Event.callback.new(function(e){hideMessage(e.target),checkInput(e.target,e.type)});module.exports={validate:validateForm};
102
+ function supported(){return"function"==typeof document.createElement("input").checkValidity}function validateForm(e){var t,a=e.querySelectorAll("[required]");return toolbox.slice(a).some(function(e){if(!checkInput(e))return t=e,!0}),!t||(focus(t),showMessage(t),!1)}function checkInput(e,t){var a=statusEl(e),n=isValid(e),o="keydown"==t&&!n;return o&&e==document.activeElement?a.classList.remove("invalid","valid"):(a.classList.toggle("invalid",!n),a.classList.toggle("valid",n)),n}function isValid(e){e.value.replace(/\s/g,"").length||(e.value="");var t=checkValue(e)||checkLength(e)||"";e.setCustomValidity(t);var a=e.checkValidity();return a}function checkValue(e){if(e.dataset.invalidValue){var t=new RegExp("^"+e.dataset.invalidValue+"$","i");if(e.value.match(t))return e.dataset.cachedMessage=e.dataset.message,e.dataset.message="",e.dataset.invalidValueMessage||"Value '"+e.value+"' is not permitted";e.dataset.cachedMessage&&(e.dataset.message=e.dataset.cachedMessage,e.dataset.cachedMessage="")}}function checkLength(e){return checkCount(e,"min")||checkCount(e,"max")}function checkCount(e,t){var a=e.dataset[t+"Words"];if(a){var n=wordCount(e.value)<a;if(phrasing="min"==t?"at least ":"no more than ",valid="min"==t?!n:n,e.value&&!valid)return"Please write "+phrasing+a+" words."}}function statusEl(e){return getClosest(e,"label")||e}function focus(e){e="none"!==e.style.display?e:e.nextSibling,e.focus()}function submit(e){var t="FORM"==e.target.tagName?e.target:getClosest(e.target,"form");validateForm(t)||(checkValidation.stop(),Event.delay(checkValidation.start,500),e.preventDefault(),e.stopImmediatePropagation())}function hideMessage(e){var t=getClosest(e,"form"),a=t.querySelector(".validation-message");a&&a.parentNode.removeChild(a)}function showMessage(e){hideMessage(e);var t=getClosest(e,"label"),a=e.dataset.message||e.validationMessage;t&&t.insertAdjacentHTML("beforeend",'<aside class="validation-message"><p>'+a+"</p></aside>")}var toolbox=require("compose-toolbox"),Event=toolbox.event,matches=toolbox.matches,getClosest=toolbox.getClosest,wordCount=toolbox.wordCount,textSelectors="[required]",invalidHandler=Event.callback.new(function(e){e.preventDefault(),e.stopPropagation()});Event.ready(function(){supported()&&(Event.bubbleFormEvents(),document.addEventListener("invalid",invalidHandler,!0),Event.on(document.body,"click","[type=submit]",submit),Event.on(document,"validate","form",function(e){validateForm(e.target)}),Event.on(document,"blur","[required]",checkValidation),Event.on(document,"keydown","[required]",Event.debounce(checkValidation,200)),Event.on(document,"input","select[required]",Event.debounce(checkValidation,200)))});var checkValidation=Event.callback.new(function(e){checkInput(e.target,e.type)&&hideMessage(e.target)});module.exports={validate:validateForm};
103
103
  },{"compose-toolbox":51}],50:[function(require,module,exports){
104
104
  var classify=function(e){return"."+e.replace(/\s/g,".")},Loader={options:{className:"loader"},init:function(){return Loader.element()||document.body.insertAdjacentHTML("afterbegin",'<div class="'+Loader.options.className+'"></div>'),Loader.element()},element:function(){return document.querySelector(classify(Loader.options.className))},loading:function(e){Loader.show(e||"Hang tight…","loading")},success:function(e){Loader.show(e||"Got it!","success")},failure:function(e){Loader.show(e||"Hold up!","failure")},show:function(e,o){el=Loader.init(),el.textContent=e,el.className=Loader.options.className,el.classList.add(o)},remove:function(){var e=Loader.element();e.parentNode.removeChild(e)}};module.exports=Loader;
105
105
  },{}],51:[function(require,module,exports){
@@ -130,4 +130,4 @@ function request(e,n,t){return"function"==typeof t?new e("GET",n).end(t):2==argu
130
130
  });
131
131
 
132
132
 
133
- //# sourceMappingURL=/assets/ratchet/core-0.1.4.map.json
133
+ //# sourceMappingURL=/assets/ratchet/core-0.1.5.map.json