Module: CouponsHelper
- Defined in:
- app/helpers/coupons_helper.rb
Instance Method Summary collapse
- #coupon_commands(coupon = @coupon) ⇒ Object
- #coupon_edit_tab_options(f) ⇒ Object
- #coupon_show_tab_options(coupon = @coupon) ⇒ Object
Instance Method Details
#coupon_commands(coupon = @coupon) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 |
# File 'app/helpers/coupons_helper.rb', line 28 def coupon_commands(coupon = @coupon) return [] unless can?(:update, coupon) cmds = [ link_to('Edit', edit_coupon_path(coupon)), link_to('Clone', clone_coupon_path(coupon)), link_to('Destroy', coupon_path(coupon), data: { turbo_method: :delete }) ] cmds << link_to('Publish/Synchronize Promo Items', synchronize_promo_items_coupon_path(coupon), data: { turbo_method: :post }) if coupon.promo_tracking cmds end |
#coupon_edit_tab_options(f) ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'app/helpers/coupons_helper.rb', line 18 def (f) { basic_attributes: { partial: 'edit_basic_attributes', locals: { f: f } }, calculations: { partial: 'edit_calculations', locals: { f: f } }, restrictions: { partial: 'edit_restrictions', locals: { f: f } }, serial_numbers: { partial: 'edit_serial_numbers', locals: { f: f } }, product_filters: { partial: 'edit_product_filters', locals: { f: f } }, special_actions: { partial: 'edit_special_actions', locals: { f: f } }} end |
#coupon_show_tab_options(coupon = @coupon) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'app/helpers/coupons_helper.rb', line 3 def (coupon=@coupon) hsh = { basic_attributes: { remote_href: tab_basic_attributes_coupon_path(coupon) }, calculations: { remote_href: tab_calculations_coupon_path(coupon) }, restrictions: { remote_href: tab_restrictions_coupon_path(coupon) }, serial_numbers: { remote_href: tab_serial_numbers_coupon_path(coupon) }, product_filters: { remote_href: tab_product_filters_coupon_path(coupon) }, promotional_items: { remote_href: tab_promotional_items_coupon_path(coupon) }, special_actions: { remote_href: tab_special_actions_coupon_path(coupon) }, statistics: { remote_href: tab_statistics_coupon_path(coupon) } } hsh.delete(:promotional_items) unless coupon.promo_tracking hsh end |