Sha256: 0fd4c99d36e792937e722e961ecaeb47b2a50f86e8e117b6468220f989218bc8

Contents?: true

Size: 1.12 KB

Versions: 2

Compression:

Stored size: 1.12 KB

Contents

<%

  def smart_link_to(t, f)

    if f == request.fullpath
      link_to(t, f, :class => :here)
    else
      link_to(t, f)
    end

  end

  %>


<%# trail demonstrating interator with block %>
<p class="trail" id="link_trail">
  <% backstack_trail do |c| %>
    <% if c[:fullpath] == request.fullpath %>
      <%= c[:label] %> /
    <% else %>
      <%= smart_link_to(c[:label], c[:fullpath]) %> /
    <% end %>
  <% end %>
</p>


<%# trail demonstrating calling without block returns array, no links this time %>
<p class="trail" id="no_link_trail">

  <% crumbs = [] %>
  <% backstack_trail.each {|c| crumbs.push c[:label] } %>
  <%= crumbs.join(" / ").html_safe %>

</p>


<p>
  <%= smart_link_to("g", "/c4/g") %>
  <%= smart_link_to("h", "/c4/h") %>
  <%= smart_link_to("i", "/c4/i") %>
  <%= smart_link_to("j", "/c4/j") %>
</p>

<p>
  <%= smart_link_to("d", "/c3/d") %>
  <%= smart_link_to("e", "/c3/e") %>
  <%= smart_link_to("f", "/c3/f") %>
</p>

<p>
  <%= smart_link_to("b", "/c2/b") %>
  <%= smart_link_to("c", "/c2/c") %>
</p>

<p>
  <%= smart_link_to("a", "/c1/a") %>
</p>

<p>
  <%= backstack_link("Back", :id=>"back") %>
</p>

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
backstack-0.3.0 test/rails_root/app/views/layouts/_pins.html.erb
backstack-0.2.0 test/rails_root/app/views/layouts/_pins.html.erb