Commit 10a8b407 authored by Zac Wood's avatar Zac Wood

Added instructors to seach results

parent 759d2585
...@@ -42,6 +42,7 @@ class SearchController < ApplicationController ...@@ -42,6 +42,7 @@ class SearchController < ApplicationController
c.serializable_hash.merge(url: course_url(c)) c.serializable_hash.merge(url: course_url(c))
end end
gon.courses = @courses gon.courses = @courses
gon.instructors = @instructors
end end
/[0-9]{5}/.match(params[:query]) do |m| /[0-9]{5}/.match(params[:query]) do |m|
......
...@@ -4,7 +4,8 @@ import Cart from 'src/Cart'; ...@@ -4,7 +4,8 @@ import Cart from 'src/Cart';
import QuickAdd from 'src/QuickAdd'; import QuickAdd from 'src/QuickAdd';
document.addEventListener('DOMContentLoaded', () => { document.addEventListener('DOMContentLoaded', () => {
const calendarUrl = `${window.location.protocol}//${window.location.hostname}${window.location.port == 3000 ? ':3000' : ''}/schedule`; //const calendarUrl = `${window.location.protocol}//${window.location.hostname}${window.location.port == 3000 ? ':3000' : ''}/schedule`;
const calendarUrl = '/schedule';
ReactDOM.render( ReactDOM.render(
<QuickAdd <QuickAdd
loadCalendar={() => { loadCalendar={() => {
......
...@@ -33,7 +33,6 @@ const initSearchListeners = () => { ...@@ -33,7 +33,6 @@ const initSearchListeners = () => {
sectionItems.forEach(item => { sectionItems.forEach(item => {
const icon = $(item.querySelector('.add-remove-btn #icon')); const icon = $(item.querySelector('.add-remove-btn #icon'));
const text = item.querySelector('.add-remove-btn .text'); const text = item.querySelector('.add-remove-btn .text');
console.log(item.dataset.crn);
if (Cart.includesCrn(item.dataset.crn)) { if (Cart.includesCrn(item.dataset.crn)) {
icon.addClass('fa-minus').removeClass('fa-plus'); icon.addClass('fa-minus').removeClass('fa-plus');
text.innerText = 'Remove'; text.innerText = 'Remove';
......
...@@ -23,8 +23,8 @@ ...@@ -23,8 +23,8 @@
import React from 'react'; import React from 'react';
import ReactDOM from 'react-dom'; import ReactDOM from 'react-dom';
import CourseList from 'src/CourseList'; import SearchList from 'src/SearchList';
document.addEventListener('DOMContentLoaded', () => { document.addEventListener('DOMContentLoaded', () => {
ReactDOM.render(<CourseList courses={gon.courses} />, document.getElementById('root')); ReactDOM.render(<SearchList courses={gon.courses} instructors={gon.instructors} />, document.getElementById('root'));
}); });
<div class="row"> <div class="row">
<div class="col-lg-4 col-12"> <div class="col-lg-4 col-12 mb-4">
<h1><%= @instructor.name %></h1> <h1><%= @instructor.name %></h1>
<% unless @rating[:teaching].nil? %> <% unless @rating[:teaching].nil? %>
Average rating: <%= @rating[:teaching][0] %> / <%= @rating[:teaching][1] %> responses Average teaching rating: <%= @rating[:teaching][0] %> / <%= @rating[:teaching][1] %> responses
<% end %> <% end %>
</div> </div>
<div class="col-lg-8 col-12"> <div class="col-lg-8 col-12">
<% @semesters.each do |semester, sections| %> <% @semesters.each do |semester, sections| %>
......
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