Sha256: 9b5e4c6ade05087ff7f390318de3fb1ee6c6d1ca92f047d2833eaf9456804aab

Contents?: true

Size: 826 Bytes

Versions: 2

Compression:

Stored size: 826 Bytes

Contents

<%= list.define :item do |record, options| %>
  <%= options[:field] ? record.send(options[:field]) : record.to_s %>
<% end %>

<%= list.define :items do |options| %>
  <% if records %>
    <% records.each do |record| %>
      <%= content_tag :li, options[:item_html] do %>
        <%= list.use :item, record, options %>
      <% end %>
    <% end %>
  <% else %>
    <% list.items.each do |item| %>
      <%= content_tag :li, options.merge(item.options)[:item_html] do %>
        <%= list.use item.name %>
      <% end %>
    <% end %>
  <% end %>
<% end %>

<% list.items.each do |item| %>
  <%= list.define item.name, :item => item do |options| %>
    <%= item.name %>
  <% end %>
<% end %>

<%= list.use :list do |options| %>
  <%= content_tag :ul, options[:list_html] do %>
    <%= list.use :items %>
  <% end %>
<% end %>

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
list-for-0.0.4 app/views/list_for/_list_for.html.erb
list-for-0.0.3 app/views/list_for/_list_for.html.erb