Skip to content

Instantly share code, notes, and snippets.

@leemour
Last active December 19, 2015 16:39
Show Gist options
  • Save leemour/5985418 to your computer and use it in GitHub Desktop.
Save leemour/5985418 to your computer and use it in GitHub Desktop.
Rails 4 HTML5 Haml layout
- flash.each do |name, msg|
- if msg.is_a?(String)
%div{:class => "alert alert-#{name == :notice ? "success" : "error"}"}
%a.close{"data-dismiss" => "alert"} ×
= content_tag :div, msg, :id => "flash_#{name}"
%nav.navbar
.navbar-inner
.container
%a.btn.btn-navbar{'data-target' => ".nav-collapse", 'data-toggle' => "collapse", :type => "button"}
- 3.times do
%span.icon-bar
.nav-collapse.collapse
%ul.nav
%li
= link_to 'Главная', root_path, class: 'brand'
%li
=link_to 'Страницы', pages_path
.well.sidebar-nav.sidebar-nav-fixed
%ul.nav.nav-list
%li.nav-header Это сайдбар
%li.active
%a{:href => "#"} Link
%li
%a{:href => "#"} Link
%li
%a{:href => "#"} Link
%li
%a{:href => "#"} Link
%li.nav-header Ссылочки
%li
%a{:href => "#"} Link
%li
%a{:href => "#"} Link
%li
%a{:href => "#"} Link
%li
%a{:href => "#"} Link
%li
%a{:href => "#"} Link
%li
%a{:href => "#"} Link
%li.nav-header Ссылочки
%li
%a{:href => "#"} Link
%li
%a{:href => "#"} Link
%li
%a{:href => "#"} Link
!!! 5
%html{:lang => 'ru'}
%head
%meta{:charset => 'utf-8'}
%meta{:name => :viewport, :content => 'width=device-width,initial-scale=1'}
%meta{ name: 'description', content: (defined? @page.description ? @page.description : '') }/
%meta{ name: 'keywords', content: (defined? @page.keywords ? @page.keywords : '') }/
%title= full_title(defined? @page.title ? @page.title : '')
= favicon_link_tag 'favicon.ico'
= stylesheet_link_tag "application", :media => "all"
= javascript_include_tag "application", "data-turbolinks-track" => true
= csrf_meta_tags
= yield(:head)
/[if lt IE 9]
%script{ :src => '//html5shiv.googlecode.com/svn/trunk/html5.js' }
%body{:class => "#{controller_name} #{action_name}"}
%header
.conatiner-fluid
.row-fluid
= render 'layouts/navigation'
%main#content{:role => "main"}
.conatiner-fluid
.row-fluid
.span12
= render 'layouts/messages'
.row-fluid
%div.main.span8
= yield
%aside.secondary.span4#sidebar
= render 'layouts/sidebar'
%footer
.container-fluid
.row-fuild
= render 'layouts/footer'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment