diff --git a/Gemfile b/Gemfile index 4aa8f6b..31ef50f 100644 --- a/Gemfile +++ b/Gemfile @@ -18,6 +18,7 @@ gem 'coffee-rails', '~> 4.2' # Use jquery as the JavaScript library gem 'jquery-rails' +gem 'jquery-ui-rails' # Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks gem 'turbolinks', '~> 5' # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder diff --git a/Gemfile.lock b/Gemfile.lock index 3a41a6e..460400b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -63,6 +63,8 @@ GEM rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) thor (>= 0.14, < 2.0) + jquery-ui-rails (5.0.5) + railties (>= 3.2.16) listen (3.0.8) rb-fsevent (~> 0.9, >= 0.9.4) rb-inotify (~> 0.9, >= 0.9.7) @@ -158,6 +160,7 @@ DEPENDENCIES coffee-rails (~> 4.2) jbuilder (~> 2.5) jquery-rails + jquery-ui-rails listen (~> 3.0.5) puma (~> 3.0) rails (~> 5.0.0, >= 5.0.0.1) diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index b12018d..d106681 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -11,6 +11,7 @@ // about supported directives. // //= require jquery +//= require jquery-ui/effect-blind //= require jquery_ujs //= require turbolinks //= require_tree . diff --git a/app/controllers/line_items_controller.rb b/app/controllers/line_items_controller.rb index b636c96..6159463 100644 --- a/app/controllers/line_items_controller.rb +++ b/app/controllers/line_items_controller.rb @@ -34,7 +34,7 @@ class LineItemsController < ApplicationController respond_to do |format| if @line_item.save format.html { redirect_to @line_item.cart } - format.js + format.js { @current_item = @line_item } format.json { render :show, status: :created, location: @line_item } else format.html { render :new } diff --git a/app/views/line_items/_line_item.html.erb b/app/views/line_items/_line_item.html.erb index 608b918..e66ce68 100644 --- a/app/views/line_items/_line_item.html.erb +++ b/app/views/line_items/_line_item.html.erb @@ -1,4 +1,8 @@ -