%# everything is cramped together to prevent the installation of separate css and js files -%>
<%# CATEGORIES -%>
<%# categories = @caterpillar_navigation.keys -%>
<% @caterpillar_navigation.each_pair do |category,portlets| -%>
<% cat = category.gsub(' ','_') -%>
<%= link_to_function( category,
"cp_toggle_category('%s',null);" % cat
)
-%>
<% end -%>
<%# PORTLET LINKS -%>
<% @caterpillar_navigation.each_pair do |category,portlets| -%>
<% portlets.each do |portlet| -%>
<% begin -%>
<%# check required variables -%>
<% portlet[:vars].each do |var|
#puts params.inspect
raise if params[var].nil?
end -%>
-
<%= link_to( portlet[:title], self.send('%s_url' % portlet[:name]) ) %>
<%#= link_to( portlet[:title], portlet[:reqs] ) -%>
<% rescue
logger.error $!.message
vars = {}
undef_vars = []
portlet[:vars].each do |var|
val = @caterpillar_navigation_defaults[var] || 0
vars.update( var => val )
undef_vars << var unless params[var]
end
-%>
-
<%= link_to( portlet[:title], portlet[:reqs].merge(vars) ) -%>
needs variables <%= vars.keys.inspect -%>
<% end -%>
<% end -%>
<% end -%>
Caterpillar v<%= Caterpillar::VERSION -%>