Skip to content

Instantly share code, notes, and snippets.

@rocodev-tech
Last active August 29, 2015 14:02
Show Gist options
  • Save rocodev-tech/206b6d2522a0cab8ffb4 to your computer and use it in GitHub Desktop.
Save rocodev-tech/206b6d2522a0cab8ffb4 to your computer and use it in GitHub Desktop.
app/views/carts/checkout.html.erb
<div class="row">
<div class="col-md-12">
<h2> 購物明細 </h2>
<table class="table table-bordered">
<thead>
<tr>
<th width="80%">商品明細</th>
<th>單價</th>
</tr>
</thead>
<tbody>
<% current_cart.items.each do |product| %>
<tr>
<td>
<%= link_to(product.title, admin_product_path(product)) %>
</td>
<td> <%= product.price %> </td>
</tr>
<% end %>
</tbody>
</table>
<div class="total group">
<span class="pull-right">
<span> 總計 <%= render_cart_total_price(current_cart) %> NTD
</span>
</div>
<hr>
<h2> 訂單資訊 </h2>
<div class="order-form">
<%= simple_form_for @order do |f| %>
<%= f.simple_fields_for :info do |c| %>
<legend> 訂購人</legend>
<div class="form-group col-lg-6">
<%= c.input :billing_name %>
</div>
<div class="form-group col-lg-6">
<%= c.input :billing_address %>
</div>
<legend> 收貨人</legend>
<div class="form-group col-lg-6">
<%= c.input :shipping_name %>
</div>
<div class="form-group col-lg-6">
<%= c.input :shipping_address %>
</div>
<% end %>
<div class="checkout">
<%= f.submit "生成訂單", :class => "btn btn-primary btn-lg btn-danger pull-right", :disable_with => 'Submiting...' %>
</div>
<% end %>
</div>
</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment