holderdeord/hdo-site

View on GitHub
app/views/representatives/_vote_list.html.erb

Summary

Maintainability
Test Coverage
<div class="representative-vote-list">

  <h4><%= @representative.first_name %> har <%= @representative.attending? ? 'nylig' : 'sist' %> stemt</h4>

  <table class="table">
    <tbody>
      <% @vote_feed.entries.each do |entry| %>
        <tr>
          <td style="white-space: nowrap;"><%= l entry.time, format: :short_text %></td>

          <td>
            <strong><%= entry.position %></strong>
          </td>

          <td>
            <div><%= link_to entry.description, entry.proposition, class: 'proposition-title' %></div>

            <div>
              <% if entry.issues.any? %>
                <small>
                  Se også <%= entry.issues.map { |i| link_to i.title, i }.to_sentence.html_safe %>
                </small>
              <% end %>              
            </div>
          </td>

        </tr>        
      <% end %>
    </tbody>
  </table>

  <div class="row-fluid">
    <div class="span6">
      <% if params[:page] && params[:page].to_i > 1 %>
        <%= link_to '&larr; Nyere avstemninger'.html_safe, representative_path(@representative, page: (params[:page].to_i - 1))  %>
      <% end %>
    </div>

    <div class="span6">
      <p style="text-align: right;">
        <%= link_to 'Eldre avstemninger &rarr;'.html_safe, representative_path(@representative, page: ((params[:page] || 1).to_i + 1))  %>
      </p>
    </div>
  </div>
</div>