osbridge/openconferenceware

View on GitHub
app/views/open_conference_ware/proposals/_sub_list_for_kind.html.erb

Summary

Maintainability
Test Coverage
<%
# Variables:
# * kind => :proposals or :sessions. REQUIRED.
# * container => ActiveRecord instance that owns the Proposal records to show, e.g., a User. REQUIRED.
# * records => Array of Proposal instances to display. Optional, defaults to #proposals method on +container+.
# * title => Title of the container, e.g., "user". Optional, leave blank to guess based on container's class.
# * header_tag => HTML tag used to wrap the header, defaults to :h3
# * header_prefix => Prefix to add to the title, e.g., "Favorite"
# * show_sorter => Display the sort toolbar? Optional, defaults to false.
# * is_archived => Archive the content and hide it behind a link? Optional, defaults to false.

kind          = local_assigns[:kind]
container     = local_assigns[:container] || container.proposals
records       = local_assigns[:records]
title         = local_assigns[:title]
header_tag    ||= :h3
header_prefix = local_assigns[:header_prefix]
show_sorter   = local_assigns[:show_sorter]
%>

<% unless records.blank? %>
  <div class="proposals_sub_list_for_kind proposals_sub_list_for_kind_<%= kind %>">
    <div class="proposals_sub_list_for_kind_toggle" style="display: none">
      <%= link_to "Display #{kind}...", "#" %>
    </div>
    <div class="proposals_sub_list_for_kind_content">
      <%= content_tag header_tag, "#{header_prefix} #{kind} for this #{title || container.class.name.demodulize.singularize}".strip.humanize %>
      <%= render :partial => "open_conference_ware/proposals/list", :locals => {:kind => kind, :records => records, :sorter => show_sorter} %>
    </div>
  </div>
<% end %>