Sha256: 8d6b614a5841b0966f40cf8cedb204c7556b16ddfcb8c36621b5d62d5836feb1

Contents?: true

Size: 504 Bytes

Versions: 25

Compression:

Stored size: 504 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Elections
    # Custom helpers for the voting booth views.
    #
    module VotesHelper
      def ordered_answers(question)
        if question.random_answers_order
          question.answers.shuffle
        else
          question.answers.sort_by { |answer| [answer.weight, answer.id] }
        end
      end

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

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
decidim-elections-0.26.1 app/helpers/decidim/elections/votes_helper.rb
decidim-elections-0.26.0 app/helpers/decidim/elections/votes_helper.rb
decidim-elections-0.26.0.rc2 app/helpers/decidim/elections/votes_helper.rb
decidim-elections-0.26.0.rc1 app/helpers/decidim/elections/votes_helper.rb
decidim-elections-0.25.2 app/helpers/decidim/elections/votes_helper.rb
decidim-elections-0.25.1 app/helpers/decidim/elections/votes_helper.rb
decidim-elections-0.25.0 app/helpers/decidim/elections/votes_helper.rb
decidim-elections-0.25.0.rc4 app/helpers/decidim/elections/votes_helper.rb
decidim-elections-0.25.0.rc3 app/helpers/decidim/elections/votes_helper.rb
decidim-elections-0.25.0.rc2 app/helpers/decidim/elections/votes_helper.rb
decidim-elections-0.25.0.rc1 app/helpers/decidim/elections/votes_helper.rb
decidim-elections-0.24.3 app/helpers/decidim/elections/votes_helper.rb
decidim-elections-0.23.6 app/helpers/decidim/elections/votes_helper.rb
decidim-elections-0.24.2 app/helpers/decidim/elections/votes_helper.rb
decidim-elections-0.23.5 app/helpers/decidim/elections/votes_helper.rb
decidim-elections-0.24.1 app/helpers/decidim/elections/votes_helper.rb
decidim-elections-0.24.0 app/helpers/decidim/elections/votes_helper.rb
decidim-elections-0.24.0.rc2 app/helpers/decidim/elections/votes_helper.rb
decidim-elections-0.23.4 app/helpers/decidim/elections/votes_helper.rb
decidim-elections-0.24.0.rc1 app/helpers/decidim/elections/votes_helper.rb