_course.html.erb 2.16 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
    <div class="card-body">
Zac Wood's avatar
Zac Wood committed
19 20 21 22 23 24 25 26 27 28 29 30
	<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>
31 32
		<!-- TODO: FIX THIS -->
		<%#= "#{course.section_count}" %> 3 sections
Zac Wood's avatar
Zac Wood committed
33
	    </div>
Zac Wood's avatar
Zac Wood committed
34 35
	</div>
	<p class="description"><%= course.description %></p>
Zac Wood's avatar
Zac Wood committed
36

Zac Wood's avatar
Zac Wood committed
37 38 39 40 41 42 43 44 45 46 47 48 49
	<% 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" %>">
50 51 52 53 54 55 56 57 58 59 60 61 62
	    <% if course.has_labs? && !course.lab_course? %>
		<% course.course_sections.each do |section| %>
		    <% lecture_list = section.labs %>
		    <% unless lecture_list.nil? %>
			<% lecture_list.each do |list| %>
			    <div class="pair">
				<%= render partial: 'shared/section', object: list.first, locals: { course: course } %>
				<%= render partial: 'shared/section', object: list.last, locals: { course: course } %>
			    </div>
			    <hr />
			<% end %>
		    <% end %>
		<% end %>
63
	    <% else %>
Zac Wood's avatar
Zac Wood committed
64
		<%= render partial: 'shared/section', collection: course.course_sections, locals: { course: course } %>
65
	    <% end %>
Zac Wood's avatar
Zac Wood committed
66
	</div>
67
    </div>
Zac Wood's avatar
Zac Wood committed
68
</div>