Sha256: 8487aecb3e05e4b2f945511e28d60156ba70382876fe2899d25135345f6909ea

Contents?: true

Size: 1.45 KB

Versions: 3

Compression:

Stored size: 1.45 KB

Contents

<div class="caterpillar_navigation">
  <%# CATEGORIES -%>
  <%# categories = @caterpillar_navigation.keys -%>
  <div id="caterpillar_categories">
    <% @caterpillar_navigation.each_pair do |category,portlets| -%>
      <% cat = category.gsub(' ','_') -%>
      <span id="<%=cat-%>" class="cp_category">
        <%= link_to_function( category,
          "cp_toggle_category('%s',null);" % cat
      )
      -%>
      </span>
    <% end -%>
  </div>

  <%# PORTLET LINKS -%>
  <% @caterpillar_navigation.each_pair do |category,portlets| -%>
    <div id="<%=category.gsub(' ','_')-%>_portlets" class="cp_portlets" style="display: none;">
      <ul>
      <% portlets.each do |portlet| -%>
        <% begin -%>
          <%# check required variables -%>
          <% portlet[:vars].each do |var|
              raise if params[var].nil?
             end -%>

          <li><%= link_to( portlet[:title], portlet[:reqs] ) -%></li>

        <% rescue
             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
        -%>
          <li>
            <b><%= link_to( portlet[:title], portlet[:reqs].merge(vars) ) -%></b>
            <i>needs variables</i> <b><%= vars.keys.inspect -%></b>
          </li>
        <% end -%>
      <% end -%>
      </ul>
    </div>
  <% end -%>
</div>

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
caterpillar-0.9.2 views/caterpillar/_navigation.html.erb
caterpillar-0.9.4 views/caterpillar/_navigation.html.erb
caterpillar-0.9.5 views/caterpillar/_navigation.html.erb