BikeBikeBike/app/views/layouts/application.html.haml

82 lines
3.1 KiB
Plaintext
Raw Normal View History

2013-04-19 19:51:23 +02:00
!!!
%html{ lang: I18n.locale.to_s }
2013-10-27 19:07:56 -06:00
%head
%meta{ charset: 'utf-8' }
%meta{ name: 'viewport', content: 'width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0' }
2015-04-14 19:41:46 -07:00
%title= (yield :title) + (content_for?(:title) ? (_!' | ') : '') + (_!'Bike!Bike!')
2015-03-17 20:29:17 -07:00
%meta{ name: 'description', content: (yield_or_default :description, I18n.t('page_descriptions.home')) }
2013-10-27 19:07:56 -06:00
= csrf_meta_tags
2014-12-18 21:29:53 -08:00
= inject_css!
- (@stylesheets || []).each do |css|
= inject_css! css
%link{ href: asset_path('favicon.ico'), rel: 'shortcut icon', type: 'image/x-icon' }
%link{ href: asset_path('favicon.ico'), rel: 'icon', type: 'image/x-icon' }
2013-10-27 19:07:56 -06:00
%link{ href: asset_path('apple-touch-icon.png'), rel: 'apple-touch-icon' }
%link{ href: asset_path('apple-touch-icon-72x72.png'), rel: 'apple-touch-icon', sizes: '72x72' }
%link{ href: asset_path('apple-touch-icon-114x114.png'), rel: 'apple-touch-icon', sizes: '114x114' }
%link{ href: asset_path('apple-touch-icon-144x144.png'), rel: 'apple-touch-icon', sizes: '144x144' }
2014-07-18 20:35:15 -06:00
= yield :head
2013-04-19 19:51:23 +02:00
%body{ class: page_style }
2015-03-17 20:29:17 -07:00
= render 'shared/navbar'
%main#main
2014-04-05 19:16:15 -07:00
- flash.each do |key, msg|
= content_tag :div, msg, :id => key
2015-03-17 20:29:17 -07:00
%header#banner
= yield :banner
2015-08-18 22:18:29 -07:00
- if @submenu
=row do
= columns(medium: 12) do
%nav.sub-menu
- @submenu.each do |href,key|
%a{href: href, class: request.fullpath.start_with?(href) ? 'current' : nil}=_"menu.submenu.#{key}"
2014-07-12 20:19:48 -06:00
- if content_for?(:side_bar)
%aside#side-bar
= yield :side_bar
2014-07-06 19:02:23 -06:00
- if has_content?
#content=yield
- else
= yield
2014-07-18 20:35:15 -06:00
= yield :garbage
2013-10-27 19:07:56 -06:00
#footer
%footer= render 'shared/footer'
2014-07-18 20:35:15 -06:00
- if content_for?(:footer_scripts)
= yield :footer_scripts
2015-08-04 21:54:04 -07:00
-# if content_for?(:scripts) || content_for?(:dom_ready)
-# #{content_for?(:scripts) ? "#{yield :scripts}" : ''}#{content_for?(:dom_ready) ? "$(function(){#{yield :dom_ready}});" : ''}
:javascript
(function() {
if (!String.prototype.trim) {
(function() {
var rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
String.prototype.trim = function() {
return this.replace(rtrim, '');
};
})();
}
function classExists(elem,className){var p = new RegExp('(^| )'+className+'( |$)');return (elem.className && elem.className.match(p));}
function addClass(elem,className){if(classExists(elem,className)){return true;}elem.className += ' '+className;}
function removeClass(elem,className){var c = elem.className;var p = new RegExp('(^| )'+className+'( |$)');c = c.replace(p,' ').replace(/ /g,' ');elem.className = c.trim();}
[].slice.call(document.querySelectorAll('.input-field input')).forEach(function(inputEl) {
if (inputEl.value.trim() === '') {
inputEl.parentNode.className = inputEl.parentNode.className + ' empty';
}
inputEl.addEventListener('focus', onInputFocus);
inputEl.addEventListener('blur', onInputBlur);
});
function onInputFocus(ev) {
removeClass(ev.target.parentNode, 'empty')
}
function onInputBlur(ev) {
if (ev.target.value.trim() === '') {
addClass(ev.target.parentNode, 'empty');
}
}
})();