Last active
August 29, 2015 14:02
-
-
Save rocodev-tech/5799788d0553db155a4a to your computer and use it in GitHub Desktop.
app/views/carts/index.html.erb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="row"> | |
<div class="col-md-12"> | |
<h2> 購物車 </h2> | |
<table class="table table-bordered"> | |
<thead> | |
<tr> | |
<th>商品資訊</th> | |
<th></th> | |
<th>單價</th> | |
</tr> | |
</thead> | |
<tbody> | |
<% current_cart.items.each do |product| %> | |
<tr> | |
<td><%= render_product_photo(product.default_photo) %></td> | |
<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> | |
<div class="checkout"> | |
<%= link_to("確認結賬", "#" , :method => :post , :class => "btn btn-primary btn-lg btn-danger pull-right") %> | |
</div> | |
</div> | |
</div> |
app/models/user.rb
加入:
has_many :orders
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
rails-4 講義 p38,要補上以下動作
config/routes
加上checkout
現在看到這個
index.html.erb
檔案,39 行,要改成: