-
Notifications
You must be signed in to change notification settings - Fork 39
ShowHide
srboisvert edited this page Sep 12, 2010
·
5 revisions
Sample: you want to show a list of emails, and when you click the ‘show details’ link, a box with the user’s details appears:
<% for user in @users %>
<%=h user.login %> <%= show_box_for user, :link_name=> 'show user details' %><!-- this is the link to open the detail box-->
<% detail_box_for user do %> <!-- this defines the initially hidden box -->
<%=h user.name %>
<%=h user.surname %>
<%= link_to 'Show', user %>
<%= link_to 'Edit', edit_user_path(user) %>
<%= link_to 'Destroy', user, :confirm => 'Are you sure?', :method => :delete %>
<%= hide_box_for user %> <!-- this is the link to close the detail box -->
<% end %>
<% end %>