lib/spree_mobility.rb in spree_mobility-1.1.0 vs lib/spree_mobility.rb in spree_mobility-1.2.0

- old
+ new

@@ -7,17 +7,17 @@ module SpreeMobility def self.prepend_once(to_klass, klass) to_klass.prepend(klass) unless to_klass.ancestors.include?(klass) end - + def self.clear_validations_for(klass, *attrs) attrs.each do |attr| klass.validators_on(attr).each { |val| val.attributes.delete(attr) } end end - + def self.translates_for(klass, *attrs) klass.translates(*attrs) klass.accepts_nested_attributes_for :translations klass.whitelisted_ransackable_associations ||= [] klass.whitelisted_ransackable_associations << 'translations' @@ -42,6 +42,22 @@ result.uniq! rescue KeyError # backend not found end result end -end \ No newline at end of file + + def self.product_wysiwyg_editor_enabled? + spree_backend_config :product_wysiwyg_editor_enabled + end + + def self.taxon_wysiwyg_editor_enabled? + spree_backend_config :taxon_wysiwyg_editor_enabled + end + + def self.spree_backend_config(key) + if defined?(Spree::Backend::Config) && Spree::Backend::Config.has_preference?(key) + Spree::Backend::Config[key] + else + Spree::Config[key] + end + end +end