<commit_before><div class="page-header">
  <h1>Manage Students</h1>
</div>

<div style="width:93%">
    <span  class="pull-right" style="font-size: 1.3em">
      Student Count:  <strong style="font-size: 1.6em"><%= @student_count  %></strong>
    </span>
</div>

<% if @phantom %>
    <% url = course_manage_students_path + '?phantom=true' %>
    <a href="<%= course_manage_students_path %>?phantom=false" class="btn">Show Real Students</a>
<% else %>
    <% url = course_manage_students_path + '?phantom=false' %>
    <a href="<%= course_manage_students_path %>?phantom=true" class="btn">Show Only Phantom Students</a>
<% end %>

<br><br>
<% if can? :manage, UserCourse %>
    <% tas = @staff_courses.map {|tac| [tac.name, tac.id] }.unshift(["Unassigned", -1]) %>
    <table class="table">
      <tr>
        <th>Name</th>
        <th>Email</th>
        <th><%= sortable 'tutor', course_manage_students_path, @phantom ? 'phantom=true' : 'phantom=false' %></th>
        <th>Phantom</th>
        <th></th>
      </tr>
      <% @student_courses.each_with_index do |student_course| %>
          <% student = student_course.user %>
          <%= form_for [@course,student_course],
                       html: { method: :put, class: "form-horizontal" }  do |f| %>
              <tr>
                <td>
                  <input type="text" name="name" value="<%= student.name %>" required>
                </td>
                <td>
                  <input type="email" name="email" value="<%= student.email %>" required>
                </td>
                <td>
                  <%tutor = student_course.get_my_tutors.first %>
                  <% if tutor %>
                      <%= select "tutor","", tas, {:selected => "#{tutor.id}" }%>
                  <% else %>
                      <%= select "tutor","", tas, {:selected => "#{-1}" }%>
                  <% end %>
                </td>
                <td><input type="checkbox" name="is_phantom" <%= 'checked' if student_course.is_phantom? %>> </td>
                <td>
                  <input type="hidden" name="redirect_back_url" value="<%= url %>">
                  <button type="submit" class="btn">
                    <i class="icon-ok"></i>
                  </button>
                  <%= link_to course_user_course_path(@course, student_course),
                              method: :delete,
                              data: { confirm: t('.confirm', :default => t("helpers.links.confirm", :default => 'Are you sure?')) },
                              class: 'btn btn-danger' do %>
                      <i class="icon-trash"></i>
                  <% end %>
                </td>
              </tr>
          <% end %>
      <% end %>
    </table>
    <% if @std_paging.display? %>
        <%= paginate @student_courses %>
    <% end %>
<% end %><commit_msg>better confirmation message for removing user from course<commit_after><div class="page-header">
  <h1>Manage Students</h1>
</div>

<div style="width:93%">
    <span  class="pull-right" style="font-size: 1.3em">
      Student Count:  <strong style="font-size: 1.6em"><%= @student_count  %></strong>
    </span>
</div>

<% if @phantom %>
    <% url = course_manage_students_path + '?phantom=true' %>
    <a href="<%= course_manage_students_path %>?phantom=false" class="btn">Show Real Students</a>
<% else %>
    <% url = course_manage_students_path + '?phantom=false' %>
    <a href="<%= course_manage_students_path %>?phantom=true" class="btn">Show Only Phantom Students</a>
<% end %>

<br><br>
<% if can? :manage, UserCourse %>
    <% tas = @staff_courses.map {|tac| [tac.name, tac.id] }.unshift(["Unassigned", -1]) %>
    <table class="table">
      <tr>
        <th>Name</th>
        <th>Email</th>
        <th><%= sortable 'tutor', course_manage_students_path, @phantom ? 'phantom=true' : 'phantom=false' %></th>
        <th>Phantom</th>
        <th></th>
      </tr>
      <% @student_courses.each_with_index do |student_course| %>
          <% student = student_course.user %>
          <%= form_for [@course,student_course],
                       html: { method: :put, class: "form-horizontal" }  do |f| %>
              <tr>
                <td>
                  <input type="text" name="name" value="<%= student.name %>" required>
                </td>
                <td>
                  <input type="email" name="email" value="<%= student.email %>" required>
                </td>
                <td>
                  <%tutor = student_course.get_my_tutors.first %>
                  <% if tutor %>
                      <%= select "tutor","", tas, {:selected => "#{tutor.id}" }%>
                  <% else %>
                      <%= select "tutor","", tas, {:selected => "#{-1}" }%>
                  <% end %>
                </td>
                <td><input type="checkbox" name="is_phantom" <%= 'checked' if student_course.is_phantom? %>> </td>
                <td>
                  <input type="hidden" name="redirect_back_url" value="<%= url %>">
                  <button type="submit" class="btn">
                    <i class="icon-ok"></i>
                  </button>
                  <%= link_to course_user_course_path(@course, student_course),
                              method: :delete,
                              data: { confirm: t('.confirm', :default => t("helpers.links.confirm", :default => "Are you sure to remove #{student.name} from course ?")) },
                              class: 'btn btn-danger' do %>
                      <i class="icon-trash"></i>
                  <% end %>
                </td>
              </tr>
          <% end %>
      <% end %>
    </table>
    <% if @std_paging.display? %>
        <%= paginate @student_courses %>
    <% end %>
<% end %>
{'fraction_non_alphanumeric': 0.18276400208080457, 'fraction_numerical': 0.0034680076296167853, 'mean_word_length': 1.8013598834385625, 'pattern_counts': {'":': 0, '<': 171, '<?xml version=': 0, '>': 179, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6427569', 'n_tokens_mistral': 1960, 'n_tokens_neox': 1730, 'n_words': 358}