Sha256: 01cdf5eec5593e4c9fd08b7e0ad4e4da851b9c0ce27f15e7adf4936bc7382c69

Contents?: true

Size: 441 Bytes

Versions: 26

Compression:

Stored size: 441 Bytes

Contents

module Spree
  module PromotionRulesHelper
    def options_for_promotion_rule_types(promotion)
      existing = promotion.rules.map { |rule| rule.class.name }
      rule_names = Rails.application.config.spree.promotions.rules.map(&:name).reject{ |r| existing.include? r }
      options = rule_names.map { |name| [Spree.t("promotion_rule_types.#{name.demodulize.underscore}.name"), name] }
      options_for_select(options)
    end
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
solidus_backend-2.2.2 app/helpers/spree/promotion_rules_helper.rb
solidus_backend-2.1.1 app/helpers/spree/promotion_rules_helper.rb
solidus_backend-2.0.3 app/helpers/spree/promotion_rules_helper.rb
solidus_backend-1.4.2 app/helpers/spree/promotion_rules_helper.rb
solidus_backend-1.3.2 app/helpers/spree/promotion_rules_helper.rb
solidus_backend-2.0.2 app/helpers/spree/promotion_rules_helper.rb
solidus_backend-1.4.1 app/helpers/spree/promotion_rules_helper.rb
solidus_backend-2.2.1 app/helpers/spree/promotion_rules_helper.rb
solidus_backend-2.2.0 app/helpers/spree/promotion_rules_helper.rb
solidus_backend-2.2.0.rc1 app/helpers/spree/promotion_rules_helper.rb
solidus_backend-2.2.0.beta1 app/helpers/spree/promotion_rules_helper.rb
solidus_backend-2.1.0 app/helpers/spree/promotion_rules_helper.rb
solidus_backend-2.1.0.rc1 app/helpers/spree/promotion_rules_helper.rb
solidus_backend-2.0.1 app/helpers/spree/promotion_rules_helper.rb
solidus_backend-2.1.0.beta1 app/helpers/spree/promotion_rules_helper.rb
solidus_backend-2.0.0 app/helpers/spree/promotion_rules_helper.rb
solidus_backend-1.4.0 app/helpers/spree/promotion_rules_helper.rb
solidus_backend-2.0.0.rc1 app/helpers/spree/promotion_rules_helper.rb
solidus_backend-1.4.0.rc1 app/helpers/spree/promotion_rules_helper.rb
solidus_backend-2.0.0.beta1 app/helpers/spree/promotion_rules_helper.rb