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 ...@@ -8,4 +8,8 @@ class Semester < ApplicationRecord
# Ensure necessary fields are present. # Ensure necessary fields are present.
validates :year, presence: true validates :year, presence: true
validates :season, presence: true validates :season, presence: true
def to_s
return "#{season} #{year}"
end
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? %> <% 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 } %> <%= render partial: 'shared/course', collection: @courses, locals: { expanded: true } %>
<% else %> <% else %>
<p><%= @instructor.name %> has not taught any courses...</p> <p><%= @instructor.name %> is not teaching any courses this semester...</p>
<% end %> <% end %>
</div>
</div>
...@@ -8,12 +8,6 @@ ...@@ -8,12 +8,6 @@
<h4 class="title"><%= "#{course.subject} #{course.course_number}" %></h4> <h4 class="title"><%= "#{course.subject} #{course.course_number}" %></h4>
<% end %> <% end %>
</div> </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> </div>
<h5><em><%= course.title %></em></h5> <h5><em><%= course.title %></em></h5>
</div> </div>
......
...@@ -4,6 +4,7 @@ Rails.application.routes.draw do ...@@ -4,6 +4,7 @@ Rails.application.routes.draw do
get 'sessions/update', as: 'update_session' get 'sessions/update', as: 'update_session'
get 'sessions/cart' get 'sessions/cart'
resources :courses, only: [:show]
resources :instructors, only: [:index, :show] resources :instructors, only: [:index, :show]
get 'schedule', to: 'schedules#show', as: 'schedule' get 'schedule', to: 'schedules#show', as: 'schedule'
......
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