-if user_signed_in?
  -poll = current_user.next_unanswered_poll
  -if poll.present?
    .polls{'data-id' => poll.id}
      -if poll.present?
        %h2 Poll:#{poll.question}
        /%p=poll.description

        -answers = poll.answers
        -answer = UserAnswer.new
        -answer.user_id = current_user.id
        = form_for :answer, :url => "/polls/answer", :remote => true do |f|
          %ul
            -answers.each do |answer|
              = answer_list_item(f, answer).html_safe
          = f.hidden_field :poll_id, :value => poll.id
          = f.submit "Vote", :class => "small_button"
  -else
    .polls
      %h2 Polls
      Please watch the statistics

  -if previous_poll.present?
    .poll-result
      %p Poll result
      %h3=previous_poll.try(:question)
      =render :partial => 'polls/stats', :locals => {:poll => previous_poll}

-else
  .polls
    %h2 Polls
    Please
    %a{:href => "#", "data-reveal-id" => "LoginModal"} sign in





-poll = current_user.next_unanswered_poll
-if poll.present?
  .polls{'data-id' => poll.id}
    -if poll.present?
      %h2 Poll:#{poll.question}
      /%p=poll.description

      -answers = poll.answers
      -answer = UserAnswer.new
      -answer.user_id = current_user.id
      = form_for :answer, :url => "/polls/answer", :remote => true do |f|
        %ul
          -answers.each do |answer|
            = answer_list_item(f, answer).html_safe
        = f.hidden_field :poll_id, :value => poll.id
        = f.submit "Vote", :class => "small_button"
-else
  .polls
    %h2 Polls
    Please watch the statistics

-if previous_poll.present?
  .poll-result
    %p Poll result
    %h3=previous_poll.try(:question)
    =render :partial => 'polls/stats', :locals => {:poll => previous_poll}

Refactor out auth logic from poll view-template
Refactor out auth logic from poll view-template

Auth logic handled at controller level in previous commit.
