_course.html.erb 1.56 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
    <div class="card-header">
	<h4 class="title"><%= "#{course.subject} #{course.course_number}" %></h4>
	<h5><em><%= course.title %></em>. <%= course.credits %> credits.</h5>
	<h4 id="add-course-btn" onclick="addCourse(event, '<%= course.id %>');">
	    <i class="fas fa-plus" style="color: green"></i>
	</h4>
Zac Wood's avatar
Zac Wood committed
10
    </div>
Zac Wood's avatar
Zac Wood committed
11 12 13 14 15 16
    <div class="card-body">
	<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>
	</div>
	<p class="description"><%= course.description %></p>
Zac Wood's avatar
Zac Wood committed
17

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