-<table>
- <tr>
- <th>Title</th>
- <th>Description</th>
- <th>Image url</th>
- </tr>
-
-<% for product in @products %>
- <tr>
- <td><%=h product.title %></td>
- <td><%=h product.description %></td>
- <td><%=h product.image_url %></td>
- <td><%= link_to 'Show', product %></td>
- <td><%= link_to 'Edit', edit_product_path(product) %></td>
- <td><%= link_to 'Destroy', product, :confirm => 'Are you sure?', :method => :delete %></td>
- </tr>
-<% end %>
-</table>
+ <table>
+ <% for product in @products %>
+ <tr class="<%= cycle('list-line-odd', 'list-line-even') %>">
+ <td>
+ <%= image_tag product.image_url, :class => 'list-image' %>
+ </td>
+ <td class="list-description">
+ <dl>
+ <dt><%=h product.title %></dt>
+ <dd><%=h truncate(product.description.gsub(/<.*?>/, '|'),
+ :length => 80) %></dd>
+ <dd><%=number_to_currency product.price, :unit => "£" %>
+ <% if product.date_available.past? %>
+ <dd>Available since <%= product.date_available %></dd>
+ <% else %>
+ <dd class="unavailable">Available from <%= product.date_available %></dd>
+ <% end %>
+ <% if not product.date_available_until.nil? %>
+ <% if product.date_available_until.future? %>
+ <dd>Available until <%= product.date_available_until %></dd>
+ <% else %>
+ <dd class="unavailable">Unavailable since <%= product.date_available_until %></dd>
+ <% end %>
+ <% end %>
+ </dl>
+ </td>