Sha256: 4055b3b2d9713d6f3c70c8c2e27f7093889d5b808d7f3a9537fe830c0a4b7d6e

Contents?: true

Size: 1.11 KB

Versions: 1

Compression:

Stored size: 1.11 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[:name] %> /
    <% else %>
      <%= smart_link_to(c[:name], c[:fullpath]) %> /
    <% end %>
  <% end %>
</p>


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

  <% links = [] %>
  <% backstack_trail.each {|c| links.push c[:name] } %>
  <%= links.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

1 entries across 1 versions & 1 rubygems

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