_course.html.erb 1.69 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
	<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 20 21 22 23 24 25 26
	<div class="attr-list justify-content-start">
	    <div class="attr">
		<div class="icon">
		    <i class="fa fa-book"></i>
		</div>
		3 credits
	    </div>
	    &nbsp;&nbsp;&nbsp;
	    <div class="attr">
		<div class="icon">
		    <i class="fa fa-bars"></i>
		</div>
27 28
		<!-- TODO: FIX THIS -->
		<%#= "#{course.section_count}" %> 3 sections
Zac Wood's avatar
Zac Wood committed
29
	    </div>
Zac Wood's avatar
Zac Wood committed
30 31
	</div>
	<p class="description"><%= course.description %></p>
Zac Wood's avatar
Zac Wood committed
32

Zac Wood's avatar
Zac Wood committed
33 34 35 36 37 38 39 40 41 42 43 44 45
	<% 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" %>">
46 47
	    <% if defined?(@instructor) %>
		<%= render partial: 'shared/section', collection: course.course_sections.where(instructor: @instructor), locals: { course: course } %>
48
	    <% else %>
Zac Wood's avatar
Zac Wood committed
49
		<%= render partial: 'shared/section', collection: course.course_sections, locals: { course: course } %>
50
	    <% end %>
Zac Wood's avatar
Zac Wood committed
51
	</div>
52
    </div>
Zac Wood's avatar
Zac Wood committed
53
</div>