creating links within a page on rails dynamic content

Monday, July 7, 2014

I have a very long list of boroughs. I want to make finding the boroughs more accessible by creating a small list at the top where a user can click and it links then to the other parts of the page where the said borough is. How do I so this, what is would be the best solution? this is what I have at the moment, how would i like the titles at the top to the more detailed info in the second iteration? <% unless boroughs.empty? %> <% boroughs.sort_by{|e| e[:title]}.each do |borough| %> <%= borough.title %> <% end %>



<% boroughs.sort_by{|e| e[:title]}.each do |borough| %>
<li class="borough">
<h2>
<%= borough.title %>
</h2>
<ul class="centres">
<% borough.send(venues.first.class.to_s.underscore.pluralize).accessible_by(current_ability).each do |venue| %>
<li>
<% if venue.archived? %>
<span class="title">
<%= content_tag(:s, venue.title.titleize) %>
</span>
<% else %>
<span class="title">
<%= link_to venue.title.titleize, edit_admin_centre_path(venue) %>
</span>
<% end %>
<%= link_to raw('<span>edit</span>'), edit_details_admin_centre_path(venue), :class=>"icon edit", :title=>"Edit Centre" if can?(:manage, Venue) %>
</li>
<% end %>
</ul>
</li>
<% end %>
<% end %>
</ol>
</section>






http://ift.tt/1pUlDl5