piggybak_variants 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/helpers/piggybak_variants_helper.rb +2 -2
- data/app/models/piggybak_variants/variant.rb +1 -0
- data/app/views/rails_admin/main/_option_values.html.haml +2 -2
- data/lib/piggybak_variants/version.rb +1 -1
- metadata +24 -26
- data/app/controllers/piggybak_variants/application_controller.rb +0 -4
- data/config/routes.rb +0 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 87debeb4647ebc3a7e6ffa3adb0158b4f65026b9
|
4
|
+
data.tar.gz: e9ca3257dbf0f07f6c14c098fc6fa6a450dfbd10
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 07b3afd8787fa1202d218ef1d148d906b80349aa177f117aa3cad827ae2390e7eead251ac2259444623962a27156e8e398528844381a5b423c3bf9d07aedbcde
|
7
|
+
data.tar.gz: e1563ee6e7b7d028635416f8c515016121e5e483419a3b2d7a316860750c63cd23710ecc0bb5e9f0d51342a6485b829c05c468eca76250073f2ab2118d28d244
|
@@ -4,12 +4,12 @@ module PiggybakVariantsHelper
|
|
4
4
|
end
|
5
5
|
|
6
6
|
def options_for_klass(klass)
|
7
|
-
options = ::PiggybakVariants::OptionConfiguration.where(klass: klass).collect { |oc| oc.option }
|
7
|
+
options = ::PiggybakVariants::OptionConfiguration.where(klass: klass).includes(:option).collect { |oc| oc.option }
|
8
8
|
end
|
9
9
|
|
10
10
|
def variant_map(object)
|
11
11
|
map = {}
|
12
|
-
object.variants.available.each do |variant|
|
12
|
+
object.variants.includes(:piggybak_sellable).available.each do |variant|
|
13
13
|
map[variant.option_values.hash_ordered.map { |ov| ov.id }.join('_')] = { :id => variant.piggybak_sellable.id, :price => number_to_currency(variant.piggybak_sellable.price) }
|
14
14
|
end
|
15
15
|
map.to_json
|
@@ -3,6 +3,7 @@ module PiggybakVariants
|
|
3
3
|
acts_as_sellable
|
4
4
|
belongs_to :item, :polymorphic => true
|
5
5
|
has_and_belongs_to_many :option_values, :class_name => "::PiggybakVariants::OptionValue"
|
6
|
+
has_many :options, :through => :option_values
|
6
7
|
|
7
8
|
scope :available, -> { joins(:piggybak_sellable).where(["piggybak_sellables.active = ? AND (piggybak_sellables.quantity > 0 OR piggybak_sellables.unlimited_inventory = ?)",true,true]) }
|
8
9
|
validate :option_value_validation
|
@@ -4,8 +4,8 @@
|
|
4
4
|
|
5
5
|
- options_for_klass(@object.class).each do |option|
|
6
6
|
%h5= option.name
|
7
|
-
= hidden_field_tag "#{@object.class.to_s.
|
7
|
+
= hidden_field_tag "#{@object.class.to_s.underscore}[variants_attributes]#{attr}[option_value_ids][]", nil
|
8
8
|
- option.option_values.each do |option_value|
|
9
9
|
%p
|
10
|
-
= check_box_tag "#{@object.class.to_s.
|
10
|
+
= check_box_tag "#{@object.class.to_s.underscore}[variants_attributes]#{attr}[option_value_ids][]", option_value.id, form.object.option_values.include?(option_value), :style => "margin:-2px 5px 0px 0px;"
|
11
11
|
%span= option_value.name
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: piggybak_variants
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tim Case, Steph Skardal
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-05-06 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Advanced variant support for Piggybak.
|
14
14
|
email:
|
@@ -22,7 +22,6 @@ files:
|
|
22
22
|
- Rakefile
|
23
23
|
- app/assets/javascripts/piggybak_variants/piggybak_variants-application.js
|
24
24
|
- app/assets/javascripts/piggybak_variants/piggybak_variants.js
|
25
|
-
- app/controllers/piggybak_variants/application_controller.rb
|
26
25
|
- app/helpers/piggybak_variants_helper.rb
|
27
26
|
- app/models/piggybak_variants/option.rb
|
28
27
|
- app/models/piggybak_variants/option_configuration.rb
|
@@ -31,7 +30,6 @@ files:
|
|
31
30
|
- app/views/piggybak_variants/cart/_dropdowns_form.html.erb
|
32
31
|
- app/views/piggybak_variants/cart/_radio_buttons_form.html.erb
|
33
32
|
- app/views/rails_admin/main/_option_values.html.haml
|
34
|
-
- config/routes.rb
|
35
33
|
- db/migrate/20121015144538_create_new_variants.rb
|
36
34
|
- db/migrate/20121016150359_create_options.rb
|
37
35
|
- db/migrate/20121016153016_create_option_values.rb
|
@@ -97,34 +95,34 @@ signing_key:
|
|
97
95
|
specification_version: 4
|
98
96
|
summary: Advanced variant support for Piggybak.
|
99
97
|
test_files:
|
100
|
-
- test/integration/navigation_test.rb
|
101
|
-
- test/piggybak_variants_test.rb
|
102
|
-
- test/test_helper.rb
|
103
|
-
- test/dummy/script/rails
|
104
98
|
- test/dummy/Rakefile
|
105
|
-
- test/dummy/README.rdoc
|
106
|
-
- test/dummy/app/controllers/application_controller.rb
|
107
|
-
- test/dummy/app/assets/stylesheets/application.css
|
108
99
|
- test/dummy/app/assets/javascripts/application.js
|
100
|
+
- test/dummy/app/assets/stylesheets/application.css
|
101
|
+
- test/dummy/app/controllers/application_controller.rb
|
109
102
|
- test/dummy/app/helpers/application_helper.rb
|
110
103
|
- test/dummy/app/views/layouts/application.html.erb
|
111
|
-
- test/dummy/config
|
112
|
-
- test/dummy/
|
113
|
-
- test/dummy/
|
114
|
-
- test/dummy/
|
115
|
-
- test/dummy/
|
116
|
-
- test/dummy/
|
117
|
-
- test/dummy/config/
|
118
|
-
- test/dummy/config/initializers/secret_token.rb
|
119
|
-
- test/dummy/config/initializers/mime_types.rb
|
104
|
+
- test/dummy/config.ru
|
105
|
+
- test/dummy/public/500.html
|
106
|
+
- test/dummy/public/404.html
|
107
|
+
- test/dummy/public/422.html
|
108
|
+
- test/dummy/public/favicon.ico
|
109
|
+
- test/dummy/script/rails
|
110
|
+
- test/dummy/config/boot.rb
|
120
111
|
- test/dummy/config/initializers/session_store.rb
|
121
112
|
- test/dummy/config/initializers/backtrace_silencers.rb
|
113
|
+
- test/dummy/config/initializers/secret_token.rb
|
114
|
+
- test/dummy/config/initializers/wrap_parameters.rb
|
122
115
|
- test/dummy/config/initializers/inflections.rb
|
123
|
-
- test/dummy/config/
|
116
|
+
- test/dummy/config/initializers/mime_types.rb
|
117
|
+
- test/dummy/config/routes.rb
|
118
|
+
- test/dummy/config/locales/en.yml
|
124
119
|
- test/dummy/config/application.rb
|
120
|
+
- test/dummy/config/environments/development.rb
|
121
|
+
- test/dummy/config/environments/production.rb
|
122
|
+
- test/dummy/config/environments/test.rb
|
123
|
+
- test/dummy/config/environment.rb
|
125
124
|
- test/dummy/config/database.yml
|
126
|
-
- test/dummy/
|
127
|
-
- test/
|
128
|
-
- test/
|
129
|
-
- test/
|
130
|
-
- test/dummy/config.ru
|
125
|
+
- test/dummy/README.rdoc
|
126
|
+
- test/integration/navigation_test.rb
|
127
|
+
- test/test_helper.rb
|
128
|
+
- test/piggybak_variants_test.rb
|
data/config/routes.rb
DELETED