Sha256: 40da78ca1b6e959dab84da8299dc7d1d112ffd4ed5ed0dad794b8b05fdd6e602
Contents?: true
Size: 1.16 KB
Versions: 15
Compression:
Stored size: 1.16 KB
Contents
module EffectiveActsAsPurchasableHelper def acts_as_purchasable_fields(form, options = {}) raise 'expected a form builder' unless form.respond_to?(:object) render('effective/acts_as_purchasable/fields', { form: form }.merge(options)) end def qb_item_name_field(form, options = {}) raise 'expected a form builder' unless form.respond_to?(:object) raise 'expected an object that responds to qb_item_name' unless form.object.respond_to?(:qb_item_name) collection = Effective::ItemName.unarchived.or(Effective::ItemName.where(name: form.object.qb_item_name.to_s)).sorted.pluck(:name) options = options.reverse_merge( label: (EffectiveOrders.quickbooks? ? "Quickbooks #{etd(Effective::ItemName)}" : et(Effective::ItemName)), hint: "Can't find the #{etd(Effective::ItemName)} you need? #{link_to('Click here to add one', effective_orders.admin_item_names_path, target: '_blank')}" ) form.select :qb_item_name, collection, options end # This is called on the My Sales Page and is intended to be overridden in the app if needed def acts_as_purchasable_path(purchasable, action = :show) polymorphic_path(purchasable) end end
Version data entries
15 entries across 15 versions & 1 rubygems