public
Description: A collection of UI widgets for RubyOnRails
Home | Edit | New

ShowHide

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 %>

Last edited by srboisvert, Thu Mar 26 07:05:09 -0700 2009
Home | Edit | New
Versions: