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

3
4
5
6
7
8
<% if defined?(@instructor) %>
    <% sections = course.course_sections.where(instructor: @instructor, semester: @semester).order(:name) %>
<% else %>
    <% sections = course.course_sections.where(semester: @semester).order(:name) %>
<% end %>

Zac Wood's avatar
Zac Wood committed
9
<div class="card course-card" id="course-<%= course.id %>">
Zac Wood's avatar
Zac Wood committed
10
    <div class="card-header">
Zac Wood's avatar
Zac Wood committed
11
12
	<div class="row">
	    <div class="col">
13
14
15
		<%= link_to course do %>
		    <h4 class="title"><%= "#{course.subject} #{course.course_number}" %></h4>
		<% end %>
Zac Wood's avatar
Zac Wood committed
16
17
18
	    </div>
	</div>
	<h5><em><%= course.title %></em></h5>
Zac Wood's avatar
Zac Wood committed
19
    </div>
Zac Wood's avatar
Zac Wood committed
20
    <div class="card-body">
Zac Wood's avatar
Zac Wood committed
21
22
23
24
25
	<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
26
		<%= course.credits %> credits
Zac Wood's avatar
Zac Wood committed
27
28
29
30
31
32
	    </div>
	    &nbsp;&nbsp;&nbsp;
	    <div class="attr">
		<div class="icon">
		    <i class="fa fa-bars"></i>
		</div>
33
		 <%= sections.count %> sections
Zac Wood's avatar
Zac Wood committed
34
	    </div>
Zac Wood's avatar
Zac Wood committed
35
	</div>
Zac Wood's avatar
Zac Wood committed
36
37
	<p class="description"><%= course.description %></p>	
	
Zac Wood's avatar
Zac Wood committed
38
39
40
41
42
	<% 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 %>
Zac Wood's avatar
Zac Wood committed
43

44
45
46
47
48
49
50
51
52
53
54
	<% 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
55

Zac Wood's avatar
Zac Wood committed
56
57
	

Zac Wood's avatar
Zac Wood committed
58

Zac Wood's avatar
Zac Wood committed
59
60
61
	
	<!-- List of Course Sections -->
	<div class="list-group list-group-flush sections" style="display: <%= expanded ? "flex" : "none" %>">
62
	    <%= render partial: 'shared/section', collection: sections, locals: { course: course } %>
Zac Wood's avatar
Zac Wood committed
63
	</div>
64
    </div>
Zac Wood's avatar
Zac Wood committed
65
</div>