_course.html.erb 1.83 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
	    </div>
	</div>
Zac Wood's avatar
Zac Wood committed
18
19
20
21
22
23
24
25
	<div class="d-md-flex justify-content-between">
	    <h5><em><%= course.title %></em></h5>
	    <div class="attr-list justify-content-start">
		<div class="attr">
		    <div class="icon">
			<i class="fa fa-book"></i>
		    </div>
		    <%= course.credits %> credits
Zac Wood's avatar
Zac Wood committed
26
		</div>
Zac Wood's avatar
Zac Wood committed
27
		&nbsp;&nbsp;&nbsp;
Zac Wood's avatar
Zac Wood committed
28
	    </div>
Zac Wood's avatar
Zac Wood committed
29
	</div>
Zac Wood's avatar
Zac Wood committed
30
31
32
    </div>
    <div class="card-body">
	
Zac Wood's avatar
Zac Wood committed
33
34
	<p class="description"><%= course.description %></p>	
	
Zac Wood's avatar
Zac Wood committed
35
36
37
38
39
	<% 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
40

41
42
43
44
45
46
47
48
49
50
51
	<% 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
52

Zac Wood's avatar
Zac Wood committed
53
54
	

Zac Wood's avatar
Zac Wood committed
55

Zac Wood's avatar
Zac Wood committed
56
57
58
	
	<!-- List of Course Sections -->
	<div class="list-group list-group-flush sections" style="display: <%= expanded ? "flex" : "none" %>">
Zac Wood's avatar
Zac Wood committed
59
	    
Zac Wood's avatar
Zac Wood committed
60
	</div>
61
    </div>
Zac Wood's avatar
Zac Wood committed
62
</div>