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.

27 lines
976 B

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