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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 974b650d16ee057bba72c9366c5d4b7942f1efc1
4
- data.tar.gz: bf3f13b6c8fadce6fe36c9848feccfd01ba2f6ac
3
+ metadata.gz: 87debeb4647ebc3a7e6ffa3adb0158b4f65026b9
4
+ data.tar.gz: e9ca3257dbf0f07f6c14c098fc6fa6a450dfbd10
5
5
  SHA512:
6
- metadata.gz: 9e6191beaa9c9b397c01bc4ac02c34e6af43f985404e4f74d5f09b219acc7b366a47419e0c136a4026f4717a58ba08a1b1cbf1839549f8ecc47619441d368dbd
7
- data.tar.gz: a7ce4b1db46fbc2fa48542266bede6e8a7f818c3602e69772668829ff5e64eb3d4e10df2c3d107005665914d6a1da5af3f03387b2be1ec0f826afd85b89dd00a
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.downcase}[variants_attributes]#{attr}[option_value_ids][]", nil
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.downcase}[variants_attributes]#{attr}[option_value_ids][]", option_value.id, form.object.option_values.include?(option_value), :style => "margin:-2px 5px 0px 0px;"
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
@@ -1,3 +1,3 @@
1
1
  module PiggybakVariants
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
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.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-04-07 00:00:00.000000000 Z
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/locales/en.yml
112
- - test/dummy/config/environment.rb
113
- - test/dummy/config/routes.rb
114
- - test/dummy/config/environments/production.rb
115
- - test/dummy/config/environments/test.rb
116
- - test/dummy/config/environments/development.rb
117
- - test/dummy/config/initializers/wrap_parameters.rb
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/boot.rb
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/public/500.html
127
- - test/dummy/public/422.html
128
- - test/dummy/public/favicon.ico
129
- - test/dummy/public/404.html
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
@@ -1,4 +0,0 @@
1
- module PiggybakVariants
2
- class ApplicationController < ActionController::Base
3
- end
4
- end
data/config/routes.rb DELETED
@@ -1,2 +0,0 @@
1
- PiggybakVariants::Engine.routes.draw do
2
- end