Module: Decidim::Elections::VotesHelper

Defined in:
decidim-elections/app/helpers/decidim/elections/votes_helper.rb

Overview

Custom helpers for the voting booth views.

Instance Method Summary collapse

Instance Method Details

#more_information?(answer) ⇒ Boolean

Returns:

  • (Boolean)

16
17
18
# File 'decidim-elections/app/helpers/decidim/elections/votes_helper.rb', line 16

def more_information?(answer)
  answer.description || answer.proposals.any? || answer.photos.any?
end

#ordered_answers(question) ⇒ Object


8
9
10
11
12
13
14
# File 'decidim-elections/app/helpers/decidim/elections/votes_helper.rb', line 8

def ordered_answers(question)
  if question.random_answers_order
    question.answers.shuffle
  else
    question.answers.sort_by { |answer| [answer.weight, answer.id] }
  end
end