Skip to content

Instantly share code, notes, and snippets.

@simi
Created February 7, 2012 14:32
Show Gist options
  • Save simi/1759949 to your computer and use it in GitHub Desktop.
Save simi/1759949 to your computer and use it in GitHub Desktop.
Refinery + Twitter Bootstrap WIP
<head>
<meta charset='<%= Rails.application.config.encoding %>' />
<!--[if IE]><meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /><![endif]-->
<title><%= browser_title(yield(:title)) %></title>
<%= raw(%(<meta name="description" content="#{@meta.meta_description}" />)) if @meta.meta_description.present? -%>
<%= raw(%(<meta name="keywords" content="#{@meta.meta_keywords}">)) if @meta.meta_keywords.present? -%>
<%= raw(%(<link rel="canonical" content="#{@canonical}" />)) if @canonical.present? -%>
<%= csrf_meta_tags if Refinery::Core.authenticity_token_on_frontend -%>
<%= yield :meta %>
<%= stylesheet_link_tag "application" %>
<%= yield :stylesheets %>
<%= render :partial => '/refinery/google_analytics' %>
<%= javascript_include_tag 'modernizr-min' %>
</head>
<%= render(:partial => "/refinery/menu", :locals => {
:dom_id => 'menu',
:css => 'menu'
}) %>
<%
# Collect the root items.
# ::Refinery::Menu is smart enough to remember all of the items in the original collection.
if (roots = local_assigns[:roots] || (collection ||= @menu_pages).roots).present?
dom_id ||= 'menu'
css = [(css || 'menu'), 'clearfix'].flatten.join(' ')
hide_children = Refinery::Core.menu_hide_children if hide_children.nil?
-%>
<div class="navbar">
<div class="navbar-inner">
<div class="container">
<%= link_to Refinery::Core.site_name, refinery.root_path, :class => 'brand' %>
<nav id='<%= dom_id %>' class='<%= css %> nav'>
<ul class="nav">
<%= render :partial => '/refinery/menu_branch', :collection => roots,
:locals => {
:hide_children => hide_children,
:sibling_count => (roots.length - 1),
:menu_levels => local_assigns[:menu_levels],
:apply_css => true #if you don't care about class='first' class='last' or class='selected' set apply_css to false for speed.
} -%>
</ul>
</nav>
</div>
</div>
</div>
<% end -%>
<%
if !!local_assigns[:apply_css] and (classes = custom_menu_branch_css(local_assigns)).any?
css = "class='#{classes.join(' ')}'".html_safe
end
-%>
<li<%= ['', css].compact.join(' ').gsub(/\ *$/, '').html_safe %>>
<%= link_to(menu_branch.title, refinery.url_for(menu_branch.url)) -%>
<% if ( (children = menu_branch.children unless hide_children).present? &&
(!local_assigns[:menu_levels] || menu_branch.ancestors.length < local_assigns[:menu_levels]) ) -%>
<ul class='clearfix'>
<%= render :partial => '/refinery/menu_branch', :collection => children,
:locals => {
:apply_css => local_assigns[:apply_css],
:hide_children => !!hide_children,
:menu_levels => local_assigns[:menu_levels]
} -%>
</ul>
<% end -%>
</li>
module ApplicationHelper
def custom_menu_branch_css(local_assigns)
options = local_assigns.dup
options.update(:sibling_count => options[:menu_branch].shown_siblings.length) unless options[:sibling_count]
css = []
css << 'active' if selected_page_or_descendant_page_selected?(local_assigns[:menu_branch])
css
end
end
source 'https://rubygems.org'
gem 'rails', '3.2.1'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer'
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'
# To use Jbuilder templates for JSON
# gem 'jbuilder'
# Use unicorn as the web server
# gem 'unicorn'
# Deploy with Capistrano
# gem 'capistrano'
# To use debugger
gem 'ruby-debug19', :require => 'ruby-debug'
gem 'therubyracer'
gem 'refinerycms', :git => 'git://github.com/resolve/refinerycms.git'
# group :development, :test do
# gem 'refinerycms-testing', '~> 2.0'
# end
# USER DEFINED
gem 'twitter-bootstrap-rails'
# Add i18n support (optional, you can remove this if you really want to but it is advised to keep it).
gem 'refinerycms-i18n', '~> 2.0.0', :git => 'git://github.com/parndt/refinerycms-i18n.git'
# Specify additional Refinery CMS Engines here (all optional):
# gem 'refinerycms-blog', :git => 'git://github.com/resolve/refinerycms-blog.git', :branch => 'rails-3-1'
# gem 'refinerycms-inquiries', :git => 'git://github.com/resolve/refinerycms-inquiries.git', :branch => 'rails-3-1'
# gem 'refinerycms-search', :git => 'git://github.com/resolve/refinerycms-search.git', :branch => 'rails-3-1'
# gem 'refinerycms-page-images', :git => 'git://github.com/resolve/refinerycms-page-images.git', :branch => 'rails-3-1'
# END USER DEFINED
<!DOCTYPE html>
<%= render :partial => '/refinery/html_tag' %>
<% site_bar = render(:partial => '/refinery/site_bar', :locals => {:head => true}) -%>
<%= render :partial => '/refinery/head' %>
<body>
<%= site_bar -%>
<header id="header">
<%= render :partial => '/refinery/header' -%>
</header>
<div class="container">
<div class="content">
<div class="row">
<div class="span11">
<%= yield %>
</div>
<div class="span1">&nbsp;</div>
<div class="span4">
<h3>Sidebar</h3>
<ul>
<li><%= link_to "Link1", "/path1" %></li>
<li><%= link_to "Link2", "/path2" %></li>
<li><%= link_to "Link3", "/path3" %></li>
</ul>
</div>
</div>
<footer>
<%= render :partial => '/refinery/footer' -%>
</footer>
</div>
</div>
<%= render :partial => '/refinery/javascripts' %>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment