integrallis/stripe_saas

View on GitHub
app/helpers/stripe_saas/application_helper.rb

Summary

Maintainability
A
0 mins
Test Coverage
module StripeSaas
  module ApplicationHelper
    include MoneyRails::ActionViewExtension

    def plan_price(plan)
      "#{humanized_money_with_symbol(plan.price, :no_cents => false)}/#{plan_interval(plan)}"
    end

    def plan_interval(plan)
      case plan.interval
      when "month"
        "month"
      when "year"
        "year"
      when "week"
        "week"
      when "6-month"
        "half-year"
      when "3-month"
        "quarter"
      else
        "month"
      end
    end
  end
end