_course.html.erb 1.3 KB
Newer Older
1 2
<% expanded = false unless defined? expanded %>

3
<div class="card" id="course-<%= course.id %>" onclick="toggleSections(this)">
Zac Wood's avatar
Zac Wood committed
4 5 6 7 8 9 10 11 12 13
  <div class="card-body">
    <div>
      <h3 style="float: left"><%= "#{course.subject} #{course.course_number}" %></h3>
      <h5 style="float: right"><em><%= course.title %></em>. <%= course.credits %> credits.</h5>
    </div>

    <div style="clear: both"> </div>

    <p class="description"><%= course.description %></p>

14
    <% unless course.prereqs.nil? || course.prereqs.empty? %>
15 16 17 18 19
	<% first, rest = course.prereqs.split(':') %>
	<% prereqs, note = rest.split('.') %>
	<p><strong><%= first %>:</strong> <%= prereqs %> <sub><%= note %></sub></p>
    <% end %>

Zac Wood's avatar
Zac Wood committed
20
    <div class="d-block" style="text-align: center">
21 22
	<p style="margin-bottom:-4px; font-size: 10px;">Expand</p>
	<i class="fas fa-chevron-down"></i>
Zac Wood's avatar
Zac Wood committed
23 24 25
    </div>

    <!-- List of Course Sections -->
26 27 28 29 30 31
    <ul class="list-group list-group-flush" id="sections" style="display: <%= expanded ? "block" : "none" %>">
	<% if defined?(@instructor) %>
	    <%= render partial: 'shared/section', collection: course.course_sections.where(instructor: @instructor), locals: { in_cart: false } %>
	<% else %>
	    <%= render partial: 'shared/section', collection: course.course_sections, locals: { in_cart: false } %>
	<% end %>
Zac Wood's avatar
Zac Wood committed
32 33 34
    </ul>
  </div>
</div>