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
cfe2d499
Commit
cfe2d499
authored
Sep 21, 2018
by
Zac Wood
Browse files
clean up
parent
bd3f1391
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
schedules/app/assets/javascripts/search.js
View file @
cfe2d499
...
...
@@ -4,7 +4,7 @@
class
Schedule
{
constructor
()
{
this
.
isOpen
=
false
;
this
.
_ids
=
Array
.
from
(
document
.
getElementById
(
'
schedule
'
).
children
).
map
(
e
=>
Number
(
e
.
id
.
split
(
'
-
'
)[
1
]
));
this
.
_ids
=
Array
.
from
(
document
.
getElementById
(
'
schedule
'
).
children
).
map
(
e
=>
Number
(
e
.
dataset
.
crn
));
}
get
ids
()
{
...
...
@@ -70,8 +70,8 @@ class Schedule {
}
class
Search
{
sectionWith
Id
(
sectionId
)
{
return
document
.
getElementById
(
'
search-list
'
).
querySelector
(
`
#
${
sectionId
}
`
);
sectionWith
Crn
(
crn
)
{
return
document
.
getElementById
(
'
search-list
'
).
querySelector
(
`
[data-crn="
${
crn
}
"]
`
);
}
}
...
...
@@ -80,14 +80,13 @@ const toggleSchedule = () => this.schedule.toggle();
const
addToSchedule
=
(
event
,
section
)
=>
{
section
.
classList
.
add
(
'
selected
'
);
// this.schedule.addToSchedule(JSON.parse(section.dataset.section));
this
.
schedule
.
addToSchedule
(
section
.
cloneNode
(
true
));
event
.
stopPropagation
();
};
const
removeFromSchedule
=
section
=>
{
this
.
search
.
sectionWith
Id
(
section
.
i
d
).
classList
.
remove
(
'
selected
'
);
this
.
search
.
sectionWith
Crn
(
section
.
d
ataset
.
crn
).
classList
.
remove
(
'
selected
'
);
this
.
schedule
.
removeFromSchedule
(
section
.
id
.
split
(
'
-
'
)[
1
]);
};
...
...
@@ -115,8 +114,3 @@ const addToSystemCalendar = async () => {
const
url
=
`webcal://
${
window
.
location
.
hostname
}
/api/schedule?crns=
${
this
.
schedule
.
ids
.
join
(
'
,
'
)}
`
;
window
.
open
(
url
,
'
_self
'
);
};
document
.
addEventListener
(
'
DOMContentLoaded
'
,
()
=>
{
this
.
schedule
=
new
Schedule
();
this
.
search
=
new
Search
();
});
schedules/app/views/search/index.html.erb
View file @
cfe2d499
...
...
@@ -71,3 +71,10 @@
</div>
</div>
</div>
<%=
javascript_tag
do
%>
document.addEventListener('DOMContentLoaded', () => {
this.schedule = new Schedule();
this.search = new Search();
});
<%
end
%>
schedules/app/views/shared/_navbar.html.erb
View file @
cfe2d499
<div
class=
"container-fluid"
>
<div
class=
"row align-left align-sm-center align-md-right"
id=
"navbar"
>
<div
class=
"col-8 col-sm align-center"
>
<a
href=
"/
search
"
id=
"logo"
>
<a
href=
"/"
id=
"logo"
>
<i
class=
"fas fa-calendar-alt"
></i>
Schedules
</a>
...
...
schedules/yarn.lock
View file @
cfe2d499
This diff is collapsed.
Click to expand it.
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