Sha256: 21a01b00a4701ec0449a4a1ee9df706fe462bd91b2903419f7df08da97fe7d35

Contents?: true

Size: 854 Bytes

Versions: 13

Compression:

Stored size: 854 Bytes

Contents

# frozen_string_literal: true
module Decidim
  module Budgets
    # A helper to render order and budgets actions
    module ProjectsHelper
      # Render a budget as a currency
      #
      # budget - A integer to represent a budget
      def budget_to_currency(budget)
        number_to_currency budget, unit: Decidim.currency_unit, precision: 0
      end

      # Return a percentage of the current order budget from the total budget
      def current_order_budget_percent
        current_order&.budget_percent.to_f.floor
      end

      # Return true if the current order is checked out
      def current_order_checked_out?
        current_order&.checked_out?
      end

      # Return true if the user can continue to the checkout process
      def current_order_can_be_checked_out?
        current_order&.can_checkout?
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 2 rubygems

Version Path
decidim-budgets-0.1.0 app/helpers/decidim/budgets/projects_helper.rb
decidim-0.1.0 decidim-budgets/app/helpers/decidim/budgets/projects_helper.rb
decidim-budgets-0.0.8.1 app/helpers/decidim/budgets/projects_helper.rb
decidim-0.0.8.1 decidim-budgets/app/helpers/decidim/budgets/projects_helper.rb
decidim-budgets-0.0.7 app/helpers/decidim/budgets/projects_helper.rb
decidim-0.0.7 decidim-budgets/app/helpers/decidim/budgets/projects_helper.rb
decidim-budgets-0.0.6 app/helpers/decidim/budgets/projects_helper.rb
decidim-0.0.6 decidim-budgets/app/helpers/decidim/budgets/projects_helper.rb
decidim-budgets-0.0.5 app/helpers/decidim/budgets/projects_helper.rb
decidim-0.0.5 decidim-budgets/app/helpers/decidim/budgets/projects_helper.rb
decidim-0.0.4 decidim-budgets/app/helpers/decidim/budgets/projects_helper.rb
decidim-budgets-0.0.3 app/helpers/decidim/budgets/projects_helper.rb
decidim-0.0.3 decidim-budgets/app/helpers/decidim/budgets/projects_helper.rb