app/views/assignments/list_submissions.html.erb
<!--E1877 script added to sort the table-->
<script>
$(function () {
/*E1877: Function for sorting the table */
$("#submissionsTable").tablesorter({
sortList: [[0,0]] //E1877: sort First Column by default when page loads
});
});
</script>
<% headers = {} %>
<% headers["Topic_name"] = "16%" if @assignment.topics? %>
<% if @assignment.max_team_size > 1 %>
<% headers["Team name"] = "14%" %>
<% headers["Team member(s)"] = "18%" %>
<% else %>
<% headers["Participant name"] = "18%" %>
<% end %>
<% headers["Submitted item(s)"] = nil %>
<!--E1877: table id changed -->
<table id ="submissionsTable" class="table table-striped" style="margin-top: 50px">
<thead>
<!--E1877: class="sorter-true" added to sort all attributes-->
<tr>
<% if @assignment.topics? %>
<th class="sorter-true" style="font-weight: bold; font-size: 15px;">Topic name</th>
<% end %>
<% if @assignment.max_team_size > 1 %>
<th class="sorter-true" style="font-weight: bold; font-size: 15px;">Team name</th>
<th class="sorter-true" style="font-weight: bold; font-size: 15px;">Team member(s)</th>
<% if @assignment.pair_programming_enabled? %>
<% pair_programming_enabled = true %>
<th class="sorter-true" style="font-weight: bold; font-size: 15px;">Pair Programming</th>
<% else %>
<% pair_programming_enabled = false %>
<% end %>
<% else %>
<th class="sorter-true" style="font-weight: bold; font-size: 15px;">Participant name</th>
<% end %>
<th class="sorter-true" style="font-weight: bold; font-size: 15px;">Links</th>
<th class="sorter-false" style="font-weight: bold; font-size: 15px;"></th>
</tr>
</thead>
<% @teams.each do |team| %>
<tr>
<% topic_identifier, topic_name, users_for_curr_team, participants = get_data_for_list_submissions(team) %>
<!--Topic name-->
<% if @assignment.topics? %>
<td><%= topic_identifier + '. ' + topic_name %></td>
<% end %>
<!--Team name-->
<% if @assignment.max_team_size >= 1 %>
<% team_name_color = get_team_name_color_in_list_submission(team) %>
<td><p style = <%="color:#{team_name_color}"%>><%= team.name(session[:ip]) %></p>
<% unless participants.empty? %>
<!-- “Assign Grade” will show if the final deadline of this assignment pass -->
<% if @assignment.current_stage(topic_identifier) == "Finished" %>
<%= link_to 'Assign Grade', { controller: 'grades', action: 'view_team', id: participants.first.id}, target: '_blank' %></td>
<%elsif ["submission", "review"].include?(@assignment.current_stage(topic_identifier)) %>
<%= link_to 'View Reviews', { controller: 'grades', action: 'view_team', id: participants.first.id}, target: '_blank' %></td>
<!-- if current user(TA/instructor) is participant in assignment then the user can perform review -->
<%elsif current_user_is_assignment_participant?(@assignment.id) %>
<%= render :partial => 'responses', :locals => {:team => team ,:topic_id => topic_identifier, :title => 'Review'} %>
<% end %>
<% end %>
<% end %>
<!--Team member(s) / Participant name-->
<td>
<% users_for_curr_team.each do |user| %>
<%= link_to user.name(session[:ip]), impersonate_impersonate_path(:user => {:name => user.name(session[:ip])}), :method => :post %>
(<%= user.fullname(session[:ip])%>)<br>
<% end %>
</td>
<!-- Pair Programming -->
<% if pair_programming_enabled %>
<td>
<%= Team.find(team.id).pair_programming_request == 2 ? "Yes": "No" %>
</td>
<% end %>
<!--Submitted item(s)-->
<td>
<!--Display submitted hyperlinks-->
<% participant = participants.compact.first %>
<% if participant && !team.hyperlinks.empty? %>
<% team.hyperlinks.each do |link| %>
<a href="<%= link %>" target="_blank">- <%= link %></a><br/>
<% end %>
<% end %>
<br>
<!--Display submitted files-->
<% team.submitted_files %>
<% if participant && !team.submitted_files.empty? %>
<% files = team.submitted_files %>
<%= display_directory_tree(participant, files, true).html_safe if files && files.length > 0 %>
<% end %>
</td>
<td width="10%">
<%= link_to "History", submission_records_path(team_id: team.id) %>
</td>
</tr>
<% end %>
</table>
<p> **In "Team name" column, text in <i style = "color:#0984e3">blue</i> indicates that the submission grade is not assigned; text in <i style = "color: #cd6133">brown</i> indicates that the submission grade has been assigned.</p>
</div>