X-Git-Url: https://git.njae.me.uk/?a=blobdiff_plain;f=app%2Fviews%2Fproducts%2Findex.html.erb;h=ca7fb6a809cd53c83ec2491a40f59f13fcb21e19;hb=e0b92cc2e0d255a101ffa5248d4d15080fe2ea63;hp=6bb547aa96d8023ebc9d510494ba5354c34bb5c2;hpb=3b424e341e1dda1f67b4461de089b76eb69bbc70;p=depot.git diff --git a/app/views/products/index.html.erb b/app/views/products/index.html.erb index 6bb547a..ca7fb6a 100644 --- a/app/views/products/index.html.erb +++ b/app/views/products/index.html.erb @@ -1,39 +1,41 @@ -
+

Listing products

- <% for product in @products %> - + <% for product in @products %> + + + - - - - - + - <% end %> + <% end %>
+ <%= image_tag product.image_url, :class => 'list-image' %> + +
+
<%=h product.title %>
+
<%=h truncate(product.description.gsub(/<.*?>/, '|'), + :length => 80) %>
+
<%=number_to_currency product.price, :unit => "£" %> + <% if product.date_available.past? %> +
Available since <%= product.date_available %>
+ <% else %> +
Available from <%= product.date_available %>
+ <% end %> + <% if not product.date_available_until.nil? %> + <% if product.date_available_until.future? %> +
Available until <%= product.date_available_until %>
+ <% else %> +
Unavailable since <%= product.date_available_until %>
+ <% end %> + <% end %> +
+
- <%= image_tag product.image_url, :class => 'list-image' %> - -
-
<%= h product.title %>
-
<%= h truncate(product.description.gsub(/<.*?>/, ''), - :length => 80) %>
- <% if product.date_available.past? %> -
Available since <%= product.date_available %>
- <% else %> -
Available from <%= product.date_available %>
- <% end %> -
-
- <%= link_to 'Show', product %>
- <%= link_to 'Edit', edit_product_path(product) %>
- <%= link_to 'Destroy', product, - :confirm => 'Are you sure?', - :method => :delete %> -
+ <%= link_to 'Show', product %>
+ <%= link_to 'Edit', edit_product_path(product) %>
+ <%= link_to 'Destroy', product, :confirm => 'Are you sure?', :method => :delete %>
+
- -
- +
<%= link_to 'New product', new_product_path %>