Class: Caterpillar::Navigation

Inherits:
Object
  • Object
show all
Defined in:
lib/caterpillar/navigation.rb

Overview

Portlet navigation on Rails.

Caterpillar installs a partial ‘caterpillar/navigation’ into your views, along with an image and a CSS file. You need to add a filter ‘caterpillar’ which you will only load in development environment - in production the portlet container will be the ‘window manager’. This partial helps you to navigate between your portlets.

This will go to your ApplicationController:

if RAILS_ENV=='development'
  before_filter :caterpillar
end

def caterpillar # :nodoc:
  @caterpillar_navigation = Caterpillar::Navigation.rails
  @caterpillar_navigation_defaults = {
    :uid => 13904,
    :gid => 13912
  }
end

This will go the body of your layout:

<% if @caterpillar_navigation -%>
  <%= render :partial => "caterpillar/navigation" %>
<% end -%>

Class Method Summary collapse

Class Method Details

.railsObject

Method for formulating the portlets hash in Rails environment



38
39
40
41
42
# File 'lib/caterpillar/navigation.rb', line 38

def self.rails
  config = Util.eval_configuration
  config.routes = Util.parse_routes(config)
  return Util.categorize(Parser.new(config).portlets)
end