This repository has been archived by the owner on May 25, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #220 from YACS-RCOS/staging
Sort Periods by Day/Time; Flavor Text in Footer; Day Names on Schedule
- Loading branch information
Showing
16 changed files
with
186 additions
and
28 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
Yacs.views.footer = function (target) { | ||
|
||
var selectFlavorText=function(){ | ||
var choices = [ | ||
'A grass-fed, free-ranged', | ||
'The best', | ||
'Yet another', | ||
"An experimental, GMO'd", | ||
'A radioactive', | ||
'A zombie', | ||
'An', | ||
'A pizza-funded', | ||
'An ice tea powered', | ||
'A lone computer runs this', | ||
"Some guy's", | ||
'A (somewhat) tested', | ||
'Batteries not included in this', | ||
'A GMO-free', | ||
'A mutant', | ||
'The second biggest', | ||
'A longstanding', | ||
"A Red Hat-supported", | ||
"A 100% all natural", | ||
"A third-generation", | ||
"A heavily debugged", | ||
"A filmed on location", | ||
"A Y2K compliant", | ||
"A vortigaunt maintained", | ||
"Degree not included in this", | ||
"Clippy's favorite", | ||
"9/10 mindless drones recommend this", | ||
"Ask your doctor before using this", | ||
"Far more work than necessary went into this", | ||
"Report Any Issues to the Data Mouse for this", | ||
"An officially cursed", | ||
"A caffeine-powered", | ||
"Better than your mother's", | ||
"A kid-tested, mother-approved", | ||
"A science-backed", | ||
"A somewhat broken", | ||
"An official dad approved", | ||
"A PHP-free", | ||
"A dog-friendly", | ||
"A cat-approved", | ||
"A dishwasher-safe" | ||
]; | ||
|
||
var index = Math.floor(Math.random()*choices.length); | ||
return choices[index]; | ||
|
||
}; | ||
var data = { | ||
flavortext: selectFlavorText(), | ||
yacsversion: '0.9' | ||
}; | ||
|
||
Yacs.render(target, 'footer', data); | ||
|
||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<footer-obj> | ||
<footer-column class="footer-column"> | ||
<div><flavortext>{{flavortext}} <a href="http://rcos.io">RCOS</a> project.</flavortext></div> | ||
<inspired-by>Inspired by Jeff Hui's YACS.</inspired-by> | ||
</footer-column> | ||
|
||
<footer-column class="footer-column"> | ||
<div><version-name>YACS Version {{yacsversion}}</version-name></div> | ||
<div><feedback>We love feedback! | ||
<a href="https://github.com/YACS-RCOS/yacs/">Github</a> | ||
| | ||
<a href="mailto:yacsrpi@gmail.com">Email</a></feedback></div> | ||
</footer-column> | ||
</footer-obj> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,4 +18,4 @@ def index | |
end | ||
end | ||
|
||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,4 +7,4 @@ def index | |
query.includes! courses: [:sections] if @show_sections | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,4 +8,4 @@ def index | |
end | ||
@schedules = Scheduler.all_schedules sections | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,4 +8,4 @@ def index | |
end | ||
query.order! :id | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,4 @@ def index | |
filter_model Section | ||
filter_any :id, :course_id, :name, :crn | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
require "rails_helper" | ||
|
||
RSpec.describe Section do | ||
context 'when a section is updated' do | ||
context 'when period information is updated' do | ||
before do | ||
@section = create(:section, num_periods: 5, | ||
periods_day: [3, 5, 2, 2, 4], | ||
periods_start: [1200, 800, 1600, 800, 800], | ||
periods_end: [1400, 900, 1800, 900, 1000], | ||
periods_type: ['LAB', 'LEC', 'TEST', 'LEC', 'LEC']) | ||
end | ||
|
||
it 'sorts periods by day, and then start time' do | ||
expect(@section.num_periods).to eq 5 | ||
expect(@section.periods_day).to eq [2, 2, 3, 4, 5] | ||
expect(@section.periods_start).to eq [800, 1600, 1200, 800, 800] | ||
expect(@section.periods_end).to eq [900, 1800, 1400, 1000, 900] | ||
expect(@section.periods_type).to eq ['LEC', 'TEST', 'LAB', 'LEC', 'LEC'] | ||
end | ||
end | ||
|
||
context 'when non-period information is updated' do | ||
before do | ||
Section.skip_callback(:save, :before, :sort_periods, if: :periods_changed?) | ||
@section = create(:section, num_periods: 5, | ||
periods_day: [3, 5, 2, 2, 4], | ||
periods_start: [1200, 800, 1600, 800, 800], | ||
periods_end: [1400, 900, 1800, 900, 1000], | ||
periods_type: ['LAB', 'LEC', 'TEST', 'LEC', 'LEC']) | ||
Section.set_callback(:save, :before, :sort_periods, if: :periods_changed?) | ||
@section.update(instructors: ['>:-]', ':-)', ':-|', ':-(', '>:-[']) | ||
end | ||
|
||
it 'does not sort period' do | ||
expect(@section.num_periods).to eq 5 | ||
expect(@section.periods_day).to eq [3, 5, 2, 2, 4] | ||
expect(@section.periods_start).to eq [1200, 800, 1600, 800, 800] | ||
expect(@section.periods_end).to eq [1400, 900, 1800, 900, 1000] | ||
expect(@section.periods_type).to eq ['LAB', 'LEC', 'TEST', 'LEC', 'LEC'] | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters