opengovernment/askthem

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

Summary

Maintainability
Test Coverage
<article id="content-step" <%= step_class_for(step, relevant_steps) -%>>
  <header>
    <h1 class="action">Ask a Question</h1>
    <p class="ref"><span class="emph">Question for:</p>
      <span id="content-person-image" class="content-person-image">
        <% if person -%>
          <%= cdn_image_tag(person.image, size: "30x30",
          alt: "image of #{person.name}", class: "official-image avatar-image") %>
        <% end -%>
      </span>
      <div class='content-person-info'>
        <span id="content-person-name"><%= "#{person.name}" if person -%><%= "," if bill -%></span>
        <span id="content-person-short-description"><%= person_attributes_short(person) if person -%></span>
      </div>
      <% if bill -%>
        <span class="emph">re:</span> <span class="bill-title"><%= short_bill_title(bill) -%></span>
      <% end -%>
    </span>
  </header>
  <fieldset>
    <label for="question_title"></label>
    <div class="count">
      <span class="summary_count">100</span>
      <%= f.text_area :title, placeholder: raw('Summary&hellip;'), maxlength: '100', cols: '30', rows: '2', validate: true, class: 'question-title' %>
    </div>

    <label for="question_body">
      <%- if !@from_partner || @referring_partner_info[:name] != "HonestAds" %>
        Full Question (optional)
      <%- end %>
      <span class="question_details">Why is this important?<%- if !@from_partner %> Give it your all!<%- end %></span>
    </label>

    <%= f.text_area :body, placeholder: raw('Go on&hellip;'), cols: '30', rows: '10', validate: true, class: 'question-textarea' %>
    <span class="tip question">
      Add image or video links to show them. Twitter #hashtags work too.
    </span>

    <%- if !@from_partner || @referring_partner_info[:name] != "HonestAds" %>
      <div class="input select icon-angle-down sculpt">
        <% subject_options = raw('<option value="">Select an Issue (optional)</option>') + options_for_select(Subject.all) -%>
        <%= f.select :subject, subject_options %>
      </div>
    <%- end %>

    <%# #@todo functionality needs to be tied in, gave method :subject for now, but probably should be :media -%>
    <label for="question_media">Add a photo to accompany your question</label>
    <div>
      <%= f.file_field :media, class: 'question_media' %>
      <%= f.text_field :media_file_url, placeholder: raw('Or paste a link to a photo') %>
    </div>
  </fieldset>
</article>