expertiza/expertiza

View on GitHub
app/views/participants/_participant.html.erb

Summary

Maintainability
Test Coverage
<% userid << participant.user_id %>
<tr class= "" style="font-size: 15px">
  <td ><%= link_to participant.user.name(session[:ip]), impersonate_impersonate_path(:user => {:name => participant.user.name(session[:ip])}), :method => :post %></td>
  <td ><%= link_to participant.user.fullname(session[:ip]), :controller=> 'users', :action => 'show', :id => participant.user_id %></td>
  <td><a href="mailto: <%= participant.user.email(session[:ip]) %>"><%= participant.user.email(session[:ip]) %></a></td>
  <td><%= participant.user.role.name %></td>
  <td align = "left"><%= (User.find(participant.user.parent_id)).name(session[:ip]) %></td>
  <% if  @model == 'Assignment' && participant.assignment.badge? %>
    <td align = "left"><%= get_awarded_badges(participant) %></td>
  <% end %>
  <td align = "left"><%= User.yesorno(participant.user.email_on_review) %></td>
  <td align = "left"><%= User.yesorno(participant.user.email_on_submission) %></td>
  <td align = "left"><%= User.yesorno(participant.user.email_on_review_of_review) %></td>
  <td align = "left"><%= !participant.can_submit ? 'no' : 'yes' %></td>
  <td align = "left"><%= !participant.can_review ? 'no' : 'yes' %></td>
  <td align = "left"><%= !participant.can_take_quiz ? 'no' : 'yes' %></td>
  <% if  @model == 'Assignment' %>
    <!-- E2351 - duty column added to participants -->
    <td align = "left"><%= !participant.can_mentor ? 'no' : 'yes' %></td>
  <% end %>
  <td align = "left"><%= participant.handle(session[:ip]) %></td>

  <td align="left" ><%= link_to 'Remove', {:controller => 'participants', :action => 'destroy', :id => participant.id}, :method => :delete %></td>

  <!-- E726 Fall2012 Changes Begin -->
  <% authorization = participant.authorization %>
  <% if authorization =='reader' %>
      <td><%= fa_icon 'book', title: 'reader' %></td>
  <% else %>
      <td></td>
  <% end %>
  <!-- E726 Fall2012 Changes End -->

  <!-- Aligning the column to the left keeping it similar to the entire page -->
  <td align="left">
    <%= form_tag :controller=>'participants', :action=>'update_authorizations', :id => participant.id do %>
        <% params[:authorization] = authorization %>
        <select class="form-control" id=<%=participant.user_id%> name="authorization" style="font-size:15px">

          <option value="participant"
                  <% if params[:authorization] == "participant" -%>
                  selected
                  <% end -%>
                  >participant</option>
          <option value="reader"
                  <% if params[:authorization] == "reader" -%>
                  selected
                  <% end -%>
                  >reader</option>
          <option value="reviewer"
                  <% if params[:authorization] == "reviewer" -%>
                  selected
                  <% end -%>
                  >reviewer</option>
          <option value="submitter"
                  <% if params[:authorization] == "submitter" -%>
                  selected
                  <% end -%>
                  >submitter</option>
  <!-- E2351 adding 4th option in drop down per project description, this will allow a user to be changed
       to a mentor via the gui -->
      <option value="mentor"
          <% if params[:authorization] == "mentor" -%> 
                  selected
                  <% end -%>
                  >mentor</option>
        </select>
        <!-- Change to display the Submit button -->
        <%= button_tag "Submit", {:id=>'button'+participant.user_id.to_s,:style=>"font-size:15px; opacity:1;", :class => "btn btn-md btn-default" } %>
    <% end %>
  </td>

</tr>