expertiza/expertiza

View on GitHub
app/views/submitted_content/_main.html.erb

Summary

Maintainability
Test Coverage
<% if stage != "Finished" and controller.controller_name == 'submitted_content' and @can_submit %>
  <%= form_tag :action => 'submit_hyperlink', :id => participant.id do %>
    <h4>&#8226; <%=t ".submit_hyperlink"%></h4>
    <input type="text" name="submission" size=40 value="http://">
    <input type="submit" name="upload_link" value="Upload link"/>
  <% end %>
<% end %>
<br/>
<% if participant.team.nil? %>
  <% flash[:warn] = 'Submitting content while not on a team is not supported by Expertiza currently.' %>
<% elsif participant.team.hyperlinks.try(:length) %>
  <%= render :partial => 'submitted_content/hyperlink', :locals => {:participant => participant, stage: @stage} %>
<% end %>
<%= render partial: 'submitted_content/submitted_files', locals: {participant: participant, stage: @stage, origin: ''} %>
<% if @assignment.require_quiz? %>
  <!-- Setting the t_id for team assignments. The t_id should be not be nil because when the user does not have team, "your work" is unclickable-->
    <%team_for_current_participant = AssignmentTeam.team(participant)%>
    <%if team_for_current_participant.nil?
         t_id = nil
       else
         t_id=team_for_current_participant.id
       end
    %>
  <!-- If quiz is required for the assignment, find out if the quiz has already been created -->
  <% unless controller.action_name == "view_my_scores" || (@map && @map.reviewer_id != session[:user].id) %>
    <br/><b><%=t ".quiz"%></b><br/>
    <% if !t_id.nil? && questionnaire = QuizQuestionnaire.where(["instructor_id = ?", t_id]).first %>
      <%= link_to t(".view_quiz"), :controller => :quiz_questionnaires, :action => :view, :id => questionnaire.id, :pid => participant.id %>
      <br/>
      <% unless questionnaire.taken_by_anyone?%>
        <%= link_to t(".edit_quiz"), :controller => :quiz_questionnaires, :action => :edit, :id => questionnaire.id, :pid => participant.id %>
      <% end %>
      <br/>

    <% else %>
      <br/>
      <%= link_to 'Create a quiz', :controller => :quiz_questionnaires, :action => :new, :model => "QuizQuestionnaire", :private => 0, :aid => @assignment.id, :pid => participant.id %>
      <br/>
    <% end %>
  <% end %>
<% end %>