Added availability date to product table
[depot.git] / app / views / products / index.html.erb
1 <div id="product-list">
2 <h1>Listing products</h1>
3
4 <table>
5 <% for product in @products %>
6 <tr class="<%= cycle('list-line-odd', 'list-line-even')%>">
7
8 <td>
9 <%= image_tag product.image_url, :class => 'list-image' %>
10 </td>
11
12 <td class="list-description">
13 <dl>
14 <dt><%= h product.title %></dt>
15 <dd><%= h truncate(product.description.gsub(/<.*?>/, ''),
16 :length => 80) %></dd>
17 <% if product.date_available.past? %>
18 <dd>Available since <%= product.date_available %></dd>
19 <% else %>
20 <dd class="unavailable">Available from <%= product.date_available %></dd>
21 <% end %>
22 </dl>
23 </td>
24
25 <td class="list-actions">
26 <%= link_to 'Show', product %><br/>
27 <%= link_to 'Edit', edit_product_path(product) %><br/>
28 <%= link_to 'Destroy', product,
29 :confirm => 'Are you sure?',
30 :method => :delete %>
31 </td>
32 </tr>
33 <% end %>
34 </table>
35 </div>
36
37 <br/>
38
39 <%= link_to 'New product', new_product_path %>