Skip to content

Instantly share code, notes, and snippets.

@illnino
Created November 5, 2012 03:12
Show Gist options
  • Save illnino/4015121 to your computer and use it in GitHub Desktop.
Save illnino/4015121 to your computer and use it in GitHub Desktop.
Rails HTML5 Boilerplate
<% flash.each do |name, msg| %>
<% if msg.is_a?(String) %>
<div class="alert alert-<%= name == :notice ? "success" : "error" %>">
<a class="close" data-dismiss="alert">&#215;</a>
<%= content_tag :div, msg, :id => "flash_#{name}" %>
</div>
<% end %>
<% end %>
<!-- http://railsapps.github.com/tutorial-rails-bootstrap-devise-cancan.html -->
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title><%= content_for?(:title) ? yield(:title) : "App_Name" %></title>
<meta name="description" content="<%= content_for?(:description) ? yield(:description) : "App_Name" %>">
<%= stylesheet_link_tag "application", :media => "all" %>
<%= javascript_include_tag "application" %>
<%= csrf_meta_tags %>
<%= yield(:head) %>
</head>
<body>
<header class="navbar navbar-fixed-top">
<nav class="navbar-inner">
<div class="container">
<%= render 'layouts/navigation' %>
</div>
</nav>
</header>
<div id="main" role="main">
<div class="container">
<div class="content">
<div class="row">
<div class="span12">
<%= render 'layouts/messages' %>
<%= yield %>
</div>
</div>
<footer>
</footer>
</div>
</div> <!--! end of .container -->
</div> <!--! end of #main -->
</body>
</html>
<%= link_to "Rails3 Bootstrap Devise Cancan", root_path, :class => 'brand' %>
<ul class="nav">
<% if user_signed_in? %>
<li>
<%= link_to 'Logout', destroy_user_session_path, :method=>'delete' %>
</li>
<% else %>
<li>
<%= link_to 'Login', new_user_session_path %>
</li>
<% end %>
<% if user_signed_in? %>
<li>a
<%= link_to 'Edit account', edit_user_registration_path %>
</li>
<% if current_user.has_role? :admin %>
<li>
<%= link_to 'Admin', users_path %>
</li>
<% end %>
<% else %>
<li>
<%= link_to 'Sign up', new_user_registration_path %>
</li>
<% end %>
</ul>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment