expertiza/expertiza

View on GitHub
app/views/student_review/_set_dynamic_review.html.erb

Summary

Maintainability
Test Coverage
<SCRIPT LANGUAGE="JavaScript">
    function toggleVis(value, id) {
        var elem = document.getElementById(id);
        if (value) {
            elem.style.display = 'none';
        } else {
            elem.style.display = '';
        }
    }
</SCRIPT>
<% if assignment.topics? && assignment.can_choose_topic_to_review? %>
  <% unless assignment.current_stage == "Finished" %>
    <%= form_tag :controller => 'review_mapping',
                 :action => 'assign_reviewer_dynamically',
                 :assignment_id => assignment.id,
                 :reviewer_id => session[:user].id do %>

        <input id="i_dont_care" name="i_dont_care" type="checkbox" onchange="toggleVis(this.checked, 'topic_list');" />
        <%=t ".i_don't_care"%>
        <p><b><%=t ".select_topic"%></b></p>

    <table cellpadding="0" id="topic_list">
      <% #candidate_topics_to_review = assignment.candidate_topics_to_review(session[:user]).to_a %>
      <% candidate_topics_to_review = assignment.candidate_topics_to_review(participant).to_a %>
      <% candidate_topics_to_review.sort! { |a, b| a.id <=> b.id } %>
      <% non_reviewable_topics = assignment.sign_up_topics - candidate_topics_to_review %>
      <% non_reviewable_topics.sort! { |a, b| a.id <=> b.id } %>
      <% candidate_topics_to_review.each do |topic| %>
        <tr>
          <td><%= radio_button_tag 'topic_id', topic.id %></td>
          <td><%= topic.topic_identifier %>:</td>
          <td><%= topic.topic_name %></td>
        </tr>
      <% end %>
      <% non_reviewable_topics.each do |topic| %>
        <tr>
          <td></td>
          <td><font color="gray"><%= topic.topic_identifier %>:</font></td>
          <td><font color="gray"><%= topic.topic_name %></font></td>
        </tr>
      <% end %>
    </table>

  <p><input type='submit' value= <%= t(".request_new_submission").to_s %> /></p>
    <% end %>
  <%end%>
<% else %>
    
    <%unless assignment.current_stage == "Finished" %>
    <%= form_tag :controller => 'review_mapping',
                 :action => 'assign_reviewer_dynamically',
                 :assignment_id => assignment.id,
                 :reviewer_id => session[:user].id do %>
    <p><input type='submit' value=<%= t(".request_new_submission") %>/></p>
  <% end %>
  <%end%>
<% end %>