call4paperz/call4paperz

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

Summary

Maintainability
Test Coverage
<div id="left_bar">
  <div id="profile">
    <%= user_picture(@profile.user) %>
    <%= image_tag 'linha.png', class: 'linha' %>
    <p><strong><%= @profile.user.name %></strong></p>
    <p><strong><%= link_to 'Edit profile', edit_profile_path %></strong></p>

    <% if @profile.unassociated_providers.size > 0 %>
    <%= image_tag 'linha.png', class: 'linha' %>
    <p>Associate other accounts with your profile. This way, you can use any of
    them to authenticate in the Call4Paperz:</p>
    <br>
    <ul>
      <% @profile.unassociated_providers.each do |provider| %>
        <li><%= link_to(provider.show_name, "auth/#{provider.name}") %></li>
      <% end %>
    </ul>
    <% end %>

    <% if @profile.authentications.any? %>
      <%= image_tag 'linha.png', class: 'linha' %>

      <p>Associated profiles:</p>
      <br>
      <ul id="associated-profiles">
        <% @profile.authentications.each do |authentication| %>
          <li>
            <%= authentication.provider.capitalize %>
          </li>
        <% end %>
      </ul>
    <% end %>
</div>

<div id="proposal_list">
  <%= image_tag 'admin_label.png' %>
  <p class="sub_vote">Your call for papers's statistics.</p>
  <br/>

  <% if @profile.events.blank? %>
    <spam class="yet">You don't have any event yet.</spam> <%= link_to "Try it now!", new_event_path %>
  <% end %>

  <% @profile.events.each do |event| %>
    <div class="event_stat">
      <p class="name">Event: <spam><%= link_to event.name, event %></spam></p>
      <br/>
      <div class="proposals_stat">
        <table id="composicao" cellspacing="0" cellpadding="0">
          <thead>
            <tr>
              <th>Proposal</th>
              <th>Positive votes</th>
              <th>Negative votes</th>
            </tr>
          </thead>
          <tfoot>
            <tr>
              <td></td>
              <td class="valor" colspan="2"></td>
            </tr>
          </tfoot>
          <tbody>
            <% event.proposals.each do |proposal| %>
              <tr>
                <td><%= proposal.name %></td>
                <td><%= proposal.votes.positives.size %></td>
                <td><%= proposal.votes.negatives.size %></td>
              </tr>
            <% end %>
          </tbody>
        </table>
      </div>
      <br/><br/>
    </div>
  <% end %>
</div>