Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SRCT
schedules
Commits
2b672463
Commit
2b672463
authored
May 11, 2019
by
Zac Wood
Browse files
Resolve "Show instructors in search"
parent
d3970aa1
Changes
18
Hide whitespace changes
Inline
Side-by-side
.prettierrc
0 → 100644
View file @
2b672463
{
"printWidth": 120,
"tabWidth": 4,
"singleQuote": true,
"useTabs": false,
"jsxBracketSameLine": true,
"trailingComma": "es5"
}
schedules/app/assets/stylesheets/application.scss
View file @
2b672463
...
...
@@ -119,6 +119,15 @@ body {
top
:
0
;
}
.full-width
{
width
:
90vw
;
position
:
relative
;
left
:
50%
;
right
:
50%
;
margin-left
:
-45vw
;
margin-right
:
-45vw
;
}
// .jumbotron {
// color: #FFFFFF
// }
schedules/app/controllers/concerns/by_semester.rb
View file @
2b672463
# BySemester contains logic for setting the current request's
# Semester. This is not needed by every page as it used to be, so it
# now lives in this concern instead of ApplicationController.
# BySemester contains logic for setting the current request's Semester.
module
BySemester
extend
ActiveSupport
::
Concern
...
...
@@ -9,19 +7,19 @@ module BySemester
end
# This page needs to know what semester it should load data from.
# set_semester checks both the semester_id query parameter and the
user's cookies
# set_semester checks both the semester_id query parameter and the
current session
# to look for a semester id and loads whatever it finds into @semester.
#
# By default, load the most recent semester.
def
set_semester
if
params
.
key?
(
:semester_id
)
@semester
=
Semester
.
find_by_id
params
[
:semester_id
]
cookies
[
:semester_id
]
=
@semester
.
id
elsif
cookies
[
:semester_id
].
nil?
@semester
=
Semester
.
find_by_id
(
params
[
:semester_id
]
)
session
[
:semester_id
]
=
@semester
.
id
elsif
session
[
:semester_id
].
nil?
@semester
=
Semester
.
first
cookies
[
:semester_id
]
=
@semester
.
id
session
[
:semester_id
]
=
@semester
.
id
else
@semester
=
Semester
.
find_by_id
cookies
[
:semester_id
]
@semester
=
Semester
.
find_by_id
(
session
[
:semester_id
]
)
end
end
end
schedules/app/controllers/search_controller.rb
View file @
2b672463
...
...
@@ -42,7 +42,7 @@ class SearchController < ApplicationController
c
.
serializable_hash
.
merge
(
url:
course_url
(
c
))
end
gon
.
courses
=
@courses
gon
.
courses
.
map!
gon
.
instructors
=
@instructors
end
/[0-9]{5}/
.
match
(
params
[
:query
])
do
|
m
|
...
...
schedules/app/javascript/packs/home.js
View file @
2b672463
...
...
@@ -4,7 +4,8 @@ import Cart from 'src/Cart';
import
QuickAdd
from
'
src/QuickAdd
'
;
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
(
<
QuickAdd
loadCalendar
=
{()
=>
{
...
...
schedules/app/javascript/packs/instructor.js
View file @
2b672463
...
...
@@ -33,7 +33,6 @@ const initSearchListeners = () => {
sectionItems
.
forEach
(
item
=>
{
const
icon
=
$
(
item
.
querySelector
(
'
.add-remove-btn #icon
'
));
const
text
=
item
.
querySelector
(
'
.add-remove-btn .text
'
);
console
.
log
(
item
.
dataset
.
crn
);
if
(
Cart
.
includesCrn
(
item
.
dataset
.
crn
))
{
icon
.
addClass
(
'
fa-minus
'
).
removeClass
(
'
fa-plus
'
);
text
.
innerText
=
'
Remove
'
;
...
...
schedules/app/javascript/packs/search.js
View file @
2b672463
...
...
@@ -23,8 +23,8 @@
import
React
from
'
react
'
;
import
ReactDOM
from
'
react-dom
'
;
import
Course
List
from
'
src/
Course
List
'
;
import
Search
List
from
'
src/
Search
List
'
;
document
.
addEventListener
(
'
DOMContentLoaded
'
,
()
=>
{
ReactDOM
.
render
(
<
Course
List
courses
=
{
gon
.
courses
}
/>, document.getElementById
(
'root'
))
;
ReactDOM
.
render
(
<
Search
List
courses
=
{
gon
.
courses
}
instructors
=
{
gon
.
instructors
}
/>, document.getElementById
(
'root'
))
;
});
schedules/app/javascript/src/Calendar.jsx
View file @
2b672463
import
React
from
'
react
'
;
import
BigCalendar
from
'
react-big-calendar
'
;
import
Toolbar
from
'
src/Toolbar
'
;
import
moment
from
'
moment
'
;
import
'
!style-loader!css-loader!react-big-calendar/lib/css/react-big-calendar.css
'
;
import
withSizes
from
'
react-sizes
'
;
const
localizer
=
BigCalendar
.
momentLocalizer
(
moment
);
const
Calendar
=
props
=>
(
<
div
style
=
{
{
backgroundColor
:
'
white
'
,
padding
:
'
24px
'
}
}
>
<
div
className
=
"full-width"
style
=
{
{
backgroundColor
:
'
white
'
,
padding
:
'
24px
'
}
}
>
<
BigCalendar
localizer
=
{
localizer
}
events
=
{
props
.
events
}
title
=
""
components
=
{
{
toolbar
:
Toolbar
}
}
defaultView
=
"week"
views
=
{
[
'
week
'
,
'
day
'
]
}
startAccessor
=
"start"
...
...
@@ -18,6 +21,7 @@ const Calendar = props => (
defaultDate
=
{
moment
(
'
2019-01-14
'
).
toDate
()
}
formats
=
{
{
dayFormat
:
(
date
,
culture
,
localizer
)
=>
localizer
.
format
(
date
,
'
ddd
'
,
culture
),
dayHeaderFormat
:
(
date
,
culture
,
localizer
)
=>
localizer
.
format
(
date
,
'
ddd
'
,
culture
),
dayRangeHeaderFormat
:
()
=>
''
,
}
}
style
=
{
{
height
:
'
75vh
'
}
}
...
...
schedules/app/javascript/src/InstructorCard.jsx
0 → 100644
View file @
2b672463
import
React
from
'
react
'
;
export
default
class
InstructorCard
extends
React
.
Component
{
render
()
{
const
inst
=
this
.
props
.
instructor
;
return
(
<
div
className
=
"card p-3"
>
<
span
>
<
i
className
=
"fas fa-chalkboard-teacher mr-2"
/>
<
a
href
=
{
`/instructors/
${
inst
.
id
}
`
}
>
{
this
.
props
.
instructor
.
name
}
</
a
>
</
span
>
</
div
>
);
}
}
schedules/app/javascript/src/InstructorList.jsx
0 → 100644
View file @
2b672463
import
React
from
'
react
'
;
import
InstructorCard
from
'
src/InstructorCard
'
;
export
default
class
InstructorList
extends
React
.
Component
{
render
()
{
return
<
div
>
{
this
.
props
.
instructors
&&
this
.
props
.
instructors
.
map
(
i
=>
<
InstructorCard
instructor
=
{
i
}
/>)
}
</
div
>;
}
}
schedules/app/javascript/src/QuickAdd.jsx
View file @
2b672463
...
...
@@ -4,12 +4,12 @@ import Cart from 'src/Cart';
export
default
class
QuickAdd
extends
React
.
Component
{
constructor
(
props
)
{
super
(
props
);
this
.
state
=
{
crn
s
:
''
};
this
.
state
=
{
crn
String
:
''
};
}
add
=
e
=>
{
e
.
preventDefault
();
const
crns
=
this
.
state
.
crn
s
.
split
(
'
,
'
);
const
crns
=
this
.
state
.
crn
String
.
split
(
'
,
'
);
crns
.
forEach
(
c
=>
c
.
length
===
5
&&
Cart
.
addCrn
(
c
));
this
.
props
.
loadCalendar
();
};
...
...
@@ -26,7 +26,7 @@ export default class QuickAdd extends React.Component {
name
=
"crns"
type
=
"text"
value
=
{
this
.
state
.
crns
}
onChange
=
{
e
=>
this
.
setState
({
crn
s
:
e
.
target
.
value
})
}
onChange
=
{
e
=>
this
.
setState
({
crn
String
:
e
.
target
.
value
})
}
className
=
"form-control"
placeholder
=
"12345,54321,..."
aria
-
describedby
=
"basic-addon2"
...
...
schedules/app/javascript/src/SearchList.jsx
0 → 100644
View file @
2b672463
import
React
from
'
react
'
;
import
CourseList
from
'
src/CourseList
'
;
import
InstructorList
from
'
src/InstructorList
'
;
export
default
class
SearchList
extends
React
.
Component
{
render
()
{
return
(
<
div
>
<
InstructorList
instructors
=
{
this
.
props
.
instructors
}
/>
<
CourseList
courses
=
{
this
.
props
.
courses
}
/>
</
div
>
);
}
}
schedules/app/javascript/src/Toolbar.jsx
0 → 100644
View file @
2b672463
import
React
from
'
react
'
;
import
BigCalendar
from
'
react-big-calendar
'
;
import
Toolbar
from
'
react-big-calendar/lib/Toolbar
'
;
import
'
!style-loader!css-loader!react-big-calendar/lib/css/react-big-calendar.css
'
;
import
withSizes
from
'
react-sizes
'
;
class
CustomToolbar
extends
Toolbar
{
render
()
{
const
{
label
,
isMobile
}
=
this
.
props
;
if
(
isMobile
&&
label
===
''
)
{
this
.
view
(
'
day
'
);
}
return
(
<
div
className
=
"rbc-toolbar d-flex justify-content-between"
>
{
!
isMobile
&&
(
<
span
className
=
"rbc-btn-group"
>
<
button
type
=
"button"
onClick
=
{
()
=>
this
.
view
(
'
day
'
)
}
>
Day
</
button
>
<
button
type
=
"button"
onClick
=
{
()
=>
this
.
view
(
'
week
'
)
}
>
Week
</
button
>
</
span
>
)
}
<
span
className
=
"rbc-toolbar-label"
>
{
this
.
props
.
label
}
</
span
>
{
this
.
props
.
view
===
'
day
'
&&
(
<
span
className
=
"rbc-btn-group"
>
{
this
.
props
.
label
!==
'
Sun
'
&&
(
<
button
type
=
"button"
onClick
=
{
()
=>
this
.
navigate
(
'
PREV
'
)
}
>
Back
</
button
>
)
}
{
this
.
props
.
label
!==
'
Sat
'
&&
(
<
button
type
=
"button"
onClick
=
{
()
=>
this
.
navigate
(
'
NEXT
'
)
}
>
Next
</
button
>
)
}
</
span
>
)
}
</
div
>
);
}
navigate
=
action
=>
{
console
.
log
(
action
);
this
.
props
.
onNavigate
(
action
);
};
view
=
action
=>
{
this
.
props
.
onView
(
action
);
};
}
const
mapSizesToProps
=
({
width
})
=>
({
isMobile
:
width
<
1000
,
});
export
default
withSizes
(
mapSizesToProps
)(
CustomToolbar
);
schedules/app/views/about/index.html.erb
0 → 100644
View file @
2b672463
<div
class=
"jumbotron text-center"
>
<h1><i
class=
"fas fa-calendar-alt"
></i>
SRCT Schedules
</h1>
<p
class=
"lead"
>
Version 3.0
</p>
<hr
/>
Last updated: 2:00am, 4/14/19
</div>
<h3>
Thank you to our contributors who make Schedules possible!
</h3>
Zac Wood, David Haynes, Zach Perkins, Gilberto Barrientos, Michael Bailey, Nic Anderson
<br
/><br/>
<h3>
Questions?
</h3>
All data in Schedules is sourced from data made publicly avaiable by GMU.
<ul>
<li>
Course and section data can be found on
<a
href=
"https://patriotweb.gmu.edu/pls/prod/bwckschd.p_disp_dyn_sched"
>
Patriot Web
</a></li>
<li>
Course review data can be found
<a
href=
"https://crserating.gmu.edu/ReportOnline/"
>
here
</a></li>
</ul>
Please contact SRCT at
<a
href=
"mailto:srct@gmu.edu"
>
srct@gmu.edu
</a>
with any other questions.
schedules/app/views/instructors/show.html.erb
View file @
2b672463
<div
class=
"row"
>
<div
class=
"col-lg-4 col-12"
>
<div
class=
"col-lg-4 col-12
mb-4
"
>
<h1>
<%=
@instructor
.
name
%>
</h1>
<%
unless
@rating
[
:teaching
].
nil?
%>
Average rating:
<%=
@rating
[
:teaching
][
0
]
%>
/
<%=
@rating
[
:teaching
][
1
]
%>
responses
Average
teaching
rating:
<%=
@rating
[
:teaching
][
0
]
%>
/
<%=
@rating
[
:teaching
][
1
]
%>
responses
<%
end
%>
</div>
<div
class=
"col-lg-8 col-12"
>
<%
@semesters
.
each
do
|
semester
,
sections
|
%>
...
...
schedules/db/seeds.rb
View file @
2b672463
...
...
@@ -8,6 +8,7 @@ require 'httparty'
require
'nokogiri'
require
'json'
require
'set'
require
'yaml/store'
def
parse_courses
(
subjects
)
courses
=
[]
...
...
schedules/package.json
View file @
2b672463
...
...
@@ -14,6 +14,7 @@
"react"
:
"^16.8.6"
,
"react-big-calendar"
:
"^0.20.4"
,
"react-dom"
:
"^16.8.6"
,
"react-sizes"
:
"^2.0.0"
,
"url-polyfill"
:
"^1.1.3"
},
"devDependencies"
:
{
...
...
schedules/yarn.lock
View file @
2b672463
...
...
@@ -3276,6 +3276,11 @@ lodash.templatesettings@^4.0.0:
dependencies:
lodash._reinterpolate "~3.0.0"
lodash.throttle@^4.1.1:
version "4.1.1"
resolved "https://registry.yarnpkg.com/lodash.throttle/-/lodash.throttle-4.1.1.tgz#c23e91b710242ac70c37f1e1cda9274cc39bf2f4"
integrity sha1-wj6RtxAkKscMN/HhzaknTMOb8vQ=
lodash.uniq@^4.5.0:
version "4.5.0"
resolved "https://registry.yarnpkg.com/lodash.uniq/-/lodash.uniq-4.5.0.tgz#d0225373aeb652adc1bc82e4945339a842754773"
...
...
@@ -4615,7 +4620,7 @@ prop-types-extra@^1.0.1, prop-types-extra@^1.1.0:
react-is "^16.3.2"
warning "^3.0.0"
prop-types@^15.5.10, prop-types@^15.6.2, prop-types@^15.7.2:
prop-types@^15.5.10,
prop-types@^15.6.0,
prop-types@^15.6.2, prop-types@^15.7.2:
version "15.7.2"
resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.7.2.tgz#52c41e75b8c87e72b9d9360e0206b99dcbffa6c5"
integrity sha512-8QQikdH7//R2vurIJSutZ1smHYTcLpRWEOlHnzcWHmBYrOGUysKwSsrC89BCiFj3CbrfJ/nXFdJepOVrY1GCHQ==
...
...
@@ -4801,6 +4806,14 @@ react-overlays@^0.8.3:
react-transition-group "^2.2.0"
warning "^3.0.0"
react-sizes@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/react-sizes/-/react-sizes-2.0.0.tgz#c2100daf3bf74077fb410f09204340c1af5c1d4f"
integrity sha512-YNGPQGJTxNMD4wdFRmVmqlLZlwhETVW06H7dVbOjj+OV1ckz/gkH3/5MfRuSO8t99nMOmi+Uj14jkvG+zlP57w==
dependencies:
lodash.throttle "^4.1.1"
prop-types "^15.6.0"
react-transition-group@^2.2.0:
version "2.8.0"
resolved "https://registry.yarnpkg.com/react-transition-group/-/react-transition-group-2.8.0.tgz#d6d8f635d81a0955b67348be5d017cff77d6c75f"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment