testmycode/tmc-server

View on GitHub
app/views/course_templates/index.html.erb

Summary

Maintainability
Test Coverage
<%= javascript_tag do %>
  window.courseTemplateId = (new URL(location.href)).searchParams.get('id');
<% end %>
<%= javascript_include_tag 'course-refresh' %>

<h1>Course templates</h1>

<%= render :partial => 'courses/refresh_progress_report', :locals => { :refresh_initialized => request.params.has_key?("id") } %>

<% if @refresh_report %>
  <%= render :partial => 'courses/refresh_report', :locals => { :report => @refresh_report } %>
<% end %>

<% unless @course_templates.empty? %>
  <h3>Visible</h3>
  <table class="table table-striped">
    <thead>
    <tr class="no-wrap">
      <th>Name</th>
      <th>Title</th>
      <th>Description</th>
      <th>Material url</th>
      <th>Source url</th>
      <th>Expires at</th>
      <th>Courses made</th>
      <th colspan="3"></th>
    </tr>
    </thead>

    <tbody>
    <% @course_templates.each do |course_template| %>
      <%= render partial: 'table_row', locals: { course_template: course_template } %>
    <% end %>
    </tbody>
  </table>
<% end %>

<% unless @hidden_course_templates.empty? %>
  <h3>Hidden</h3>
  <table class="table table-striped">
    <thead>
    <tr class="no-wrap">
      <th>Name</th>
      <th>Title</th>
      <th>Description</th>
      <th>Material url</th>
      <th>Source url</th>
      <th>Expires at</th>
      <th>Courses made</th>
      <th colspan="3"></th>
    </tr>
    </thead>

    <tbody>
    <% @hidden_course_templates.each do |course_template| %>
      <%= render partial: 'table_row', locals: { course_template: course_template } %>
    <% end %>
    </tbody>
  </table>
<% end %>

<br>

<%= link_to 'New Course template', new_course_template_path, class: 'btn btn-primary mb-1' %>