Module: MembershipTypesHelper

Defined in:
app/helpers/membership_types_helper.rb

Instance Method Summary collapse

Instance Method Details

#membership_type_storefront_path(membership_type) ⇒ Object



2
3
4
# File 'app/helpers/membership_types_helper.rb', line 2

def membership_type_storefront_path(membership_type)
  url_for(organization_slug: membership_type.organization.cached_slug, controller: 'store/memberships', action: 'show', id: membership_type.id)
end

#options_for_membership_types(types, opts = {}) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'app/helpers/membership_types_helper.rb', line 6

def options_for_membership_types(types, opts={})
  default_options = {
    :include_price => false
  }
  options = default_options
  options = options.merge(opts) unless opts.blank?

  items = types.map do |type|
    name = type.name
    name << (' - $%.2f' % number_to_dollars(type.price)) if options[:include_price]

    [name, type.id]
  end

  options_for_select items
end