spree_compare_products 0.40.90
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/.gitignore +4 -0
- data/Gemfile +6 -0
- data/README.markdown +34 -0
- data/Rakefile +3 -0
- data/app/controllers/compare_products_controller.rb +60 -0
- data/app/helpers/compare_products_helper.rb +44 -0
- data/app/metal/bookmarkable_comparison.rb +15 -0
- data/app/views/admin/taxonomies/_comparable_field.html.erb +4 -0
- data/app/views/admin/taxonomies/_list.html.erb +17 -0
- data/app/views/compare_products/show.html.erb +25 -0
- data/app/views/shared/_compare_product_field.html.erb +5 -0
- data/app/views/taxons/_comparable_taxon.html.erb +12 -0
- data/app/views/taxons/_taxon_products.html.erb +5 -0
- data/config/locales/en-US.yml +10 -0
- data/config/locales/es.yml +10 -0
- data/config/locales/pl.yml +11 -0
- data/config/locales/ru.yml +10 -0
- data/config/routes.rb +4 -0
- data/lib/spree_compare_products/comparable_container.rb +12 -0
- data/lib/spree_compare_products/version.rb +3 -0
- data/lib/spree_compare_products.rb +30 -0
- data/lib/spree_compare_products_hooks.rb +9 -0
- data/lib/tasks/install.rake +25 -0
- data/lib/tasks/spree_compare_products.rake +1 -0
- data/public/javascripts/product_comparison.js +104 -0
- data/public/stylesheets/compiled/compare_products.css +8 -0
- data/public/stylesheets/sass/compare_products.sass +9 -0
- data/spec/spec_helper.rb +32 -0
- data/spree_compare_products.gemspec +26 -0
- metadata +108 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/README.markdown
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
SPREE COMPARE PRODUCTS
|
|
2
|
+
======================
|
|
3
|
+
|
|
4
|
+
DESCRIPTION:
|
|
5
|
+
------------
|
|
6
|
+
|
|
7
|
+
Provides product comparison with other products within the same taxon.
|
|
8
|
+
|
|
9
|
+
This is a fork of [spree-compare-products](https://github.com/calas/spree-compare-products) by Jorge Calás.
|
|
10
|
+
|
|
11
|
+
REQUIREMENTS:
|
|
12
|
+
-------------
|
|
13
|
+
|
|
14
|
+
* {Spree}(https://github.com/railsdog/spree) (Version >= 0.50.99)
|
|
15
|
+
|
|
16
|
+
FEATURES:
|
|
17
|
+
---------
|
|
18
|
+
|
|
19
|
+
* Allows the admin user to select which taxonomies are comparable.
|
|
20
|
+
* Provides a bookmark-able URL.
|
|
21
|
+
* Only allows products comparison in comparable taxonomies.
|
|
22
|
+
* Only compares products in the same exact taxon.
|
|
23
|
+
* Compares up to 4 products.
|
|
24
|
+
* Redirects to the product's taxon page if only one product is provided.
|
|
25
|
+
* If javascript is available:
|
|
26
|
+
* Disabling submit button when less than 2 products are selected.
|
|
27
|
+
* Submit to the correct URL (to avoid server-side redirection).
|
|
28
|
+
|
|
29
|
+
TODOS:
|
|
30
|
+
------
|
|
31
|
+
|
|
32
|
+
* Add tests
|
|
33
|
+
* Bring back all features provided by the original extension
|
|
34
|
+
* Don't rely on javascript
|
data/Rakefile
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
class CompareProductsController < Spree::BaseController
|
|
2
|
+
|
|
3
|
+
before_filter :find_taxon
|
|
4
|
+
before_filter :verify_comparable_taxon
|
|
5
|
+
before_filter :find_products
|
|
6
|
+
|
|
7
|
+
helper :products, :taxons
|
|
8
|
+
|
|
9
|
+
def show
|
|
10
|
+
@properties = @products.map(&:properties).flatten.uniq # We return the list of properties here so we can use them latter.
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
private
|
|
14
|
+
|
|
15
|
+
# Find the taxon from the url.
|
|
16
|
+
def find_taxon
|
|
17
|
+
permalink = ''
|
|
18
|
+
|
|
19
|
+
if params[:taxon_path]
|
|
20
|
+
permalink = "#{params[:taxon_path]}/"
|
|
21
|
+
elsif params[:taxon]
|
|
22
|
+
permalink = "#{params[:taxon]}/"
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
@taxon = Taxon.find_by_permalink(permalink) unless permalink.blank?
|
|
26
|
+
|
|
27
|
+
if @taxon.nil?
|
|
28
|
+
flash[:error] = I18n.t('compare_products.invalid_taxon')
|
|
29
|
+
|
|
30
|
+
redirect_to products_path
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# Verifies that the comparison can be made inside this taxon.
|
|
35
|
+
def verify_comparable_taxon
|
|
36
|
+
unless @taxon.is_comparable?
|
|
37
|
+
flash[:error] = I18n.t('compare_products.taxon_not_comparable')
|
|
38
|
+
|
|
39
|
+
redirect_to "/t/#{@taxon.permalink}"
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# Find the products inside the taxon, manually adding product ids to
|
|
44
|
+
# the url will silently be ignored if they can't be compared inside
|
|
45
|
+
# the taxon or don't exists.
|
|
46
|
+
def find_products
|
|
47
|
+
product_ids = params[:product_ids].split('/')
|
|
48
|
+
|
|
49
|
+
if product_ids.length > 4
|
|
50
|
+
flash[:notice] = I18n.t('compare_products.limit_is_4')
|
|
51
|
+
product_ids = product_ids[0..3]
|
|
52
|
+
elsif product_ids.length < 2
|
|
53
|
+
flash[:error] = I18n.t('compare_products.insufficient_data')
|
|
54
|
+
redirect_to "/t/#{@taxon.permalink}"
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
@products = @taxon.products.find(:all, :conditions => { :id => product_ids}, :include => { :product_properties => :property }, :limit => 4)
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
end
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
module CompareProductsHelper
|
|
2
|
+
# Return the transposed matrix of the comparison table.
|
|
3
|
+
#
|
|
4
|
+
# Example:
|
|
5
|
+
# [
|
|
6
|
+
# ["Product", "product1 image", "product2 image"],
|
|
7
|
+
# ["Name", "product1 name", "product2 name"],
|
|
8
|
+
# ...
|
|
9
|
+
# ["Price", "product1 price", "product2 price"]
|
|
10
|
+
# ]
|
|
11
|
+
def comparison_rows_for(products, properties)
|
|
12
|
+
fields = [comparison_fields_for(products, properties)]
|
|
13
|
+
products.each do |product|
|
|
14
|
+
fields << (fields_for(product, properties))
|
|
15
|
+
end
|
|
16
|
+
fields.transpose
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
# Return an array with the values of the fields to be compared for
|
|
20
|
+
# the specified product.
|
|
21
|
+
#
|
|
22
|
+
# Example:
|
|
23
|
+
# ["product1 image", "product1 name", ..., "product1 price"]
|
|
24
|
+
def fields_for(product, properties)
|
|
25
|
+
[ link_to(small_image(product), product), link_to(product.name, product)].tap { |fields|
|
|
26
|
+
properties.each do |property|
|
|
27
|
+
fields << product.product_properties.find_by_property_id(property.id).try(:value)
|
|
28
|
+
end
|
|
29
|
+
}.tap { |fields| fields << number_to_currency(product.price) }
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
# Returns an array with the translated names of the fields to be
|
|
33
|
+
# compared.
|
|
34
|
+
#
|
|
35
|
+
# Example:
|
|
36
|
+
# ["Product", "Name", ..., "Price"]
|
|
37
|
+
def comparison_fields_for(products, properties)
|
|
38
|
+
[t('product'), t('name')].tap { |fields|
|
|
39
|
+
properties.each { |property| fields << property.presentation }
|
|
40
|
+
}.tap { |fields|
|
|
41
|
+
fields << t('price')
|
|
42
|
+
}
|
|
43
|
+
end
|
|
44
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
class BookmarkableComparison
|
|
2
|
+
|
|
3
|
+
def self.call(env)
|
|
4
|
+
req = Rack::Request.new(env)
|
|
5
|
+
|
|
6
|
+
if req.path_info =~ /^\/compare_products/
|
|
7
|
+
products = (req.params['product_id'] || []).join('/')
|
|
8
|
+
url = "/t/#{req.params['taxon']}/compare/#{products}"
|
|
9
|
+
return [303, {"Location" => url}, []]
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
[ 404, { 'Content-Type' => 'text/html' }, [ 'Not Found' ] ]
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<table class="index">
|
|
2
|
+
<tr>
|
|
3
|
+
<th><%= t('name') %></th>
|
|
4
|
+
<th><%= t('compare_products.comparable_container') %></th>
|
|
5
|
+
<th></th>
|
|
6
|
+
</tr>
|
|
7
|
+
|
|
8
|
+
<% for taxonomy in @taxonomies %>
|
|
9
|
+
<tr id="<%= dom_id taxonomy %>">
|
|
10
|
+
<td><%= taxonomy.name %></td>
|
|
11
|
+
<td><%= icon('tick') if taxonomy.comparable? %></td>
|
|
12
|
+
<td class="actions">
|
|
13
|
+
<%= link_to_edit taxonomy.id %> <%= link_to_delete taxonomy %>
|
|
14
|
+
</td>
|
|
15
|
+
</tr>
|
|
16
|
+
<% end %>
|
|
17
|
+
</table>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<% content_for :head do %>
|
|
2
|
+
<%= stylesheet_link_tag 'compiled/compare_products' %>
|
|
3
|
+
<% end %>
|
|
4
|
+
|
|
5
|
+
<% content_for :sidebar do %>
|
|
6
|
+
<%= render :partial => 'shared/taxonomies' %>
|
|
7
|
+
<% end %>
|
|
8
|
+
|
|
9
|
+
<h1>
|
|
10
|
+
<%= t('compare_products.product_comparison') %>
|
|
11
|
+
</h1>
|
|
12
|
+
|
|
13
|
+
<table>
|
|
14
|
+
<% comparison_rows_for(@products, @properties).each do |row| %>
|
|
15
|
+
<tr>
|
|
16
|
+
<th><%= row.shift -%></th>
|
|
17
|
+
|
|
18
|
+
<% row.each do |field| %>
|
|
19
|
+
<td><%= field || raw('—') %></td>
|
|
20
|
+
<% end %>
|
|
21
|
+
</tr>
|
|
22
|
+
<% end %>
|
|
23
|
+
</table>
|
|
24
|
+
|
|
25
|
+
<%= link_to t('continue_shopping'), seo_url(@taxon), :class => 'continue button' %>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<% content_for :head do %>
|
|
2
|
+
<%= javascript_include_tag 'product_comparison' %>
|
|
3
|
+
|
|
4
|
+
<%= stylesheet_link_tag 'compiled/compare_products' %>
|
|
5
|
+
<% end %>
|
|
6
|
+
|
|
7
|
+
<% form_tag(compare_products_path, :method => :get) do %>
|
|
8
|
+
<%= hidden_field_tag('taxon_permalink', params[:id]) %>
|
|
9
|
+
<% @comparable = true %>
|
|
10
|
+
<%= render 'shared/products.html.erb', :products => @products, :taxon => @taxon %>
|
|
11
|
+
<%= submit_tag t('compare_products.compare'), :id => 'compare', :class => 'button' %>
|
|
12
|
+
<% end %>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
en:
|
|
2
|
+
compare_products:
|
|
3
|
+
comparable_container: Enable product comparison
|
|
4
|
+
compare: Compare
|
|
5
|
+
compare_selected: Compare selected products
|
|
6
|
+
insufficient_data: Insufficient data. You need to select at least 2 products.
|
|
7
|
+
invalid_taxon: Invalid taxon
|
|
8
|
+
limit_is_4: You can only compare up to 4 products.
|
|
9
|
+
product_comparison: Product comparison
|
|
10
|
+
taxon_not_comparable: "Products inside this taxon can't be compared"
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
es:
|
|
2
|
+
compare_products:
|
|
3
|
+
comparable_container: Habilitar comparación de productos
|
|
4
|
+
compare: Comparar
|
|
5
|
+
compare_selected: Comparar los productos seleccionados
|
|
6
|
+
limit_is_4: Solo puedes comparar hasta 4 productos.
|
|
7
|
+
insufficient_data: Datos insuficientes. Debe seleccionar al menos 2 products.
|
|
8
|
+
invalid_taxon: Taxón no válido
|
|
9
|
+
product_comparison: Comparación de productos
|
|
10
|
+
taxon_not_comparable: No se pueden comparar products dentro de este taxón.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
---
|
|
2
|
+
pl:
|
|
3
|
+
compare_products:
|
|
4
|
+
comparable_container: "Włącz porównywanie produktów"
|
|
5
|
+
compare: Porównaj
|
|
6
|
+
compare_selected: "Porównaj zaznaczone produkty"
|
|
7
|
+
insufficient_data: "Brak wystarczających danych. Zaznacz co najmniej 2 produkty."
|
|
8
|
+
invalid_taxon: "Niepoprawna kategoria"
|
|
9
|
+
limit_is_4: "Możesz porównać maksymalnie 4 produkty."
|
|
10
|
+
product_comparison: "Porównanie produktów."
|
|
11
|
+
taxon_not_comparable: "Produty w tej kategorii nie mogą zostać porównane"
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
ru:
|
|
2
|
+
compare_products:
|
|
3
|
+
comparable_container: "разрешить сравнение товаров"
|
|
4
|
+
compare: "Сравнить"
|
|
5
|
+
compare_selected: "Сравнить выбранные товары"
|
|
6
|
+
insufficient_data: "Недостаточно данных, нужно выбрать хотя бы 2 товара."
|
|
7
|
+
invalid_taxon: "Нельзя сравнивать товары из разных категорий"
|
|
8
|
+
limit_is_4: "Вы можете сравнить не более четырёх товаров одновременно."
|
|
9
|
+
product_comparison: "Сравнение товаров"
|
|
10
|
+
taxon_not_comparable: "Товары данной категории не могут быть сравнены."
|
data/config/routes.rb
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
module SpreeCompareProducts
|
|
2
|
+
module ComparableContainer
|
|
3
|
+
def self.included(base)
|
|
4
|
+
base.class_eval do
|
|
5
|
+
preference :enable_product_comparison, :boolean, :default => false
|
|
6
|
+
alias_method :comparable, :prefers_enable_product_comparison?
|
|
7
|
+
alias_method :comparable?, :prefers_enable_product_comparison?
|
|
8
|
+
alias_method :comparable=, :prefers_enable_product_comparison=
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
require 'spree_core'
|
|
2
|
+
require 'spree_compare_products_hooks'
|
|
3
|
+
require 'spree_compare_products/comparable_container'
|
|
4
|
+
|
|
5
|
+
module SpreeCompareProducts
|
|
6
|
+
class Engine < Rails::Engine
|
|
7
|
+
|
|
8
|
+
config.autoload_paths += %W(#{config.root}/lib)
|
|
9
|
+
|
|
10
|
+
def self.activate
|
|
11
|
+
Dir.glob(File.join(File.dirname(__FILE__), '../app/**/*_decorator*.rb')) do |c|
|
|
12
|
+
Rails.env.production? ? require(c) : load(c)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
Taxonomy.class_eval do
|
|
16
|
+
include SpreeCompareProducts::ComparableContainer
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
Taxon.class_eval do
|
|
20
|
+
include SpreeCompareProducts::ComparableContainer
|
|
21
|
+
|
|
22
|
+
def is_comparable?
|
|
23
|
+
comparable? || taxonomy.comparable?
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
config.to_prepare &method(:activate).to_proc
|
|
29
|
+
end
|
|
30
|
+
end
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
class SpreeCompareProductsHooks < Spree::ThemeSupport::HookListener
|
|
2
|
+
|
|
3
|
+
insert_after :admin_inside_taxonomy_form, 'admin/taxonomies/comparable_field'
|
|
4
|
+
|
|
5
|
+
replace :taxon_products, 'taxons/taxon_products'
|
|
6
|
+
|
|
7
|
+
insert_after :products_list_item, 'shared/compare_product_field'
|
|
8
|
+
|
|
9
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
namespace :spree_compare_products do
|
|
2
|
+
desc 'Copies all migrations and assets (NOTE: This will be obsolete with Rails 3.1)'
|
|
3
|
+
task :install do
|
|
4
|
+
Rake::Task['spree_compare_products:install:migrations'].invoke
|
|
5
|
+
Rake::Task['spree_compare_products:install:assets'].invoke
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
namespace :install do
|
|
9
|
+
desc 'Copies all migrations (NOTE: This will be obsolete with Rails 3.1)'
|
|
10
|
+
task :migrations do
|
|
11
|
+
source = File.join(File.dirname(__FILE__), '..', '..', 'db')
|
|
12
|
+
destination = File.join(Rails.root, 'db')
|
|
13
|
+
Spree::FileUtilz.mirror_files(source, destination)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
desc 'Copies all assets (NOTE: This will be obsolete with Rails 3.1)'
|
|
17
|
+
task :assets do
|
|
18
|
+
source = File.join(File.dirname(__FILE__), '..', '..', 'public')
|
|
19
|
+
destination = File.join(Rails.root, 'public')
|
|
20
|
+
puts "INFO: Mirroring assets from #{source} to #{destination}"
|
|
21
|
+
Spree::FileUtilz.mirror_files(source, destination)
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
end
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# Add custom rake tasks here
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
// ######################
|
|
2
|
+
// # PRODUCT COMPARISON #
|
|
3
|
+
// ######################
|
|
4
|
+
|
|
5
|
+
// @param params <Object> : {
|
|
6
|
+
// target <String> : the target object
|
|
7
|
+
// }
|
|
8
|
+
|
|
9
|
+
var ProductComparison = function(params) {
|
|
10
|
+
// ################
|
|
11
|
+
// # DEPENDENCIES #
|
|
12
|
+
// ################
|
|
13
|
+
|
|
14
|
+
if (typeof jQuery == 'undefined') {
|
|
15
|
+
throw new Error('InquiryAsk requires \'jQuery\'.');
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// #############
|
|
19
|
+
// # PARAMETER #
|
|
20
|
+
// #############
|
|
21
|
+
|
|
22
|
+
// if (params.target == undefined) {
|
|
23
|
+
// throw new Error('ProductComparison constructor requires a \'target\'.');
|
|
24
|
+
// }
|
|
25
|
+
|
|
26
|
+
// ######################
|
|
27
|
+
// # PRIVATE ATTRIBUTES #
|
|
28
|
+
// ######################
|
|
29
|
+
|
|
30
|
+
var self = this;
|
|
31
|
+
|
|
32
|
+
// ######################
|
|
33
|
+
// # PRIVILEGED METHODS #
|
|
34
|
+
// ######################
|
|
35
|
+
|
|
36
|
+
/*
|
|
37
|
+
* @privileged
|
|
38
|
+
*
|
|
39
|
+
* init
|
|
40
|
+
*
|
|
41
|
+
* Initialize product comparison
|
|
42
|
+
*/
|
|
43
|
+
this.init = function() {
|
|
44
|
+
_init();
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// ###################
|
|
48
|
+
// # PRIVATE METHODS #
|
|
49
|
+
// ###################
|
|
50
|
+
|
|
51
|
+
/*
|
|
52
|
+
* @private
|
|
53
|
+
*
|
|
54
|
+
* _init
|
|
55
|
+
*
|
|
56
|
+
* Initialize product comparison
|
|
57
|
+
*/
|
|
58
|
+
function _init() {
|
|
59
|
+
_setForm();
|
|
60
|
+
$('input.compare:checkbox').click(_setForm);
|
|
61
|
+
$('form[action*="/t/compare_products"]').submit(_onFormSubmit);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/*
|
|
65
|
+
* @private
|
|
66
|
+
*
|
|
67
|
+
* _setForm
|
|
68
|
+
*/
|
|
69
|
+
function _setForm() {
|
|
70
|
+
var checkedProducts = $('input.compare:checkbox:checked').length; // Get number of checked products
|
|
71
|
+
|
|
72
|
+
_disableIf('form[action*="/t/compare_products"] :submit', (checkedProducts < 2)); // Disable form if less than 2 products are checked
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/*
|
|
76
|
+
* @private
|
|
77
|
+
*
|
|
78
|
+
* _onFormSubmit
|
|
79
|
+
*/
|
|
80
|
+
function _onFormSubmit() {
|
|
81
|
+
var taxon_permalink = $('input#taxon_permalink:hidden').val();
|
|
82
|
+
var product_ids = $.map($('input.compare:checkbox:checked'), function(n) { return n.value; }).join('/');
|
|
83
|
+
|
|
84
|
+
window.location = '/t/' + taxon_permalink + '/compare/' + product_ids;
|
|
85
|
+
|
|
86
|
+
return false;
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
/*
|
|
90
|
+
* @private
|
|
91
|
+
*
|
|
92
|
+
* _disableIf
|
|
93
|
+
*/
|
|
94
|
+
function _disableIf(query, value) {
|
|
95
|
+
$(query).attr('disabled', value);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
_init(); // Initialize product comparison
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
$(document).ready(function() {
|
|
103
|
+
var productComparison = new ProductComparison();
|
|
104
|
+
});
|
data/spec/spec_helper.rb
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# This file is copied to ~/spec when you run 'ruby script/generate rspec'
|
|
2
|
+
# from the project root directory.
|
|
3
|
+
ENV['RAILS_ENV'] ||= 'test'
|
|
4
|
+
|
|
5
|
+
require File.expand_path('../../../config/environment', __FILE__)
|
|
6
|
+
require 'rspec/rails'
|
|
7
|
+
|
|
8
|
+
# Requires supporting files with custom matchers and macros, etc,
|
|
9
|
+
# in ./support/ and its subdirectories.
|
|
10
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
|
11
|
+
|
|
12
|
+
RSpec.configure do |config|
|
|
13
|
+
# == Mock Framework
|
|
14
|
+
#
|
|
15
|
+
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
|
|
16
|
+
#
|
|
17
|
+
# config.mock_with :mocha
|
|
18
|
+
# config.mock_with :flexmock
|
|
19
|
+
# config.mock_with :rr
|
|
20
|
+
config.mock_with :rspec
|
|
21
|
+
|
|
22
|
+
config.fixture_path = "#{::Rails.root}/spec/fixtures"
|
|
23
|
+
|
|
24
|
+
# config.include Devise::TestHelpers, :type => :controller
|
|
25
|
+
|
|
26
|
+
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
|
27
|
+
# examples within a transaction, comment the following line or assign false
|
|
28
|
+
# instead of true.
|
|
29
|
+
config.use_transactional_fixtures = true
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
@configuration ||= AppConfiguration.find_or_create_by_name('Default configuration')
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
|
2
|
+
$:.push File.expand_path('../lib', __FILE__)
|
|
3
|
+
require 'spree_compare_products/version'
|
|
4
|
+
|
|
5
|
+
Gem::Specification.new do |s|
|
|
6
|
+
s.name = 'spree_compare_products'
|
|
7
|
+
s.version = SpreeCompareProducts::VERSION
|
|
8
|
+
s.platform = Gem::Platform::RUBY
|
|
9
|
+
s.authors = [ 'Jorge Calás', 'Maik Kempe' ]
|
|
10
|
+
s.email = [ 'calas@qvitta.net', 'dev@breaking-limits.com' ]
|
|
11
|
+
s.homepage = 'https://github.com/mkempe/spree_compare_products'
|
|
12
|
+
s.summary = %q{Provides product comparison with other products within the same taxon.}
|
|
13
|
+
# s.description = %q{}
|
|
14
|
+
|
|
15
|
+
s.rubyforge_project = 'spree_compare_products'
|
|
16
|
+
|
|
17
|
+
s.files = `git ls-files`.split("\n")
|
|
18
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
|
19
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
|
20
|
+
s.require_paths = [ 'lib' ]
|
|
21
|
+
s.requirements << 'none'
|
|
22
|
+
|
|
23
|
+
s.required_ruby_version = '>= 1.8.7'
|
|
24
|
+
|
|
25
|
+
s.add_dependency('spree_core', '>= 0.40.99')
|
|
26
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: spree_compare_products
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
prerelease: false
|
|
5
|
+
segments:
|
|
6
|
+
- 0
|
|
7
|
+
- 40
|
|
8
|
+
- 90
|
|
9
|
+
version: 0.40.90
|
|
10
|
+
platform: ruby
|
|
11
|
+
authors:
|
|
12
|
+
- "Jorge Cal\xC3\xA1s"
|
|
13
|
+
- Maik Kempe
|
|
14
|
+
autorequire:
|
|
15
|
+
bindir: bin
|
|
16
|
+
cert_chain: []
|
|
17
|
+
|
|
18
|
+
date: 2011-01-20 00:00:00 +03:00
|
|
19
|
+
default_executable:
|
|
20
|
+
dependencies:
|
|
21
|
+
- !ruby/object:Gem::Dependency
|
|
22
|
+
name: spree_core
|
|
23
|
+
prerelease: false
|
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
|
25
|
+
requirements:
|
|
26
|
+
- - ">="
|
|
27
|
+
- !ruby/object:Gem::Version
|
|
28
|
+
segments:
|
|
29
|
+
- 0
|
|
30
|
+
- 40
|
|
31
|
+
- 99
|
|
32
|
+
version: 0.40.99
|
|
33
|
+
type: :runtime
|
|
34
|
+
version_requirements: *id001
|
|
35
|
+
description:
|
|
36
|
+
email:
|
|
37
|
+
- calas@qvitta.net
|
|
38
|
+
- dev@breaking-limits.com
|
|
39
|
+
executables: []
|
|
40
|
+
|
|
41
|
+
extensions: []
|
|
42
|
+
|
|
43
|
+
extra_rdoc_files: []
|
|
44
|
+
|
|
45
|
+
files:
|
|
46
|
+
- .gitignore
|
|
47
|
+
- Gemfile
|
|
48
|
+
- README.markdown
|
|
49
|
+
- Rakefile
|
|
50
|
+
- app/controllers/compare_products_controller.rb
|
|
51
|
+
- app/helpers/compare_products_helper.rb
|
|
52
|
+
- app/metal/bookmarkable_comparison.rb
|
|
53
|
+
- app/views/admin/taxonomies/_comparable_field.html.erb
|
|
54
|
+
- app/views/admin/taxonomies/_list.html.erb
|
|
55
|
+
- app/views/compare_products/show.html.erb
|
|
56
|
+
- app/views/shared/_compare_product_field.html.erb
|
|
57
|
+
- app/views/taxons/_comparable_taxon.html.erb
|
|
58
|
+
- app/views/taxons/_taxon_products.html.erb
|
|
59
|
+
- config/locales/en-US.yml
|
|
60
|
+
- config/locales/es.yml
|
|
61
|
+
- config/locales/pl.yml
|
|
62
|
+
- config/locales/ru.yml
|
|
63
|
+
- config/routes.rb
|
|
64
|
+
- lib/spree_compare_products.rb
|
|
65
|
+
- lib/spree_compare_products/comparable_container.rb
|
|
66
|
+
- lib/spree_compare_products/version.rb
|
|
67
|
+
- lib/spree_compare_products_hooks.rb
|
|
68
|
+
- lib/tasks/install.rake
|
|
69
|
+
- lib/tasks/spree_compare_products.rake
|
|
70
|
+
- public/javascripts/product_comparison.js
|
|
71
|
+
- public/stylesheets/compiled/compare_products.css
|
|
72
|
+
- public/stylesheets/sass/compare_products.sass
|
|
73
|
+
- spec/spec_helper.rb
|
|
74
|
+
- spree_compare_products.gemspec
|
|
75
|
+
has_rdoc: true
|
|
76
|
+
homepage: https://github.com/mkempe/spree_compare_products
|
|
77
|
+
licenses: []
|
|
78
|
+
|
|
79
|
+
post_install_message:
|
|
80
|
+
rdoc_options: []
|
|
81
|
+
|
|
82
|
+
require_paths:
|
|
83
|
+
- lib
|
|
84
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
85
|
+
requirements:
|
|
86
|
+
- - ">="
|
|
87
|
+
- !ruby/object:Gem::Version
|
|
88
|
+
segments:
|
|
89
|
+
- 1
|
|
90
|
+
- 8
|
|
91
|
+
- 7
|
|
92
|
+
version: 1.8.7
|
|
93
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
94
|
+
requirements:
|
|
95
|
+
- - ">="
|
|
96
|
+
- !ruby/object:Gem::Version
|
|
97
|
+
segments:
|
|
98
|
+
- 0
|
|
99
|
+
version: "0"
|
|
100
|
+
requirements:
|
|
101
|
+
- none
|
|
102
|
+
rubyforge_project: spree_compare_products
|
|
103
|
+
rubygems_version: 1.3.6
|
|
104
|
+
signing_key:
|
|
105
|
+
specification_version: 3
|
|
106
|
+
summary: Provides product comparison with other products within the same taxon.
|
|
107
|
+
test_files: []
|
|
108
|
+
|