<commit_before><% content_for :head do %>
  <%= javascript_include_tag 'Assignments/index' %>
<% end %>

<div class='title_bar'>
  <h1><%= t(:manage_course_work) %></h1>

  <div class='heading_buttons'>
    <% if @current_user.admin? %>
      <%= link_to t(:download_csv_grade_report),
                  download_csv_grades_report_assignments_path%>
      <span class='menu_bar'></span>
    <% end %>
    <%= link_to_function t(:upload), 'modal_upload.open()' %>
    <span class='menu_bar'></span>
    <%= link_to_function t(:download), 'modal_download.open()' %>
  </div>
</div>

<div class='wrapper'>
  <%= render 'shared/flash_message' %>

  <%= link_to t(:create_new_assignment),
              { controller: 'assignments',
                action: 'new' },
              class: 'button' %>
  <%= link_to t(:create_new_grade_entry_form),
              { controller: 'grade_entry_forms',
                action: 'new' },
              class: 'button' %>

  <%= render partial: 'assignments/list_manage',
             locals: { controller: 'assignments',
                       action: 'edit' } -%>
</div>

<% # For now, only allow instructors to manage grade entry forms %>
<% if @current_user.admin? %>
  <div class='wrapper'>
    <%= render partial: 'grade_entry_forms/list_manage',
               locals: { action: 'edit' } %>
  </div>
<% end %>


<aside class='dialog' id='download_dialog'>
  <h2><%= t('download') %></h2>
  <p>
    <%= link_to t(:assignment_format, file: 'CSV'),
                  download_assignment_list_assignments_path(
                          file_format: 'csv'),
                  class: 'button' if @current_user.admin? %>
    <br>
    <br>
    <%= link_to t(:assignment_format, file: 'YML'),
                  download_assignment_list_assignments_path(
                          file_format: 'yml'),
                  class: 'button' if @current_user.admin? %>
  </p>

  <section class='dialog-actions'>
    <%= button_to_function t(:close), 'modal_download.close()' %>
  </section>
</aside>

<aside class='dialog' id="upload_dialog">
  <h2><%= t('upload') %></h2>
  <p>
    <p>
      <%= t(:select_csv_file,
            code: @default_fields[0..3].join(', ')).html_safe %>
    </p>
    <p>
      <%= t(:all_csv_file) %>
      <%= link_to_function '[...]', "toggleElem('hide')" %>
      <span id='hide' style='display: none;'>
        <%= "<code>#{@default_fields.join(', ')}</code>".html_safe %>
      </span>
    </p>

    <%= form_tag upload_assignment_list_assignments_path,
                 { multipart: true } do %>
      <p>
        <%= t('encoding') %>
        <%= select_tag(:encoding, options_for_select(@encodings)) %>
      </p>

      <input type='file' name='assignment_list' id='assignment_list'>

      <section class='dialog-actions'>
        <%= hidden_field_tag :file_format, '', id: 'file_format' %>
        <% if @current_user.admin? %>
          <%= submit_tag t(:upload_assignment_format, file: 'YML'),
                         onclick: 'choose_upload("yml")' %>
          <%= submit_tag t(:upload_assignment_format, file: 'CSV'),
                         onclick: 'choose_upload("csv")' %>
        <% end %>
      </section>
    <% end %>
  </p>
</aside><commit_msg>Added disable feature when no files are selected.<commit_after><% content_for :head do %>
  <%= javascript_include_tag 'Assignments/index' %>
<% end %>

<div class='title_bar'>
  <h1><%= t(:manage_course_work) %></h1>

  <div class='heading_buttons'>
    <% if @current_user.admin? %>
      <%= link_to t(:download_csv_grade_report),
                  download_csv_grades_report_assignments_path%>
      <span class='menu_bar'></span>
    <% end %>
    <%= link_to_function t(:upload), 'modal_upload.open()' %>
    <span class='menu_bar'></span>
    <%= link_to_function t(:download), 'modal_download.open()' %>
  </div>
</div>

<div class='wrapper'>
  <%= render 'shared/flash_message' %>

  <%= link_to t(:create_new_assignment),
              { controller: 'assignments',
                action: 'new' },
              class: 'button' %>
  <%= link_to t(:create_new_grade_entry_form),
              { controller: 'grade_entry_forms',
                action: 'new' },
              class: 'button' %>

  <%= render partial: 'assignments/list_manage',
             locals: { controller: 'assignments',
                       action: 'edit' } -%>
</div>

<% # For now, only allow instructors to manage grade entry forms %>
<% if @current_user.admin? %>
  <div class='wrapper'>
    <%= render partial: 'grade_entry_forms/list_manage',
               locals: { action: 'edit' } %>
  </div>
<% end %>


<aside class='dialog' id='download_dialog'>
  <h2><%= t('download') %></h2>
  <p>
    <%= link_to t(:assignment_format, file: 'CSV'),
                  download_assignment_list_assignments_path(
                          file_format: 'csv'),
                  class: 'button' if @current_user.admin? %>
    <br>
    <br>
    <%= link_to t(:assignment_format, file: 'YML'),
                  download_assignment_list_assignments_path(
                          file_format: 'yml'),
                  class: 'button' if @current_user.admin? %>
  </p>

  <section class='dialog-actions'>
    <%= button_to_function t(:close), 'modal_download.close()' %>
  </section>
</aside>

<aside class='dialog' id="upload_dialog">
  <script>
      jQuery(document).ready(function(){
          jQuery(".accordion").accordion();

          // Checks to see if the file upload id changed.
          jQuery("input#assignment_list").change(function () {
              var filePath = jQuery(this).val();

              // Either disables or enables upload buttons.
              if (filePath === ""){
                  document.getElementById("yml_upload").disabled = true;
                  document.getElementById("csv_upload").disabled = true;
              } else {
                  document.getElementById("yml_upload").disabled = false;
                  document.getElementById("csv_upload").disabled = false;
              }
          });
      });
  </script>
  <h2><%= t('upload') %></h2>
  <p>
    <p>
      <%= t(:select_csv_file,
            code: @default_fields[0..3].join(', ')).html_safe %>
    </p>
    <p>
      <%= t(:all_csv_file) %>
      <%= link_to_function '[...]', "toggleElem('hide')" %>
      <span id='hide' style='display: none;'>
        <%= "<code>#{@default_fields.join(', ')}</code>".html_safe %>
      </span>
    </p>

    <%= form_tag upload_assignment_list_assignments_path,
                 { multipart: true } do %>
      <p>
        <%= t('encoding') %>
        <%= select_tag(:encoding, options_for_select(@encodings)) %>
      </p>

      <input type='file' name='assignment_list' id='assignment_list'>

      <section class='dialog-actions'>
        <%= hidden_field_tag :file_format, '', id: 'file_format' %>
        <% if @current_user.admin? %>
          <%= submit_tag t(:upload_assignment_format, file: 'YML'), disabled: true, id: 'yml_upload',
                         onclick: 'choose_upload("yml")' %>
          <%= submit_tag t(:upload_assignment_format, file: 'CSV'), disabled: true, id: 'csv_upload',
                         onclick: 'choose_upload("csv")' %>
        <% end %>
      </section>
    <% end %>
  </p>
</aside>
{'fraction_non_alphanumeric': 0.17657558698338596, 'fraction_numerical': 0.002196896883152547, 'mean_word_length': 2.42132456552372, 'pattern_counts': {'":': 0, '<': 161, '<?xml version=': 0, '>': 161, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 18, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7540302', 'n_tokens_mistral': 2470, 'n_tokens_neox': 2272, 'n_words': 420}