Commit 83ef49d7 authored by Zac Wood's avatar Zac Wood

instructor page updates

parent 98b1aa43
Pipeline #3286 failed with stage
in 2 minutes and 7 seconds
......@@ -8,4 +8,8 @@ class Semester < ApplicationRecord
# Ensure necessary fields are present.
validates :year, presence: true
validates :season, presence: true
def to_s
return "#{season} #{year}"
end
end
<h1><%= @instructor.name %></h1>
<div class="row">
<div class="col-4">
<h1><%= @instructor.name %></h1>
<% prev = @instructor.course_sections.reject { |s| s.course.semester == @semester }.map { |s| s.name.split[0..1].join(' ') }.uniq %>
<% if @courses.any? %>
<%= render partial: 'shared/course', collection: @courses, locals: { expanded: true } %>
<% else %>
<p><%= @instructor.name %> has not taught any courses...</p>
<% end %>
<% if prev.count.positive? %>
<strong>Previously taught: </strong>
<ul>
<% prev.each do |s| %>
<li><%= s %></li>
<% end %>
</ul>
<% end %>
</div>
<div class ="col-8">
<h3><%= @semester.to_s %></h3>
<% if @courses.any? %>
<%= render partial: 'shared/course', collection: @courses, locals: { expanded: true } %>
<% else %>
<p><%= @instructor.name %> is not teaching any courses this semester...</p>
<% end %>
</div>
</div>
......@@ -8,12 +8,6 @@
<h4 class="title"><%= "#{course.subject} #{course.course_number}" %></h4>
<% end %>
</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>
</div>
......
......@@ -4,9 +4,10 @@ Rails.application.routes.draw do
get 'sessions/update', as: 'update_session'
get 'sessions/cart'
resources :courses, only: [:show]
resources :instructors, only: [:index, :show]
get 'schedule', to: 'schedules#show', as: 'schedule'
scope :api do # Register /api routes
resources :courses, only: [:index, :show]
resources :course_sections, only: [:index]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment