-<h1>Listing products</h1>
+<div id="product-list">
+ <h1>Listing products</h1>
-<table>
- <tr>
- <th>Title</th>
- <th>Description</th>
- <th>Image url</th>
- </tr>
+ <table>
+ <% for product in @products %>
+ <tr class="<%= cycle('list-line-odd', 'list-line-even')%>">
-<% 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>
+ <td>
+ <%= image_tag product.image_url, :class => 'list-image' %>
+ </td>
-<br />
+ <td class="list-description">
+ <dl>
+ <dt><%= h product.title %></dt>
+ <dd><%= h truncate(product.description.gsub(/<.*?>/, ''),
+ :length => 80) %></dd>
+ </dl>
+ </td>
+
+ <td class="list-actions">
+ <%= link_to 'Show', product %><br/>
+ <%= link_to 'Edit', edit_product_path(product) %><br/>
+ <%= link_to 'Destroy', product,
+ :confirm => 'Are you sure?',
+ :method => :delete %>
+ </td>
+ </tr>
+ <% end %>
+ </table>
+</div>
+
+<br/>
<%= link_to 'New product', new_product_path %>