You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
1.1 KiB

  1. - show_results = (user_signed_in? && poll.voted?(current_account)) || poll.expired?
  2. - own_votes = user_signed_in? ? poll.own_votes(current_account) : []
  3. .poll
  4. %ul
  5. - poll.loaded_options.each_with_index do |option, index|
  6. %li
  7. - if show_results
  8. - percent = poll.votes_count > 0 ? 100 * option.votes_count / poll.votes_count : 0
  9. %span.poll__chart{ style: "width: #{percent}%" }
  10. %label.poll__text><
  11. %span.poll__number><
  12. - if own_votes.include?(index)
  13. %i.poll__vote__mark.fa.fa-check
  14. = percent.round
  15. = Formatter.instance.format_poll_option(status, option, autoplay: autoplay)
  16. - else
  17. %label.poll__text><
  18. %span.poll__input{ class: poll.multiple? ? 'checkbox' : nil}><
  19. = Formatter.instance.format_poll_option(status, option, autoplay: autoplay)
  20. .poll__footer
  21. - unless show_results
  22. %button.button.button-secondary{ disabled: true }
  23. = t('statuses.poll.vote')
  24. %span= t('statuses.poll.total_votes', count: poll.votes_count)
  25. - unless poll.expires_at.nil?
  26. ·
  27. %span= l poll.expires_at