Module: EffectiveMembershipsHelper
- Defined in:
- app/helpers/effective_memberships_helper.rb
Instance Method Summary collapse
- #effective_memberships_select_applicant_organization_collection(resource) ⇒ Object
-
#effective_memberships_select_fee_payment_organization(resource) ⇒ Object
This is the select yourself or organization field on FeePayments#start.
- #effective_memberships_status_collection ⇒ Object
Instance Method Details
#effective_memberships_select_applicant_organization_collection(resource) ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'app/helpers/effective_memberships_helper.rb', line 11 def effective_memberships_select_applicant_organization_collection(resource) user = (resource.respond_to?(:user) ? resource.user : resource) raise('expected an effective memberships user') unless user.class.try(:effective_memberships_user?) representatives = user.representatives.select { |rep| rep.is?(:owner) || rep.is?(:billing) } organizations = representatives.map { |rep| [rep.organization.to_s, rep.organization.id] } organizations + [['New Organization...', 'new']] end |
#effective_memberships_select_fee_payment_organization(resource) ⇒ Object
This is the select yourself or organization field on FeePayments#start
22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'app/helpers/effective_memberships_helper.rb', line 22 def effective_memberships_select_fee_payment_organization(resource) user = (resource.respond_to?(:user) ? resource.user : resource) raise('expected an effective memberships user') unless user.class.try(:effective_memberships_user?) owners = user.memberships_owners.select { |owner| owner.outstanding_fee_payment_fees.present? } owners.map do |owner| [ owner.to_s, (owner.to_param if owner.kind_of?(EffectiveMemberships.Organization)) # Nil when user ] end end |
#effective_memberships_status_collection ⇒ Object
3 4 5 6 7 8 9 |
# File 'app/helpers/effective_memberships_helper.rb', line 3 def effective_memberships_status_collection EffectiveMemberships.Applicant::STATUSES.map do |status| next if status == :reviewed && !EffectiveMemberships.applicant_reviews? [status.to_s.gsub('_', ' '), status] end.compact end |