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

Zac Wood's avatar
Zac Wood committed
3
<div class="card course-card" id="course-<%= course.id %>">
Zac Wood's avatar
Zac Wood committed
4
    <div class="card-header">
Zac Wood's avatar
Zac Wood committed
5
6
	<div class="row">
	    <div class="col">
7
8
9
		<%= link_to course do %>
		    <h4 class="title"><%= "#{course.subject} #{course.course_number}" %></h4>
		<% end %>
Zac Wood's avatar
Zac Wood committed
10
11
12
	    </div>
	</div>
	<h5><em><%= course.title %></em></h5>
Zac Wood's avatar
Zac Wood committed
13
    </div>
Zac Wood's avatar
Zac Wood committed
14
    <div class="card-body">
Zac Wood's avatar
Zac Wood committed
15
16
17
18
19
	<div class="attr-list justify-content-start">
	    <div class="attr">
		<div class="icon">
		    <i class="fa fa-book"></i>
		</div>
Zac Wood's avatar
Zac Wood committed
20
		<%= course.credits %> credits
Zac Wood's avatar
Zac Wood committed
21
22
23
24
25
26
	    </div>
	    &nbsp;&nbsp;&nbsp;
	    <div class="attr">
		<div class="icon">
		    <i class="fa fa-bars"></i>
		</div>
Zac Wood's avatar
Zac Wood committed
27
		 <%= course.course_sections.count %> sections
Zac Wood's avatar
Zac Wood committed
28
	    </div>
Zac Wood's avatar
Zac Wood committed
29
30
	</div>
	<p class="description"><%= course.description %></p>
Zac Wood's avatar
Zac Wood committed
31

Zac Wood's avatar
Zac Wood committed
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 %>
	
38
39
40
41
42
43
44
45
46
47
48
	<% if expanded %>
		<div class="d-block" style="text-align: center">
	  	    <p id="chevron-label" style="margin-bottom:-4px; font-size: 10px;">Minimize</p>
	  	    <i id="course-chevron" class="fas fa-chevron-up"></i>
		</div>
	<% else %>
		<div class="d-block" style="text-align: center">
	  	    <p id="chevron-label" style="margin-bottom:-4px; font-size: 10px;">Expand</p>
	  	    <i id="course-chevron" class="fas fa-chevron-down"></i>
		</div>
	<% end %>
Zac Wood's avatar
Zac Wood committed
49
50
51
	
	<!-- List of Course Sections -->
	<div class="list-group list-group-flush sections" style="display: <%= expanded ? "flex" : "none" %>">
52
	    <% if defined?(@instructor) %>
Zac Wood's avatar
Zac Wood committed
53
		<%= render partial: 'shared/section', collection: course.course_sections.where(instructor: @instructor).order(:name), locals: { course: course } %>
54
	    <% else %>
Zac Wood's avatar
Zac Wood committed
55
		<%= render partial: 'shared/section', collection: course.course_sections.order(:name), locals: { course: course } %>
56
	    <% end %>
Zac Wood's avatar
Zac Wood committed
57
	</div>
58
    </div>
Zac Wood's avatar
Zac Wood committed
59
</div>