X-Git-Url: https://git.njae.me.uk/?a=blobdiff_plain;f=app%2Fviews%2Fproducts%2Findex.html.erb;fp=app%2Fviews%2Fproducts%2Findex.html.erb;h=ef89bd927117f73562e3811e38a1fa5e7205230e;hb=09cd438e77dd418b03b67e3e6a4b48ec95b72d1d;hp=0000000000000000000000000000000000000000;hpb=be9356cf35ae0ccfc15674b786386a61278bf305;p=depot.git diff --git a/app/views/products/index.html.erb b/app/views/products/index.html.erb new file mode 100644 index 0000000..ef89bd9 --- /dev/null +++ b/app/views/products/index.html.erb @@ -0,0 +1,34 @@ +<div id="product-list"> + <h1>Listing products</h1> + + <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 %> + </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 %><br/> + </td> + </tr> + <% end %> + </table> +</div> +<br /> +<%= link_to 'New product', new_product_path %>