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.

25 lines
883 B

  1. - options = (!poll.expired? && poll.hide_totals?) ? poll.unloaded_options : poll.loaded_options
  2. - voted = poll.votes.where(account: current_user.account).exists?
  3. - show_results = voted || poll.expired?
  4. .poll
  5. %ul
  6. - options.each do |option|
  7. %li
  8. - if show_results
  9. - percent = 100 * option.votes_count / poll.votes_count
  10. %span.poll__chart{ style: "width: #{percent}%" }
  11. %label.poll__text><
  12. %span.poll__number= percent
  13. = option.title
  14. - else
  15. %label.poll__text><
  16. %span.poll__input{ class: poll.multiple ? 'checkbox' : nil}><
  17. = option.title
  18. .poll__footer
  19. - unless show_results
  20. %button.button.button-secondary{ disabled: true }
  21. = t('statuses.poll.vote')
  22. %span= t('statuses.poll.total_votes', count: poll.votes_count)
  23. ·
  24. %span= poll.expires_at