_course.html.erb 1.72 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
    <div class="card-header">
Zac Wood's avatar
Zac Wood committed
5
6
7
8
9
10
11
12
13
14
15
16
	<div class="row">
	    <div class="col">
		<h4 class="title"><%= "#{course.subject} #{course.course_number}" %></h4>
	    </div>
	    
	    <div class="col">
		<h4 id="add-course-btn" class="text-right" onclick="addCourse(event, '<%= course.id %>');">
		    <i class="fas fa-plus" style="color: green"></i>
		</h4>
	    </div>    
	</div>
	<h5><em><%= course.title %></em></h5>
Zac Wood's avatar
Zac Wood committed
17
    </div>
Zac Wood's avatar
Zac Wood committed
18
19
    <div class="card-body">
	<div class="attr-list">
20
21
	    <div class="attr"><i class="fa fa-book"></i> 3 credits</div> <!-- TODO: Make this work --> 
	    <div class="attr"><i class="fa fa-bars"></i> <%= "#{course.section_count}" %> sections</div>
Zac Wood's avatar
Zac Wood committed
22
23
	</div>
	<p class="description"><%= course.description %></p>
Zac Wood's avatar
Zac Wood committed
24

Zac Wood's avatar
Zac Wood committed
25
26
27
28
29
30
31
32
33
34
35
36
37
	<% 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" %>">
38
	    <% if defined?(@instructor) %>
Zac Wood's avatar
Zac Wood committed
39
		<%= render partial: 'shared/section', collection: course.course_sections.where(instructor: @instructor), locals: { course: course } %>
40
	    <% else %>
Zac Wood's avatar
Zac Wood committed
41
		<%= render partial: 'shared/section', collection: course.course_sections, locals: { course: course } %>
42
	    <% end %>
Zac Wood's avatar
Zac Wood committed
43
	</div>
44
    </div>
Zac Wood's avatar
Zac Wood committed
45
</div>