app/helpers/decidim/proposals/application_helper.rb in decidim-proposals-0.0.2 vs app/helpers/decidim/proposals/application_helper.rb in decidim-proposals-0.0.3
- old
+ new
@@ -5,8 +5,25 @@
#
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