1
0

_poll.html.haml 959 B

1234567891011121314151617181920212223242526272829
  1. - options = (!poll.expired? && poll.hide_totals?) ? poll.unloaded_options : poll.loaded_options
  2. - voted = user_signed_in? && poll.votes.where(account: current_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.round
  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. - unless poll.expires_at.nil?
  24. ·
  25. %span= l poll.expires_at