Commit d213fe83 authored by Zac Wood's avatar Zac Wood
Browse files

Merge branch 'dev-v3' into 'master'

Version 3

See merge request !51
parents b6309e4e 80cf9394
Pipeline #4473 passed with stage
in 2 minutes and 47 seconds
......@@ -2,8 +2,12 @@
<div class="col-12 col-lg">
<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 %>
<div class="d-flex">
<div class="d-flex mt-2">
<div class="attr-list justify-content-start">
<div class="attr">
<div class="icon">
......@@ -20,7 +24,7 @@
</div>
</div>
</div>
<p><%= @course.description %></p>
<p class="mt-3"><%= @course.description %></p>
</div>
<div class="col-12 col-lg">
......@@ -29,5 +33,5 @@
</div>
<%= javascript_pack_tag 'search' %>
<%= javascript_pack_tag 'instructor' %>
<%= stylesheet_link_tag 'search' %>
<div class="jumbotron text-center">
<h1>SRCT Schedules</h1>
<h1><i class="fas fa-calendar-alt"></i>&nbsp;SRCT Schedules</h1>
<p class="lead">Build, share, and export your schedule. Search for classes and professors.</p>
<hr>
<p>
......@@ -8,7 +8,7 @@
</p>
</div>
<div class="row">
<div class="row ">
<div class="col-md-4">
<div class="card">
<div class="card-body">
......@@ -36,24 +36,6 @@
</div>
</div>
<div id="quick-add" />
<h3 class="quick-add-header">Quick add</h3>
<p>Want to quickly generate a calendar populated with your semester's classes? Enter the CRNs in a comma separated list below.</p>
<form action="/sessions/add_bulk" class="form">
<div class="input-group">
<input
id="crns"
name="crns"
type="text"
class="form-control"
placeholder="12345,54321,..."
aria-describedby="basic-addon2"
autocomplete="off"
>
<div class="input-group-append">
<button type="submit" class="btn btn-primary" type="button">
Populate Calendar
</button>
</div>
</div>
</form>
<%= javascript_pack_tag 'home' %>
<div class="row">
<div class="col-lg-4 col-12">
<div class="col-lg-4 col-12 mb-4">
<h1><%= @instructor.name %></h1>
<% if @past.count.positive? %>
<strong>Previously taught: </strong>
<ul>
<% @past.each do |c| %>
<li><%= link_to(c.full_name, course_path(c)) %></li>
<% end %>
</ul>
<% unless @rating[:teaching].nil? %>
<%= render partial: 'shared/stars', locals: { percent: @rating[:teaching][0]/5*100 } %><br>
Average teaching rating: <%= @rating[:teaching][0] %> / <%= @rating[:teaching][1] %> responses
<% end %>
</div>
<div class ="col-lg-8 col-12">
<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>
<div class="col-lg-8 col-12">
<% @semesters.each do |semester, sections| %>
<h2><%= semester %></h2>
<%= render(partial: 'shared/section', collection: sections, locals: { show_instr: false }) %>
<br/>
<% end %>
</div>
</div>
<%= javascript_pack_tag 'search' %>
<%= javascript_pack_tag 'instructor' %>
<%= stylesheet_link_tag 'search' %>
......@@ -5,6 +5,8 @@
<%= csrf_meta_tags %>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<%= Gon::Base.render_data %>
<%= javascript_include_tag 'masonstrap.min' %>
<%= stylesheet_link_tag 'masonstrap.min' %>
......@@ -16,7 +18,7 @@
<meta property="og:url" content="https://schedules.gmu.edu/">
<meta property="og:type" content="website">
<meta property="og:title" content="SRCT Schedules">
<meta property="og:description" content="Easily generate a calendar with your class schedule.">
<meta property="og:description" content="Browse the GMU catalog, see course reviews, build and share your schedule.">
<meta property="og:site_name" content="SRCT Schedules">
<meta property="og:locale" content="en_US">
<meta property="article:author" content="SRCT">
......@@ -27,7 +29,11 @@
<meta name="twitter:creator" content="@MasonSRCT">
<meta name="twitter:url" content="https://schedules.gmu.edu/">
<meta name="twitter:title" content="SRCT Schedules">
<meta name="twitter:description" content="Easily generate a calendar with your class schedule.">
<meta name="twitter:description" content="Browse the GMU catalog, see course reviews, build and share your schedule.">
<!-- favicons -->
<%= favicon_link_tag %>
<link href="<%= asset_path 'favicon-32x32.png' %>" sizes="32x32" rel="shortcut icon" type="image/png" />
</head>
<body>
......
<%= javascript_pack_tag 'schedules' %>
<%= stylesheet_link_tag 'schedules' %>
<%= javascript_include_tag 'moment.min' %>
<%= stylesheet_link_tag 'fullcalendar.min' %>
<button id="open-modal-btn" type="button" class="btn btn-primary" data-toggle="modal" data-target="#exportModal">
Export Schedule
</button>
<button id="save-image" class="btn btn-secondary">Save Image</button>
<div id="calendar"></div>
<h3>Quick add</h3>
<p>Populate your calendar quickly by entering a comma separated list of CRNs.</p>
<form action="/sessions/add_bulk" class="form">
<div class="input-group">
<input
id="crns"
name="crns"
type="text"
class="form-control"
placeholder="12345,54321,..."
aria-describedby="basic-addon2"
autocomplete="off"
>
<div class="input-group-append">
<button type="submit" class="btn btn-primary" type="button">
Populate Calendar
</button>
</div>
</div>
</form>
<h3 id="share-header">Share</h3>
Want to share your schedule with your friends? Send them this link:<br/>
<a id="share-url"></a>
<template id="events" data-events="<%= @events.to_json %>"></template>
<hr />
<h2>Selected Courses</h2>
<%= render partial: 'shared/section', collection: @all %>
<!-- Export Modal -->
<div class="modal fade" id="exportModal" tabindex="-1" role="dialog" aria-labelledby="exportModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exportModalLabel">Your calendar has been generated!</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<h5>Apple Calendar</h5>
To add your schedule to Apple Calendar, click the "Add to calendar" button below. If you are on a device
running macOS or iOS, this will open a dialogue which will walk you through adding the calendar.
<hr />
<h5>Google Calendar</h5>
<strong>On desktop:</strong>
<br />
First, download the calendar file using the "Download calendar file" below. Open your <a href="https://calendar.google.com/" target="_blank">Google Calendar</a>. Click the "Settings" button in the top
right, and then click the Settings tab. In the menu on the left, click "Import & export" and "Import". Now, upload the calendar file you downloaded and click "Import".
<br />
<strong>On mobile (Android only):</strong>
<br />
Click the "Download calendar file" button. This will download the calendar file which you may then open and
add to your calendar.
<hr />
<h5>Outlook Calendar</h5>
<strong>On desktop (Windows):</strong>
<br>
First, download the calendar file using the “Download calendar file” button below. In Outlook, choose File, then Open and Export, and then Import/Export. In the Import and Export Wizard Box, choose “Import and iCalendar (.ics) or vCalendar file (.vcs)” and the “next” button. Search for the button you downloaded in the beginning. Click “Okay” and then “Import.”
<br>
<strong>On desktop (Mac):</strong>
First, download the calendar file using the “Download calendar file” button below. Open Outlook and make sure the calendar in which you want to import the file into has a checkmark next to it. Alternatively, you can add it into a new calendar by clicking the “Organize” tab and then the “New Calendar” button. Double click the new Calendar to rename it. Open the Finder application and search for the file you downloaded in the beginning. Then, drag and drop the file into the desired Calendar area.
<br>
<strong>Outlook Online (Classic Layout)</strong>
To check if you are using the Classic Layout, look in the top right and see if “The new Outlook” bar is slid to the left. If it is not, you may consider reading “The New Outlook Layout” instructions or clicking the bar to slide it to the left. First, download the calendar file using the “Download calendar file” button below. Login onto your <a href=https://outlook.live.com/owa/ target="blank">Outlook</a> and click the calendar icon on the bottom left. On the menu bar, located above the Calendar, choose the “Add Calendar” menu. From the drop down menu, click import from file and browse for the calendar file you downloaded in the beginning. Click the save icon, then the calendar will be imported.
<br>
<strong>Outlook Online (New Outlook Layout)</strong>
To check if you are using the New Outlook Layout, look in the top right and see if “The new Outlook” bar is slid to the right. If it is not, you may consider reading the “Classic Layout” instructions or clicking the bar to slide it to the right. First download the calendar file using the “Download calendar file” button below. Login onto your <a href=https://outlook.live.com/owa/ target="blank">Outlook</a> and click the calendar icon on the bottom left. On the left side bar, under “Calendars”, click the “Discover calendars” button. Choose on the “From File” menu under the “Import” Section. Then click the browse button and search for the file you downloaded in the beginning. Lastly, choose “Import” and your calendar will be displayed.
<h5>.ics file</h5>
To download a .ics file containing your schedule, click the "Download calendar file" button below.
</div>
<div class="modal-footer flex">
<button id="download-ics" type="button" class="btn btn-secondary">Download calendar file</button>
<button id="add-to-system" type="button" class="btn btn-primary">Add to system calendar</button>
</div>
</div>
</div>
</div>
<div id="root"></div>
<%= javascript_pack_tag 'schedules_view' %>
<%= stylesheet_link_tag 'schedules' %>
<%= stylesheet_link_tag 'fullcalendar.min' %>
<button id="open-modal-btn" type="button" class="btn btn-primary" data-toggle="modal" data-target="#exportModal">
Export Schedule
</button>
<button id="save-image" class="btn btn-secondary" onclick="saveImage()">Save Image</button>
<div id="calendar"></div>
<template id="events" data-events="<%= @events.to_json %>"></template>
<hr />
<h2>Selected Courses</h2>
<%= render partial: 'shared/section', collection: @all, locals: { editable: false } %>
<!-- Export Modal -->
<div class="modal fade" id="exportModal" tabindex="-1" role="dialog" aria-labelledby="exportModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exportModalLabel">Your calendar has been generated!</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<h5>Apple Calendar</h5>
To add your schedule to Apple Calendar, click the "Add to calendar" button below. If you are on a device
running macOS or iOS, this will open a dialogue which will walk you through adding the calendar.
<hr />
<h5>Google Calendar</h5>
<strong>On desktop:</strong>
<br />
First, download the calendar file using the "Download calendar file" below. Open your <a href="https://calendar.google.com/" target="_blank">Google Calendar</a>. Click the "Settings" button in the top
right, and then click the Settings tab. In the menu on the left, click "Import & export" and "Import". Now, upload the calendar file you downloaded and click "Import".
<br />
<strong>On mobile (Android only):</strong>
<br />
Click the "Download calendar file" button. This will download the calendar file which you may then open and
add to your calendar.
<hr />
<h5>.ics file</h5>
To download a .ics file containing your schedule, click the "Download calendar file" button below.
</div>
<div class="modal-footer flex">
<button id="download-ics" type="button" class="btn btn-secondary">Download calendar file</button>
<button id="add-to-system" type="button" class="btn btn-primary">Add to system calendar</button>
</div>
</div>
</div>
</div>
<div id="root"></div>
<% unless @instructors.nil? %>
<h2>Instructors</h2>
<div class="row">
<% @instructors.each do |instructor| %>
<div class="col"><%= render partial: 'shared/instructor', object: instructor %></div>
<% end %>
</div>
<hr />
<% end %>
<% unless @courses.nil? %>
<h2>Courses</h2>
<% @courses.each do |course| %>
<div class="col"><%= render partial: 'shared/course', object: course %></div>
<% end %>
<% end %>
<% if @courses.nil? && @instructors.nil? %>
<h1>Sorry, we couldn't find anything matching your search.</h1>
<p>Please try again!</p>
<% end %>
<div id="root"></div>
<%= javascript_pack_tag 'search' %>
<%= stylesheet_link_tag 'search' %>
......@@ -15,32 +15,29 @@
<% end %>
</div>
</div>
<h5><em><%= course.title %></em></h5>
</div>
<div class="card-body">
<div class="attr-list justify-content-start">
<div class="attr">
<div class="icon">
<i class="fa fa-book"></i>
</div>
<%= course.credits %> credits
</div>
&nbsp;&nbsp;&nbsp;
<div class="attr">
<div class="icon">
<i class="fa fa-bars"></i>
<div class="d-md-flex justify-content-between">
<h5><em><%= course.title %></em></h5>
<div class="attr-list justify-content-start">
<div class="attr">
<div class="icon">
<i class="fa fa-book"></i>
</div>
<%= course.credits %> credits
</div>
<%= sections.count %> sections
&nbsp;&nbsp;&nbsp;
</div>
</div>
<p class="description"><%= course.description %></p>
</div>
<div class="card-body">
<p class="description"><%= course.description %></p>
<% unless course.prereqs.nil? || course.prereqs.empty? %>
<% first, rest = course.prereqs.split(':') %>
<% prereqs, note = rest.split('.') %>
<p><strong><%= first %>:</strong> <%= prereqs %> <sub><%= note %></sub></p>
<% end %>
<% if expanded %>
<div class="d-block" style="text-align: center">
<p id="chevron-label" style="margin-bottom:-4px; font-size: 10px;">Minimize</p>
......@@ -52,10 +49,14 @@
<i id="course-chevron" class="fas fa-chevron-down"></i>
</div>
<% end %>
<!-- List of Course Sections -->
<div class="list-group list-group-flush sections" style="display: <%= expanded ? "flex" : "none" %>">
<%= render partial: 'shared/section', collection: sections, locals: { course: course } %>
</div>
</div>
</div>
......@@ -7,13 +7,6 @@
</div>
<%= link_to instructor.name, instructor_path(instructor) %>
</div>
&nbsp;&nbsp;&nbsp;
<div class="attr">
<div class="icon">
<i class="fa fa-bars"></i>
</div>
<%= "#{instructor.section_count}" %> sections
</div>
</div>
</div>
</div>
<div id="navbar" class="container-fluid">
<div class="row align-left align-sm-center align-md-right" id="navbar">
<div class="col align-center">
<div class="center-vert">
<a href="/" id="logo">
<i class="fas fa-calendar-alt"></i>
Schedules
</a>
<nav class="navbar navbar-expand-lg navbar-dark" style="background-color: #006633">
<div class="container">
<a class="navbar-brand mb-0 h1" href="/">
<i class="fas fa-calendar-alt"></i>
Schedules
</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarTogglerDemo02" aria-controls="navbarTogglerDemo02" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarTogglerDemo02">
<ul class="navbar-nav mr-auto mt-2 mt-lg-0">
<li class="nav-item">
<a href="/schedule" class="nav-link">Your Schedule (<span id="cart-counter"></span>)</a>
</li>
<li class="nav-item">
<a href="/about" class="nav-link">About Schedules</a>
</li>
</ul>
<form action="/search" class="form-inline">
<select id="semester-select" class="custom-select">
<% Semester.all.each do |semester| %>
<option
......@@ -16,30 +29,9 @@
</option>
<% end %>
</select>
</div>
</div>
<div class="col-sm align-center order-0 order-sm-1">
<a id="cart-button" href="<%= schedule_path %>">
<h1>
<span class="fa-layers fa-fw" id="schedule-icon">
<i class="fas fa-shopping-cart"></i>
<span class="fa-layers fa-fw">
<i class="fas fa-circle" data-fa-transform="shrink-3 up-12 right-12" style="color:gray"></i>
<span id="course-counter" class="fa-layers-text fa-inverse" data-fa-transform="shrink-10 up-12 right-12" style="font-weight:600">
<%= @cart.length %>
</span>
</span>
</span>
</h1>
</a>
</div>
<div class="col order-1 order-sm-0">
<form action="/search" class="form">
<div class="input-group" style="width:100%;">
<input
id="searchbar"
<input
id="searchbar"
value="<%= params[:query] %>"
name="query"
type="text"
......@@ -47,14 +39,11 @@
placeholder="Search course or professor..."
aria-describedby="basic-addon2"
autocomplete="off"
>
<div class="input-group-append">
<button type="submit" class="btn btn-secondary" type="button">
<i class="fas fa-search"></i>
</button>
</div>
</div>
>
<button class="btn btn-secondary my-2 my-sm-0" type="submit">Search</button>
</form>
</div>
</div>
</div>
</nav>
<div class="container-fluid">
<div class="container">
<!-- The main screen consists of a row with two columns: the search results, and the cart -->
<div class="row">
<div id="page" class="row">
<!-- Search result, List of Courses -->
<div class="col-lg-8 col-12 col-sm-10 mx-auto order-2 order-lg-0" id="search-list">
<div class="col-lg-12 col-12 col-sm-12 mx-auto order-2 order-lg-0" id="search-list">
<%= yield %>
</div>
<!-- List of sections in the cart -->
</div>
<footer class="footer">
Schedules was built by <a href="https://srct.gmu.edu">Mason SRCT</a> and is completely open source. <br/>
Want to contribute? View the code on the <a href="https://git.gmu.edu/srct/schedules">SRCT GitLab</a>.<br/>
</footer>
</div>
<template id="cart-data" data-cart="<%= @cart.to_json %>"></template>
......@@ -2,6 +2,10 @@
<% editable = true %>
<% end %>
<% unless defined?(show_instr) %>
<% show_instr = true %>
<% end %>
<li id="section-<%= section.id %>"
class="list-group-item section-item"
data-crn="<%= section.crn %>"
......@@ -9,22 +13,35 @@
data-cid="<%= course.id if defined?(course) %>"
data-type="<%= section.section_type %>"
>
<p><b class="subj"><%= "#{section.name}" %></b>: <%= section.title %></p>
<p><b class="subj"><%= "#{section.name}" %></b>: <%= section.title %> <em><%= "(##{section.crn})"%></em></p>
<% if editable %>
<% if in_cart? section.crn %>
<span class="float-right text-center add-remove-btn"><i id="icon" class="fas fa-minus"></i><br/><span class="text">Remove</span></span>
<% else %>
<span class="float-right text-center add-remove-btn"><i id="icon" class="fas fa-plus"></i><br/><span class="text">Add</span></span>
<% end %>
<span class="float-right text-center add-remove-btn"><i id="icon" class="fas fa-ellipsis-h"></i><br/><span class="text">Add</span></span>
<% end %>
<i class="fas fa-chalkboard-teacher"></i>
<% if section.instructor.name == "TBA" %>
TBA
<% else %>
<%= link_to section.instructor.name, section.instructor %><% end %> <br/>
<%= link_to section.instructor.name, section.instructor %>
<% unless section.instructor.rating.nil? || !show_instr %>
<%= render partial: 'shared/stars', locals: { percent: (section.instructor.rating[0] / 5 * 100).to_i }%>
<% end %>
<% end %>
<br/>
<i class="fas fa-map-marker-alt"></i> <%= section.location %> <br/>
<i class="fas fa-clock"></i> <%= "#{section.days}, #{section.start_time}-#{section.end_time}" %> <br/>
<% unless section.rating_questions.empty? %>
<br/>
<b>Rating Info</b> (<%= link_to("See all ratings", course_section_url(section))%>)
<ul>
<li>Instructor rating: <%= section.teaching_rating %></li>
<li>Course rating: <%= section.course_rating %></li>
</ul>
<% end %>
</li>
<div class="star-rating">
<div class="back-stars">
<i class="fas fa-star" aria-hidden="true"></i>
<i class="fas fa-star" aria-hidden="true"></i>
<i class="fas fa-star" aria-hidden="true"></i>
<i class="fas fa-star" aria-hidden="true"></i>
<i class="fas fa-star" aria-hidden="true"></i>
<div class="front-stars" style="width: <%= percent %>%">
<i class="fa fa-star" aria-hidden="true"></i>
<i class="fa fa-star" aria-hidden="true"></i>
<i class="fa fa-star" aria-hidden="true"></i>
<i class="fa fa-star" aria-hidden="true"></i>
<i class="fa fa-star" aria-hidden="true"></i>
</div>
</div>
</div>
# Registers all routes for the app.
Rails.application.routes.draw do
get 'about', to: 'about#index', as: 'about'
get '/', to: 'home#index', as: 'home'
get 'search', to: 'search#index'
get 'search', to: 'search#index', as: 'search'
get 'sessions/update', as: 'update_session'
get 'sessions/cart'
get 'sessions/add_bulk'
resources :courses, only: [:show]