Skip to content

Commit

Permalink
made some possibly-unecessary changes to the way the calculators are …
Browse files Browse the repository at this point in the history
…set up
  • Loading branch information
jsqu99 committed Nov 21, 2013
1 parent 221e3fd commit b4d1f18
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
2 changes: 2 additions & 0 deletions app/models/spree/calculator/customization_image.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require_dependency 'spree/calculator'

module Spree
class Calculator::CustomizationImage < Calculator
preference :price, :decimal
Expand Down
2 changes: 2 additions & 0 deletions app/models/spree/calculator/engraving.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require_dependency 'spree/calculator'

module Spree
class Calculator::Engraving < Calculator
preference :price_per_letter, :decimal
Expand Down
2 changes: 2 additions & 0 deletions app/models/spree/calculator/no_charge.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require_dependency 'spree/calculator'

module Spree
class Calculator::NoCharge < Calculator
def self.description
Expand Down
13 changes: 4 additions & 9 deletions lib/spree_flexi_variants/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,16 @@ def self.activate
initializer "spree.flexi_variants.assets.precompile" do |app|
app.config.assets.precompile += ['store/spree_flexi_variants_exclusions.js','admin/orders/flexi_configuration.js','store/spree-flexi-variants.*']
end
# Had a good reason for this rescue below, and wish I'd commented it better when I wrote it
# TODO - figure this out and de-ugly
begin
initializer "spree.register.calculators" do |app|
app.config.spree.calculators.add_class('product_customization_types')
app.config.spree.calculators.product_customization_types = [

initializer "spree.flexi_variants.register.calculators" do |app|
app.config.spree.calculators.add_class('product_customization_types')
app.config.spree.calculators.product_customization_types = [
Spree::Calculator::Engraving,
Spree::Calculator::AmountTimesConstant,
Spree::Calculator::ProductArea,
Spree::Calculator::CustomizationImage,
Spree::Calculator::NoCharge
]
end
rescue => problem
puts "intentionally ignoring problem in calculator registration #{problem}"
end
end
end

3 comments on commit b4d1f18

@qinghe
Copy link

@qinghe qinghe commented on b4d1f18 Sep 10, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i am curious, is no_charge calculator usable now?
why it has no customizable_product_option?

@jsqu99
Copy link
Owner Author

@jsqu99 jsqu99 commented on b4d1f18 Sep 10, 2014 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@qinghe
Copy link

@qinghe qinghe commented on b4d1f18 Sep 11, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

however thanks for you response. thanks for your work and share.

Please sign in to comment.