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

3
<div class="card" id="course-<%= course.id %>" onclick="toggleSections(this)">
4
  <div class="card-header">
Zach Perkins's avatar
Zach Perkins committed
5
    <h4 class="title"><%= "#{course.subject} #{course.course_number}" %></h4>
6
    <h5><em><%= course.title %></em>. <%= course.credits %> credits.</h5>
7
    <h4 id="add-course-btn" onclick="addCourse(event, '<%= course.id %>');">
Zac Wood's avatar
Zac Wood committed
8
			<i class="fas fa-plus" style="color: green"></i>
9
		</h4>
10
  </div>
Zac Wood's avatar
Zac Wood committed
11
  <div class="card-body">
12 13 14
    <div class="attr-list">
      <div class="attr"><i class="fa fa-book"></i> 3 credits</div>
      <div class="attr"><i class="fa fa-bars"></i> 3 sections</div>
Zac Wood's avatar
Zac Wood committed
15
    </div>
16
    <p class="description"><%= course.description %></p>
Zac Wood's avatar
Zac Wood committed
17

18
    <% unless course.prereqs.nil? || course.prereqs.empty? %>
19 20 21
    	<% first, rest = course.prereqs.split(':') %>
    	<% prereqs, note = rest.split('.') %>
    	<p><strong><%= first %>:</strong> <%= prereqs %> <sub><%= note %></sub></p>
22
    <% end %>
23
  
Zac Wood's avatar
Zac Wood committed
24
    <div class="d-block" style="text-align: center">
25 26
  	  <p style="margin-bottom:-4px; font-size: 10px;">Expand</p>
  	  <i class="fas fa-chevron-down"></i>
Zac Wood's avatar
Zac Wood committed
27
    </div>
28
  
Zac Wood's avatar
Zac Wood committed
29
    <!-- List of Course Sections -->
30 31
    <div class="list-group list-group-flush sections" style="display: <%= expanded ? "flex" : "none" %>">
	    <% if defined?(@instructor) %>
Zach Perkins's avatar
Zach Perkins committed
32
        <%= render partial: 'shared/section', collection: course.course_sections.where(instructor: @instructor), locals: { course: course } %>
33
	    <% else %>
Zach Perkins's avatar
Zach Perkins committed
34
	      <%= render partial: 'shared/section', collection: course.course_sections, locals: { course: course } %>
35 36
	    <% end %>
    </div>
Zac Wood's avatar
Zac Wood committed
37
  </div>
38
</div>