opengovernment/askthem

View on GitHub
app/views/bills/show.html.erb

Summary

Maintainability
Test Coverage
<%= render 'shared/navigation' %>

<section class="bills">
  <header>
    <div class="bill_info">
      <div class="bill_details">
        <h2>
          <strong><%= @bill['bill_id'] %></strong>
          <%= @bill.session_label %>
          <% if @bill['versions'].last %>
            <%= link_to 'Read the complete bill →', @bill['versions'].last['url'] %>
          <% end %>
        </h2>
        <h1 class="title_short">
          <%= short_bill_title(@bill) %>
          <% if @bill['title'].length >= 95 %>
            <a href="#" class="show_full_title" target="title"><span class="icon-plus"></span> Show full</a>
          <% end %>
        </h1>
        <% if @bill['title'].length >= 95 %>
          <p class="show_full title_long" style="display:none;">
            <%= @bill['title'] %>
            <a href="#" class="show_short_title" target="title"><span class="icon-minus"></span> Show less</a>
          </p>
        <% end %>
        <div class="attr">
          <span class="attr">
            <%= @jurisdiction.chamber_name(@bill['chamber']) %>
          </span>
          <span class="attr">
            <%= @bill.type.first.titleize %>
          </span>
          <!-- <span class="attr"><%# pluralize @bill.questions.count, 'question' %></span>
          <span class="attr"><%# pluralize @bill.questions_answered.count, 'answer' %></span> -->
        </div>
        <ol class="actions">
          <% @bill.dates.each do |action, date| %>
            <% date = Time.zone.parse(date.to_s) %>
            <% if action == 'first' %>
              <li<% if date %> class="active"<% end %> %>>
                Introduced
                <%= l(date, format: :bill) if date %>
                <span class="icon-circle-arrow-right"></span>
              </li>
            <% elsif action == 'passed_lower' %>
              <li<% if date %> class="active"<% end %>>
                Passed <%= @jurisdiction.chamber_name('lower') %>
                <%= l(date, format: :bill) if date %>
                <span class="icon-circle-arrow-right"></span>
              </li>
            <% elsif action == 'passed_upper' %>
              <li<% if date %> class="active"<% end %>>
                Passed <%= @jurisdiction.chamber_name('upper') %>
                <%= l(date, format: :bill) if date %>
                <span class="icon-circle-arrow-right"></span>
              </li>
            <% elsif action == 'signed' %>
              <li<% if date %> class="active"<% end %>>
                Signed into Law
                <%= l(date, format: :bill) if date %>
              </li>
            <% end %>
          <% end %>
        </ol>
      </div>
    </div>
    <!-- <%# link_to 'Ask about this Bill', new_question_path(@jurisdiction.abbreviation, bill: @bill), class: 'bill_detail cta-pill' %> -->
    <%# link_to 'Tell your Senator what you think', '#', class: 'sim_act' %>
  </header>

  <div class="related_wrap">
    <div class="related_data">
      <nav>
        <ul class="related_nav">
          <!-- <li><%# link_to 'Questions', bill_path(@jurisdiction.abbreviation, @bill.id), tab_options('questions', 'show') %></li> -->
          <li><%= link_to 'Sponsors', sponsors_bill_path(@jurisdiction.abbreviation, @bill.id), tab_options('sponsors') %></li>
        </ul>
      </nav>

      <div class="related_content">
        <%= render partial: @tab %>
        <aside>
          <% if @bill['sponsors'].present? && @tab != "sponsors" -%>
            <section class="sponsors">
              <h4>
                Sponsors
                <% if @bill['sponsors'].size > 5 %>
                  (<%= @bill['sponsors'].size %>)
                <% end %>
              </h4>
              <ul>
                <% @bill.people_and_committee_sponsors(limit: 5).each do |sponsor| %>
                  <li>
                    <% if Person === sponsor %>
                      <div class="depiction">
                        <% if sponsor.image? %>
                          <%= cdn_image_tag(sponsor.image, size: '50x50', alt: '') %>
                        <% else %>
                          <%= image_tag('placeholder.png', size: '50x50', alt: '') %>
                        <% end %>
                      </div>
                      <div class="details">
                        <%= link_to sponsor.name, person_path(@jurisdiction.abbreviation, sponsor) %>
                        <%= district_name(sponsor.most_recent(:district)) %>
                        <span class="sponsor_type"><%= sponsor.type %></span>
                      </div>
                    <% else %>
                      <%= sponsor.name %>
                      <span class="sponsor_type"><%= sponsor.type %></span>
                    <% end %>
                  </li>
                <% end %>
              </ul>
              <% if @bill['sponsors'].size > 5 %>
                <%= link_to 'View all', sponsors_bill_path(@jurisdiction.abbreviation, @bill.id), rel: 'sponsors' %>
              <% end %>
            </section>
          <% end %>

          <% unless @bill['subjects'].blank? %>
            <section>
              <h4>Issue Areas</h4>
              <ul>
                <% @bill['subjects'].each do |subject| %>
                  <li>
                    <%= link_to subject, subject_path(@jurisdiction.abbreviation, subject) %>
                  </li>
                <% end %>
              </ul>
            </section>
          <% end %>
        </aside>
      </div>
    </div>
  </div>
</section>