show.html.erb 1.42 KB
Newer Older
Zac Wood's avatar
Zac Wood committed
1 2
<%= render partial: 'shared/navbar' %>

Zac Wood's avatar
Zac Wood committed
3
<div class="row">
4
    <div class="col-12 col-lg">
Zac Wood's avatar
Zac Wood committed
5 6 7 8 9 10
		<h1><%= @course.full_name %></h1>
		<h4><%= @course.title %></h4>
		<% unless @rating.nil? %>
			<%= render partial: 'shared/stars', locals: { percent: @course.rating[0]/5*100 } %>
			Average course rating: <%= @course.rating[0] %> / <%= @course.rating[1] %> responses
		<% end %>
Zac Wood's avatar
Zac Wood committed
11

Zac Wood's avatar
Zac Wood committed
12 13 14 15 16 17 18 19 20
		<div class="details">
			<p>
				<i class="fas fa-book"></i>
				<%= @course.credits %> <%= 'credit'.pluralize(@course.credits.to_i) %>
			</p>
			<p>
				<i class="fas fa-clock"></i>
				<span><%= @taught_in %></span>
			</p>
Zac Wood's avatar
Zac Wood committed
21
		</div>
Zac Wood's avatar
Zac Wood committed
22 23

		<p class="mt-3"><%= @course.description %>.</p>
Zac Wood's avatar
Zac Wood committed
24 25
    </div>

26
    <div class="col-12 col-lg">
27 28
		<form class="semester-select" data-controller="semester-select">
			<select name="semester_id" class="form-control" data-action="semester-select#changeSemester" aria-label="Semester">
Zac Wood's avatar
Zac Wood committed
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
				<% @semesters.each do |sem| %>
					<option 
						id="<%= sem.id %>"
						name="semester_id" 
						value="<%= sem.id %>"
						<% if sem.id == params[:semester_id]&.to_i %> selected <% end %>
					>
						<%= sem.to_s %>
					</option>
				<% end %>
			</select>
		</form>
		<% @sections.each do |type, sections| %>
			<% if @sections.keys.length > 1 %>
				<h5 class="section-type-label"><%= type %></h5>
			<% end %>
			<ul class="section-list">
Zac Wood's avatar
Zac Wood committed
46
				<%= render partial: 'shared/section', collection: sections %>
Zac Wood's avatar
Zac Wood committed
47 48
			</ul>
		<% end %>
Zac Wood's avatar
Zac Wood committed
49 50
    </div>
</div>