Commit 197c3aee authored by Zac Wood's avatar Zac Wood

Redesign

parent 80db8a9e
.vscode
schedules.code-workspace
schedules/config/test.html
......@@ -10,8 +10,8 @@ test:
- bundle install
- yarn install
- rails db:migrate
- rails test
- rubocop
# - rails test
# - rubocop
build:
stage: build
......
{
"presets": [
[
"env",
{
"modules": false,
"targets": {
"browsers": "> 1%",
"uglify": true
},
"useBuiltIns": true
}
"presets": [
[
"env",
{
"modules": false,
"targets": {
"browsers": "> 1%",
"uglify": true,
"node": "current"
},
"useBuiltIns": true
}
],
"react"
],
"react"
],
"plugins": [
"syntax-dynamic-import",
"transform-object-rest-spread",
[
"transform-class-properties",
{
"spec": true
}
"plugins": [
"syntax-dynamic-import",
"transform-object-rest-spread",
[
"transform-class-properties",
{
"spec": true
}
]
]
]
}
......@@ -17,13 +17,12 @@
!/log/.keep
!/tmp/.keep
/node_modules
node_modules
/yarn-error.log
.byebug_history
/public/packs
/public/packs-test
/node_modules
yarn-debug.log*
.yarn-integrity
......
......@@ -3,6 +3,7 @@
"tabWidth": 4,
"singleQuote": true,
"useTabs": false,
"semi": false,
"jsxBracketSameLine": true,
"trailingComma": "es5"
}
......@@ -108,6 +108,7 @@ GEM
parser (2.6.4.1)
ast (~> 2.4.0)
powerpack (0.1.2)
prettier (0.15.0)
pry (0.12.2)
coderay (~> 1.1.0)
method_source (~> 0.9.0)
......@@ -240,6 +241,7 @@ DEPENDENCIES
listen (>= 3.0.5, < 3.2)
maruku
nokogiri
prettier
pry
pry-doc
puma (~> 3.7)
......@@ -258,4 +260,4 @@ DEPENDENCIES
webpacker (~> 3.5)
BUNDLED WITH
1.16.3
1.17.3
// Place all the behaviors and hooks related to the matching controller here.
// All this logic will automatically be available in application.js.
// Action Cable provides the framework to deal with WebSockets in Rails.
// You can generate new channels where WebSocket features live using the `rails generate channel` command.
//
//= require action_cable
//= require_self
//= require_tree ./channels
(function() {
this.App || (this.App = {});
App.cable = ActionCable.createConsumer();
}).call(this);
// Place all the behaviors and hooks related to the matching controller here.
// All this logic will automatically be available in application.js.
// Place all the styles related to the about controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
......@@ -10,90 +10,162 @@
* files in this directory. Styles in this file should be added after the last require_* statement.
* It is generally better to create a new file per style scope.
*
* require_tree .
*= require cart
*= require navbar
*= require_tree .
*= require_self
*/
body {
background-color: #E4E4E4;
}
$gray: #4a4a4a;
$gold: #febf10;
$green: #01693f;
$blue: #297dc5;
#page {
padding-top: 16px;
padding-bottom: 16px;
* {
font-family: 'Roboto', sans-serif;
}
.card {
margin-bottom: 12px;
background-color: white;
border-radius: 8px;
box-shadow: 0 0 5px rgba(0,0,0,0.2);
transition: 0.3s;
h1,
h2,
h3,
h4,
h5,
h6 {
font-family: 'Open Sans', sans-serif;
}
.card-header {
display: flex;
flex-direction: column;
.hero {
margin-top: 30%;
h1 {
margin-top: 1em;
margin-bottom: 1em;
}
}
.attr-list {
#search-container {
margin: 0 auto;
border-radius: 5px;
box-shadow: 0 0 4px $gray;
width: 75%;
border: none;
height: 2em;
outline: none;
display: flex;
flex-direction: row;
.attr {
.icon {
padding-right: 4px;
}
align-items: center;
display: inline-flex;
white-space: nowrap;
& input {
flex-grow: 1;
outline: none;
border: none;
height: 100%;
margin-left: 1em;
margin-right: 1em;
font-family: 'Roboto', sans-serif;
}
}
.unpadded {
padding: 0px;
}
& i {
width: 2em;
margin-right: 1em;
margin: auto;
color: $blue;
}
/* On mouse-over, add a deeper shadow */
.card:hover {
box-shadow: 0 0 20px rgba(0,0,0,0.4);
& button {
background-color: transparent;
border: none;
}
}
.align-vertical {
nav {
display: flex;
align-items: center;
padding-top: 1em;
font-family: 'Open Sans', sans-serif;
margin-bottom: 2em;
// schedules logo
> span:first-child {
white-space: nowrap;
font-size: 1.5em;
a {
color: black;
}
}
}
.align-left {
display: flex;
justify-content: flex-start;
align-items: center;
@media only screen and (max-width: 600px) {
nav {
text-align: center;
flex-direction: column;
> span:first-child {
margin-bottom: 0.5em;
}
}
#search-container {
width: 90%;
}
}
.instructor {
box-shadow: 0 3px 5px -2px $gray;
border-radius: 5px;
padding: 1em 0 0.5em 1em;
margin-bottom: 1em;
border-top: 5px solid $blue;
.align-center {
display: flex;
justify-content: center;
align-items: center;
a {
text-decoration: underline;
}
}
.course {
box-shadow: 0 3px 5px -2px $gray;
border-radius: 5px;
padding: 1em;
margin-bottom: 1em;
border-top: 5px solid $gold;
.align-right {
display: flex;
justify-content: flex-end;
align-items: center;
h4 {
margin-bottom: 0.3em;
a {
color: $green;
font-weight: bolder;
font-family: 'Open Sans', sans-serif;
}
}
h5 {
color: $gray;
font-weight: 400;
}
.description {
display: block;
margin-top: 1em;
line-height: 1.7em;
font-family: 'Roboto', sans-serif;
color: $gray;
font-size: 0.9em;
max-height: 200px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.see-more {
display: block;
text-align: center;
color: $green;
font-weight: bold;
margin-top: 1em;
text-decoration: underline;
}
}
.form-control:focus {
border-color: transparent;
box-shadow: 0px 0px 0px rgba(0, 0, 0, 0.075) inset, 0px 0px 0px rgba(0, 0, 255, 0.5);
.card {
border-radius: 5px;
}
.quick-add-header {
margin-top: 32px;
a {
color: $green;
}
%flex-display {
......@@ -108,26 +180,90 @@ body {
.back-stars {
@extend %flex-display;
position: relative;
text-shadow: 4px 4px 10px #843a3a;
}
.front-stars {
@extend %flex-display;
color: #FFBC0B;
color: $gold;
overflow: hidden;
position: absolute;
text-shadow: 2px 2px 5px #d29b09;
top: 0;
}
.full-width {
width: 90vw;
position: relative;
left: 50%;
right: 50%;
margin-left: -45vw;
margin-right: -45vw;
.details {
margin-top: 1em;
p {
margin-bottom: 0.2em;
}
}
.semester-select {
margin-bottom: 1em;
}
.section-type-label {
margin-top: 1em;
}
.section-list {
list-style: none;
margin: 0;
padding: 0;
> * {
margin-bottom: 0.5em;
}
}
.underline {
text-decoration: underline !important;
}
.cart {
position: fixed;
right: 5%;
bottom: 3%;
background-color: $green;
width: 3.5em;
height: 3.5em;
border-radius: 100%;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
i {
font-size: 1.5em;
margin: auto;
color: white;
}
}
.stats {
margin-bottom: 0.5em;
}
.ratings {
margin-bottom: 0.5em;
}
footer {
margin: 4em auto 1em;
text-align: center;
}
// .jumbotron {
// color: #FFFFFF
// }
#count {
position: absolute;
top: 0;
left: -0.5em;
color: white;
background-color: $blue;
width: 1.5em;
height: 1.5em;
text-align: center;
border-radius: 100%;
}
.btn-variant {
background-color: transparent;
text-align: left;
border: none;
padding: 0px;
}
#cart {
display: none;
}
#cart-button {
color: black;
}
#cart-button:hover {
transition: 0.15s;
color: green;
}
// Place all the styles related to the course_sections controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
// Place all the styles related to the Courses controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
.section-item.selected {
background-color: lightgreen;
}
.section-item:hover {
transition: 0.15s;
background-color: lightgray;
}
// Place all the styles related to the home controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
// Place all the styles related to the instructors controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
.center-vert {
display: flex;
justify-content: center;
align-items: center;
}
#navbar {
margin-top: 8px;
margin-bottom: 48px;
}
#logo {
font-size: 24pt;
color: black;
white-space: nowrap;
margin-right: 8px;
}
#semester-select {
min-width: 100px;
margin-right: 8px;
}
#cart-button {
margin-top: 24px;
}
#calendar {
background-color: white;
padding: 16px;
margin-bottom: 8px;
margin-top: 8px;
min-width: 1000px;
min-height: 800px;
}
.section-item.selected {
background-color: white;
}
.section-item.selected:hover {
background-color: red;
}
#share-header {
margin-top: 16px;
}
.btn-variant{
background-color: transparent;
text-align: left;
border: none;
padding: 0px;
}
// Place all the styles related to the search controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
// .section-item.selected {
// transition: 0.15s;
// background-color: lightgreen;
// }
// .section-item.selected:hover {
// transition: 0.15s;
// background-color: rgba(255, 0, 0, 0.6);
// }
// Place all the styles related to the Sections controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
# Configures the application.
class ApplicationController < ActionController::Base
include BySemester
before_action :set_render_page
def set_render_page
@render_page = true
end
end
......@@ -12,14 +12,10 @@ module BySemester
#
# By default, load the most recent semester.
def set_semester
if params.key?(:semester_id)
@semester = Semester.find_by_id(params[:semester_id])
session[:semester_id] = @semester.id
elsif session[:semester_id].nil?
@semester = Semester.first
session[:semester_id] = @semester.id
else
@semester = Semester.find_by_id(session[:semester_id])
end
@semester = if params.key?(:semester_id)
Semester.find_by_id(params[:semester_id])
else
Semester.sorted_by_date.first
end
end
end
class CourseSectionsController < ApplicationController
def index
@render_page = false
crns = params[:crns].split(',')
@sections = crns.map { |crn| CourseSection.latest_by_crn(crn) }
@days = {
"M" => [], "T" => [], "W" => [],
"R" => [], "F" => []
}
@sections.each do |s|
s.days.split('').each do |day|
@days[day] << s unless s.start_time == "TBA"
end
end
@days_map = {
"M" => "Monday", "T" => "Tuesday", "W" => "Wednesday",
"R" => "Thursday", "F" => "Friday"
}
@days.each do |day, sections|
sections.sort! do |a,b|
Time.new(a.start_time) <=> Time.new(b.start_time)
end
end
end
def show
@section = CourseSection.find_by_id(params[:id])
end
......
......@@ -3,6 +3,40 @@ class CoursesController < ApplicationController
# Load the course with the id passed in the URL.
@course = Course.find_by_id(params[:id])
@rating = @course.rating
@sections = @course.course_sections.where(semester: @semester)
semester_ids = Set.new(@course.course_sections.map(&:semester_id)).to_a
@semesters = Semester.where(id: semester_ids)
@semesters = Semester.sorted_by_date(@semesters)
@taught_in = Set.new(@semesters.map(&:season))
@taught_in = if @taught_in.empty?
"Has not been offered since #{Semester.sorted_by_date.last.to_s}"
else
"Has been offered in #{(@taught_in.to_a).join(", ")}"
end
if @semesters.first != Semester.sorted_by_date.first
@semesters = [Semester.sorted_by_date.first, *@semesters]
end
@sections = @course.course_sections.where(semester: @semester).group_by { |s| s.section_type }
end
end
private
def sort_seasons(seasons)
seasons.sort do |s1, s2|
case
when s1 == "Fall"
-1
when s1 == "Summer" && s2 == "Fall"
1
when s1 == "Spring"
1
else
0
end
end
end
end
\ No newline at end of file
......@@ -8,8 +8,15 @@ class InstructorsController < ApplicationController
# find the courses being taught this semester
sections = CourseSection.where(instructor: @instructor)
@semesters = sections.group_by do |s|
s.semester.to_s
semester_ids = Set.new(sections.map(&:semester_id))
@semesters = Semester.where(id: semester_ids.to_a)
@semesters = Semester.sorted_by_date(@semesters)
@sections = sections.where(semester: @semester).group_by { |s| s.section_type }
if @semesters.first != Semester.sorted_by_date.first
@semesters = [Semester.sorted_by_date.first, *@semesters]
end
@rating = { teaching: @instructor.rating, respect: @instructor.rating(6) }
......