opengovernment/askthem

View on GitHub
app/views/questions/new.html.erb

Summary

Maintainability
Test Coverage
<section class="question ask">
  <%= form_for @question, url: questions_path(@state_code), validate: true, html: { accept_charset: 'utf-8' } do |f| %>
    <%= f.hidden_field :user_id if user_signed_in? %>
    <%= f.hidden_field :person_id %>
    <%= f.hidden_field :bill_id %>
    <%= f.validate :person_id %>

    <% @question.errors.full_messages.each do |message| -%>
      <p class="alert"><%= message -%></p>
    <% end -%>

    <% locals = { jurisdiction: @jurisdiction, question: @question, person: @person, bill: @bill, relevant_steps: @relevant_steps, first_step: @first_step, f: f } -%>

    <% @relevant_steps.each do |step| %>
      <%= render partial: "#{step}_step", locals: locals.merge({ step: step }) %>
    <% end %>

    <div class="controls">
      <a class="cta-pill" id="next-button"
         data-relevant-steps="<%= @relevant_steps.join(', ') -%>"
         data-current-step="<%= @first_step -%>">Next
        <span class="icon-caret-right"></span></a>
        <span class="count"><span class="step-number">1</span> of <%= @relevant_steps.size %></span>
    </div>

    <div class="click-recipient-for-next-step" style="display:none;">
      <h3>Click on recipient for the next step</h3>
    </div>

  <% end %>
</section>