Skip to content

Instantly share code, notes, and snippets.

@shankardevy
Created July 8, 2017 10:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shankardevy/46ea4f921bd23077ad026916619db3df to your computer and use it in GitHub Desktop.
Save shankardevy/46ea4f921bd23077ad026916619db3df to your computer and use it in GitHub Desktop.
<div class="product thumbnail">
<div class="caption">
<span class="text-muted pull-right"><%= @product.pack_size %></span>
<h2>
<div class="product-name"><%= @product.name %></div>
<span class="pull-right">₹
<small class="product-price"><%= @product.price %></small>
</span>
</h2>
<hr/>
<!-- add to cart code begins -->
<%= form_for @conn, "/cart", [as: :cart], fn f -> %>
<%= hidden_input f, :product_id, value: @product.id %>
<%= number_input f, :quantity, value: 1 %>
<%= submit "Add to cart" %>
<% end %>
<!-- add to cart code ends -->
</div>
<img src="<%= @product.image %>" />
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment