spree_favorite_products 2.2.2 → 2.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md CHANGED
@@ -20,7 +20,7 @@ For older versions of spree.
20
20
 
21
21
  ```ruby
22
22
  # Spree 2.1.x
23
- gem 'spree_favorite_products', '2.0.2'
23
+ gem 'spree_favorite_products', '2.0.3'
24
24
  ```
25
25
 
26
26
  ```ruby
@@ -1,5 +1,5 @@
1
1
  Spree::Product.class_eval do
2
- has_many :favorites
2
+ has_many :favorites, :dependent => :destroy
3
3
  has_many :favorite_users, :through => :favorites, :class_name => 'Spree::User', :source => 'user'
4
4
 
5
5
  def self.favorite
@@ -1,5 +1,5 @@
1
1
  Spree::User.class_eval do
2
- has_many :favorites
2
+ has_many :favorites, :dependent => :destroy
3
3
  has_many :favorite_products, :through => :favorites, :class_name => 'Spree::Product', :source => 'product'
4
4
 
5
5
  def has_favorite_product?(product_id)
@@ -5,6 +5,9 @@
5
5
  } else {
6
6
  $("#favorite_product_<%= @favorite.product_id%>").remove();
7
7
  alert("Successfully removed favorite product from your list");
8
+ if (!$('.favorite_product').length) {
9
+ window.location = '<%= favorite_products_path %>'
10
+ }
8
11
  }
9
12
  <% else %>
10
13
  alert("Could not remove product form your list")
@@ -1,7 +1,7 @@
1
1
  <div data-hook="account_my_favorite_products" class="account-my-favorite-products commonform">
2
2
  <h3><%= Spree.t(:my_favorite_products) %></h3>
3
3
  <% if @favorite_products.present? %>
4
- <table class="favorite-products order-summary">
4
+ <table class="favorite-products order-summary" width="100%">
5
5
  <thead>
6
6
  <tr>
7
7
  <th class="favorite-product-image"><%= Spree.t(:product_image) %></th>
@@ -11,10 +11,10 @@
11
11
  </thead>
12
12
  <tbody>
13
13
  <% @favorite_products.each do |product| %>
14
- <tr class="<%= cycle('even', 'odd') %>" id="favorite_product_<%= product.id %>">
14
+ <tr class="<%= cycle('even', 'odd') %> favorite_product" id="favorite_product_<%= product.id %>">
15
15
  <td class="favorite-product-image"><%= link_to small_image(product), product_path(product) %></td>
16
16
  <td class="favorite-product-name"><%= product.name %></td>
17
- <td class="favorite-product-remove"><%= link_to 'Remove', favorite_product_path(:id => product.id), :method => :delete, :remote => true %>
17
+ <td class="favorite-product-remove"><%= link_to 'Remove', favorite_product_path(:id => product.id), :method => :delete, :remote => true, :confirm => 'Are you sure you want to remove the product?' %>
18
18
  </tr>
19
19
  <% end %>
20
20
  </tbody>
@@ -15,7 +15,7 @@ describe Spree::Product do
15
15
  end
16
16
 
17
17
 
18
- it { should have_many(:favorites) }
18
+ it { should have_many(:favorites).dependent(:destroy) }
19
19
  it { should have_many(:favorite_users).through(:favorites).class_name('Spree::User') }
20
20
 
21
21
  describe "Spree::Product.favorite" do
@@ -11,7 +11,7 @@ describe Spree::User do
11
11
  favorite.save!
12
12
  end
13
13
 
14
- it { should have_many(:favorites) }
14
+ it { should have_many(:favorites).dependent(:destroy) }
15
15
  it { should have_many(:favorite_products).through(:favorites).class_name('Spree::Product') }
16
16
 
17
17
  describe "has_favorite_product?" do
@@ -2,7 +2,7 @@
2
2
  Gem::Specification.new do |s|
3
3
  s.platform = Gem::Platform::RUBY
4
4
  s.name = 'spree_favorite_products'
5
- s.version = '2.2.2'
5
+ s.version = '2.2.3'
6
6
  s.summary = 'Favorite Products in Spree'
7
7
  s.description = 'This extension adds the following features: 1. Adds a link Mark as favorite on product detail page. 2. Favorite Products tab on header 3. Favorite Products tab in admin section'
8
8
  s.required_ruby_version = '>= 1.9.3'
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spree_favorite_products
3
3
  version: !ruby/object:Gem::Version
4
- hash: 3
4
+ hash: 1
5
5
  prerelease:
6
6
  segments:
7
7
  - 2
8
8
  - 2
9
- - 2
10
- version: 2.2.2
9
+ - 3
10
+ version: 2.2.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Mohit Bansal
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2014-04-30 00:00:00 Z
18
+ date: 2014-05-15 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: spree_core