소스 검색

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 %>


불러오는 중...
취소
저장