Skip to content

Commit

Permalink
overriding menu and header views for bootstrap
Browse files Browse the repository at this point in the history
  • Loading branch information
demental committed Mar 29, 2012
1 parent 408a6f1 commit e693ff2
Show file tree
Hide file tree
Showing 7 changed files with 171 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ group :development, :test do
end
group :production do
gem 'pg'
gem 'tlsmail'
end

# Gems used only for assets and not required
Expand All @@ -27,7 +28,7 @@ end
gem 'jquery-rails'
gem 'twitter-bootstrap-rails'

gem 'tlsmail'


# For use with S3 storage
gem 'fog'
Expand Down
16 changes: 16 additions & 0 deletions app/views/refinery/_header.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<div class="navbar">
<div class="navbar-inner">
<div class="container">
<a class="btn btn-navbar" data-target=".nav-collapse" data-toggle="collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<%= link_to Refinery::Core.site_name, refinery.root_path, :class => 'brand' %>
<%= render(:partial => "/refinery/menu", :locals => {
:dom_id => 'menu',
:css => 'menu'
}) %>
</div>
</div>
</div>
20 changes: 20 additions & 0 deletions app/views/refinery/_menu.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<%
# 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 ||= refinery_menu_pages).roots).present?
dom_id ||= 'menu'
css = [(css || 'menu clearfix')].flatten.join(' ')
hide_children = Refinery::Core.menu_hide_children if hide_children.nil?
-%>
<nav id='<%= dom_id %>' class="container nav-collapse">
<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>
<% end -%>
19 changes: 19 additions & 0 deletions app/views/refinery/_menu_branch.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<%
if !!local_assigns[:apply_css] and (classes = 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>
17 changes: 17 additions & 0 deletions app/views/refinery/admin/_menu.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<nav id="menu">
<% ::Refinery::Plugins.active.in_menu.each do |plugin| -%>
<%= link_to plugin.title, refinery.url_for(plugin.url),
:class => ("active" if plugin.highlighted?(params)),
:id => "plugin_#{plugin.name}" %>
<% end -%>
<% if ::Refinery::Plugins.active.in_menu.many? -%>
<%= link_to refinery_icon_tag('arrow_switch.png'), "",
:id => "menu_reorder",
:title => t('.reorder_menu') %>
<%= link_to refinery_icon_tag('tick.png'), "",
:id => "menu_reorder_done",
:title => t('.reorder_menu_done'),
:style => "display: none;" %>
<% end %>
</nav>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<%# Add items here to have them appear on your dashboard's right hand side menu %>
96 changes: 96 additions & 0 deletions app/views/refinery/blog/admin/_submenu.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
<nav id='actions' class='multilist'>
<ul class='search_list'>
<li class='not_a_link'>
<%= render :partial => "/refinery/admin/search",
:locals => {
:url => refinery.blog_admin_posts_path
} %>
</li>
</ul>

<ul class='collapsible_menu'>
<li class='not_a_link'>
<%= link_to t('.posts.title'), '#',
:class => 'page_copy_icon' %>
</li>
<li>
<%= link_to t('.posts.manage'), refinery.blog_admin_posts_path,
:class => 'page_icon' %>
</li>
<li>
<%= link_to t('.posts.uncategorized'), refinery.uncategorized_blog_admin_posts_path,
:class => 'page_icon' %>
</li>
<li>
<%= link_to t('.posts.new'), refinery.new_blog_admin_post_path,
:class => 'page_add_icon' %>
</li>
</ul>
<% if Refinery::Blog::Post.comments_allowed? %>
<ul class='collapsible_menu'>
<li class='not_a_link'>
<% if Refinery::Blog::Comment.unmoderated.any? %>
<% title = t('.comments.title_with_count', :new_count => Refinery::Blog::Comment.unmoderated.size) %>
<% else %>
<% title = t('.comments.title') %>
<% end %>
<%= link_to title, '#',
:class => 'comments_icon' %>
</li>
<li>
<%= link_to t('.comments.new'), refinery.blog_admin_comments_path,
:class => 'comment_icon' %>
</li>
<li>
<%= link_to t('.comments.approved'), refinery.approved_blog_admin_comments_path,
:class => 'comment_tick_icon' %>
</li>
<li>
<%= link_to t('.comments.rejected'), refinery.rejected_blog_admin_comments_path,
:class => 'comment_cross_icon' %>
</li>
</ul>
<% end %>

<ul class='collapsible_menu'>
<li class='not_a_link'>
<%= link_to t('.categories.title'), '#',
:class => 'folder_icon' %>
</li>
<li>
<%= link_to t('.categories.manage'), refinery.blog_admin_categories_path,
:class => 'folder_edit_icon' %>
</li>
<li>
<%= link_to t('.categories.new'), refinery.new_blog_admin_category_path,
:class => 'folder_add_icon' %>
</li>
</ul>

<ul class='collapsible_menu'>
<li class='not_a_link'>
<%= link_to t('.settings.title'), refinery.blog_admin_settings_path,
:class => 'settings_icon' %>
</li>
<li>
<%= link_to t('.settings.comments'), refinery.comments_blog_admin_settings_path,
:class => "#{Refinery::Blog::Post.comments_allowed? ? 'success' : 'failure'}_icon" %>
</li>
<li>
<%= link_to t('.settings.moderation'), refinery.moderation_blog_admin_settings_path,
:class => "#{Refinery::Blog::Comment::Moderation.enabled? ? 'success' : 'failure'}_icon" %>
</li>
<li>
<%= link_to t('.settings.update_notified'),
refinery.notification_recipients_blog_admin_settings_path(:dialog => true, :height => 400),
:class => 'user_comment_icon' %>
</li>
<li>
<%= link_to t('.settings.teasers'),
refinery.teasers_blog_admin_settings_path, :class => "#{Refinery::Blog::Post.teasers_enabled? ? 'success' : 'failure'}_icon" %>
</li>
</ul>

</nav>

<% content_for :stylesheets, stylesheet_link_tag('refinery/blog/backend') %>

0 comments on commit e693ff2

Please sign in to comment.