fiuba/alfred

View on GitHub
app/views/corrections/index.erb

Summary

Maintainability
Test Coverage
<h1><%= t('my_corrections')%></h1>

<div class="well form-search">
  <input type="text" class="input-medium search-query" id="filter" placeholder="tipea para filtrar">
</div>


<table id="correctionsGrid" class="table table-bordered table-striped table-hover">
    <tr>
    <th><%= t('assignment').capitalize %></th>
    <th><%= t('buid').capitalize %></th>
    <th><%= t('name').capitalize %></th>
    <th><%= t('test_result').capitalize %></th>
    <th><%= t('status').capitalize %></th>
    <th><%= t('grade').capitalize %></th>
    <th><%= t('corrections.grid.actions').capitalize %></th>
    </tr>
    <% @assigned_corrections.each do |ac| %>
        <tr class="<%= ac.is_overdue ? 'error' : '' %>">
      <td><%= ac.assignment_name %></td>
      <td><%= ac.student_buid %></td>
      <td><%= ac.student_full_name %></td>
      <td class="<%= ac.solution_test_result %>">
        <%= t ac.solution_test_result %>
      </td>
      <td><%= t ac.status %></td>
      <td><%= ac.grade %></td>
      <td>
      <% if ac.assignment_solution_type == 'file' %>
        <%- link_to :href => url(:solutions, :download, :solution_id => ac.solution_id), :rel => :tooltip, :title => t('corrections.download_solution_link'), :class => 'list-row-action-wrapper-link' do %>
          <i class='icon-download icon-white'></i>
        <% end %>
      <% else %>
        <% if ac.assignment_solution_type == 'link' %>
        <%- link_to :href => ac.link, :target => "_blank", :rel => :tooltip, :title => t('corrections.go_to_solution_link'), :class => 'list-row-action-wrapper-link' do %>
          <i class='icon-link icon-white'></i>
        <% end %>
        <% end %>
      <% end %>
                <%- link_to :href => url(:assignment, :file, :download, :assignment_id => ac.assignment_id), :rel => :tooltip, :title => t('corrections.download_assignment_link'), :class => 'list-row-action-wrapper-link' do %>
          <i class='icon-file'></i>
        <% end %>
        <% if ac.correction_id %>
          <%- link_to url(:corrections, :edit, ac.correction_id), :rel => :tooltip, :title => t('corrections.edit'), :class => 'list-row-action-wrapper-link' do %>
            <i class='icon-edit'></i>
          <% end %>
        <% else %>
          <%- link_to :href => url(:corrections, :new, ac.solution_id), :rel => :tooltip, :title => t('corrections.edit') do %>
            <i class='icon-edit'></i>
          <% end %>
        <% end %>
        <%- link_to :href => url(:solutions, :index, :assignment_id => ac.assignment_id, :student_id => ac.student_id), :rel => :tooltip, :title => t('solution.all'), :class => 'list-row-action-wrapper-link' do %>
          <i class='icon-list'></i>
        <% end %>
      </td>
        </tr>
    <% end %>
</table>

<% content_for :additional_js do %>
  <%= javascript_include_tag 'editablegrid-2.0.1.min.js' %>
  <%= javascript_include_tag 'corrections_index.js' %>
<% end %>