Module: SolidusFriendlyPromotions::Admin::BenefitsHelper

Defined in:
app/helpers/solidus_friendly_promotions/admin/benefits_helper.rb

Instance Method Summary collapse

Instance Method Details

#options_for_benefit_calculator_types(benefit) ⇒ Object



6
7
8
9
10
# File 'app/helpers/solidus_friendly_promotions/admin/benefits_helper.rb', line 6

def options_for_benefit_calculator_types(benefit)
  calculators = benefit.available_calculators
  options = calculators.map { |calculator| [calculator.model_name.human, calculator.name] }
  options_for_select(options, benefit.calculator_type.to_s)
end

#options_for_benefit_types(benefit) ⇒ Object



12
13
14
15
16
# File 'app/helpers/solidus_friendly_promotions/admin/benefits_helper.rb', line 12

def options_for_benefit_types(benefit)
  benefits = SolidusFriendlyPromotions.config.actions
  options = benefits.map { |action| [action.model_name.human, action.name] }
  options_for_select(options, benefit&.type&.to_s)
end