Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
schedules
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
11
Issues
11
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
SRCT
schedules
Commits
0a501963
Commit
0a501963
authored
Apr 12, 2018
by
Zac Wood
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added search by CRN on homepage
parent
5de61c75
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
3 deletions
+41
-3
schedules/app/assets/javascripts/home.js
schedules/app/assets/javascripts/home.js
+22
-0
schedules/app/views/home/index.html.erb
schedules/app/views/home/index.html.erb
+19
-3
No files found.
schedules/app/assets/javascripts/home.js
View file @
0a501963
function
search
()
{
const
searchTable
=
document
.
getElementById
(
'
scheduleTable
'
);
const
crn
=
document
.
getElementById
(
'
search
'
).
value
;
fetch
(
`
api/search?crn=
${
crn
}
`
)
.
then
(
section
=>
section
.
json
())
.
then
(
section
=>
addRow
(
searchTable
,
section
));
}
function
addRow
(
table
,
section
)
{
const
tr
=
document
.
createElement
(
'
tr
'
);
const
fields
=
[
section
.
name
,
section
.
title
,
section
.
crn
,
section
.
professor
,
section
.
location
,
section
.
days
];
fields
.
forEach
(
field
=>
{
const
td
=
document
.
createElement
(
'
td
'
);
const
txt
=
document
.
createTextNode
(
field
);
td
.
appendChild
(
txt
);
tr
.
appendChild
(
td
);
});
table
.
appendChild
(
tr
);
}
schedules/app/views/home/index.html.erb
View file @
0a501963
<h1>
Schedules
</h1>
<h1>
Schedules
</h1>
<input
type=
"text"
title=
"search_text"
placeholder=
"Enter CRN..."
/>
<input
type=
"text"
id=
"search"
title=
"search_text"
placeholder=
"Enter CRN..."
/>
<button
title=
"search"
>
Search
</button>
<button
title=
"search"
onclick=
"search()"
>
Search
</button>
<!-- <h2>Search results</h2>
<table id="searchTable">
<tr>
<th>Course</th>
<th>Section Name</th>
<th>CRN</th>
<th>Professor</th>
<th>Location</th>
<th>Days</th>
<th>Times</th>
</tr>
</table>
-->
<!-- <br><br> -->
<h2>
Your classes
</h2>
<h2>
Your classes
</h2>
<table>
<table
id=
"scheduleTable"
>
<tr>
<tr>
<th>
Course
</th>
<th>
Course
</th>
<th>
Section Name
</th>
<th>
Section Name
</th>
...
...
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