Sha256: 678e3c7967197058eac85290ae04a2939299755ee689fc4362a5fb0ceb9e7e1e

Contents?: true

Size: 771 Bytes

Versions: 5

Compression:

Stored size: 771 Bytes

Contents

# frozen_string_literal: true
module Decidim
  module Proposals
    # Custom helpers, scoped to the proposals engine.
    #
    module ApplicationHelper
      include Decidim::Comments::CommentsHelper
      include PaginateHelper
      include ProposalVotesHelper

      # Public: The state of a proposal in a way a human can understand.
      #
      # state - The String state of the proposal.
      #
      # Returns a String.
      def humanize_proposal_state(state)
        value = if state == "accepted"
                  "accepted"
                elsif state == "rejected"
                  "rejected"
                else
                  "not_answered"
                end

        I18n.t(value, scope: "decidim.proposals.answers")
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
decidim-proposals-0.0.5 app/helpers/decidim/proposals/application_helper.rb
decidim-0.0.5 decidim-proposals/app/helpers/decidim/proposals/application_helper.rb
decidim-0.0.4 decidim-proposals/app/helpers/decidim/proposals/application_helper.rb
decidim-proposals-0.0.3 app/helpers/decidim/proposals/application_helper.rb
decidim-0.0.3 decidim-proposals/app/helpers/decidim/proposals/application_helper.rb