瀏覽代碼

Iteration F2.

master
Nils Dittberner 9 年之前
父節點
當前提交
1e39309cfc
共有 3 個檔案被更改,包括 3 行新增1 行删除
  1. +1
    -0
      app/controllers/line_items_controller.rb
  2. +1
    -0
      app/views/line_items/create.js.erb
  3. +1
    -1
      app/views/store/index.html.erb

+ 1
- 0
app/controllers/line_items_controller.rb 查看文件

@@ -34,6 +34,7 @@ class LineItemsController < ApplicationController
respond_to do |format|
if @line_item.save
format.html { redirect_to @line_item.cart }
format.js
format.json { render :show, status: :created, location: @line_item }
else
format.html { render :new }


+ 1
- 0
app/views/line_items/create.js.erb 查看文件

@@ -0,0 +1 @@
$('#cart').html("<%=j render(@cart) %>")

+ 1
- 1
app/views/store/index.html.erb 查看文件

@@ -11,7 +11,7 @@
<%= sanitize(product.description) %>
<div class="price_line">
<span class="price"><%= number_to_currency(product.price) %></span>
<%= button_to 'Add To Cart', line_items_path(product_id: product) %>
<%= button_to 'Add To Cart', line_items_path(product_id: product), remote: true %>
</div>
</div>
<% end %>


Loading…
取消
儲存