Module: PaidUp::FeaturesHelper
- Includes:
- PaidUpHelper
- Defined in:
- app/helpers/paid_up/features_helper.rb
Instance Method Summary collapse
- #feature_abilities_table(options = {}) ⇒ Object
- #feature_display(feature, plan) ⇒ Object
- #features_dl(plan) ⇒ Object
- #features_table(options = {}) ⇒ Object
Methods included from PaidUpHelper
Instance Method Details
#feature_abilities_table(options = {}) ⇒ Object
60 61 62 63 |
# File 'app/helpers/paid_up/features_helper.rb', line 60 def feature_abilities_table( = {}) features = PaidUp::Feature.all render(partial: 'paid_up/features/abilities_table', locals: { features: features, html_options: }) end |
#feature_display(feature, plan) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'app/helpers/paid_up/features_helper.rb', line 16 def feature_display(feature, plan) if feature.setting_type == 'boolean' if plan.feature_setting(feature.slug) icon 'ok' else icon 'remove' end elsif plan.feature_unlimited?(feature.slug) :unlimited.l else plan.feature_setting(feature.slug) end end |
#features_dl(plan) ⇒ Object
5 6 7 8 9 10 11 12 13 14 |
# File 'app/helpers/paid_up/features_helper.rb', line 5 def features_dl(plan) data = {} features = PaidUp::Feature.all for feature in features data[feature.title] = feature_display feature, plan end dl data end |
#features_table(options = {}) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'app/helpers/paid_up/features_helper.rb', line 30 def features_table( = {}) features = PaidUp::Feature.all if ![:should_add_buttons].nil? = [:should_add_buttons] .delete(:should_add_buttons) else = true end plans = PaidUp::Plan.subscribable if [:only].present? plans = plans.where('id IN (?)', [:only]) .delete(:only) end if [:except].present? plans = plans.where('NOT ( id IN (?) )', [:except]) .delete(:except) end if [:highlight].present? highlight_plan = [:highlight] .delete(:highlight) else highlight_plan = nil end render(partial: 'paid_up/features/table', locals: { should_add_buttons: , plans: plans, features: features, highlight_plan: highlight_plan, html_options: }) end |