Module: EffectiveActsAsPurchasableHelper
- Defined in:
- app/helpers/effective_acts_as_purchasable_helper.rb
Instance Method Summary collapse
- #acts_as_purchasable_fields(form, options = {}) ⇒ Object
-
#acts_as_purchasable_path(purchasable, action = :show) ⇒ Object
This is called on the My Sales Page and is intended to be overridden in the app if needed.
- #qb_item_name_field(form, options = {}) ⇒ Object
- #qb_item_name_label ⇒ Object
- #qb_item_names_label ⇒ Object
Instance Method Details
#acts_as_purchasable_fields(form, options = {}) ⇒ Object
2 3 4 5 |
# File 'app/helpers/effective_acts_as_purchasable_helper.rb', line 2 def acts_as_purchasable_fields(form, = {}) raise 'expected a form builder' unless form.respond_to?(:object) render('effective/acts_as_purchasable/fields', { form: form }.merge()) end |
#acts_as_purchasable_path(purchasable, action = :show) ⇒ Object
This is called on the My Sales Page and is intended to be overridden in the app if needed
31 32 33 |
# File 'app/helpers/effective_acts_as_purchasable_helper.rb', line 31 def acts_as_purchasable_path(purchasable, action = :show) polymorphic_path(purchasable) end |
#qb_item_name_field(form, options = {}) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'app/helpers/effective_acts_as_purchasable_helper.rb', line 7 def qb_item_name_field(form, = {}) 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) = .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')}", required: EffectiveOrders.require_item_names? ) form.select :qb_item_name, collection, end |
#qb_item_name_label ⇒ Object
22 23 24 |
# File 'app/helpers/effective_acts_as_purchasable_helper.rb', line 22 def qb_item_name_label EffectiveOrders.quickbooks? ? "Quickbooks #{etd(Effective::ItemName)}" : et(Effective::ItemName) end |
#qb_item_names_label ⇒ Object
26 27 28 |
# File 'app/helpers/effective_acts_as_purchasable_helper.rb', line 26 def qb_item_names_label EffectiveOrders.quickbooks? ? "Quickbooks #{etsd(Effective::ItemName)}" : ets(Effective::ItemName) end |