Sha256: a6bcd0ecd84bd84b0141c9370acafe3df74fafc684728980f2f62f4536a78984

Contents?: true

Size: 882 Bytes

Versions: 4

Compression:

Stored size: 882 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
      include ProposalOrderHelper
      include Decidim::MapHelper
      include Decidim::Proposals::MapHelper

      # 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

4 entries across 4 versions & 2 rubygems

Version Path
decidim-proposals-0.0.7 app/helpers/decidim/proposals/application_helper.rb
decidim-0.0.7 decidim-proposals/app/helpers/decidim/proposals/application_helper.rb
decidim-proposals-0.0.6 app/helpers/decidim/proposals/application_helper.rb
decidim-0.0.6 decidim-proposals/app/helpers/decidim/proposals/application_helper.rb