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
Mattias J Duffy
schedules
Commits
31e5281e
Unverified
Commit
31e5281e
authored
Aug 08, 2016
by
Mark Stenglein
Browse files
Added front end selection box methods.
parent
22a7ef83
Changes
3
Hide whitespace changes
Inline
Side-by-side
schedules/config.js
View file @
31e5281e
...
...
@@ -17,9 +17,18 @@ config.schoolSlugs = {
'
GMU
'
:
{
'
longName
'
:
'
George Mason University
'
,
'
semesters
'
:
[
{
'
GMU2016F
'
:
'
Fall 2016
'
},
{
'
GMU2016S
'
:
'
Summer 2016
'
},
{
'
GMU2016SP
'
:
'
Spring 2016
'
}
{
slug
:
'
GMU2016F
'
,
longName
:
'
Fall 2016
'
},
{
slug
:
'
GMU2016S
'
,
longName
:
'
Summer 2016
'
},
{
slug
:
'
GMU2016SP
'
,
longName
:
'
Spring 2016
'
}
]
},
'
VT
'
:
{
...
...
schedules/public/javascripts/mainApp.js
View file @
31e5281e
var
slugs
;
// Expose the school data globally.
var
schoolData
=
{};
// Expose the semester data globally
var
semesterData
=
{};
$
(
document
).
ready
(
function
()
{
// Convert table to DataTable
$
(
'
#classSearch
'
).
DataTable
();
var
school
Select
=
document
.
getElementById
(
'
selectSchool
'
);
// Get
school
Data and populate the selection menus
$
.
getJSON
(
'
/api/v1/json/schools
'
,
function
(
schoolSlugs
)
{
var
slugs
=
schoolSlugs
;
for
(
i
=
0
;
i
<
schoolSlugs
.
schools
.
length
;
i
++
)
{
schoolName
=
schoolSlugs
[
schoolSlugs
.
schools
[
i
]];
schoolSelect
.
add
(
new
Option
(
schoolName
.
longName
,
i
+
1
));
}
semesterData
=
schoolSlugs
;
populateBoxes
();
});
$
(
'
#selectSchool
'
).
change
(
function
()
{
populateSemesterSelect
();
});
}
);
function
populateBoxes
()
{
var
schoolSelect
=
document
.
getElementById
(
'
selectSchool
'
);
for
(
i
=
0
;
i
<
semesterData
.
schools
.
length
;
i
++
)
{
var
schoolName
=
semesterData
[
semesterData
.
schools
[
i
]];
schoolSelect
.
add
(
new
Option
(
schoolName
.
longName
,
i
));
}
populateSemesterSelect
();
}
function
populateSemesterSelect
()
{
var
schoolSelect
=
$
(
'
#selectSchool
'
);
var
selectSemester
=
document
.
getElementById
(
'
selectSemester
'
);
// Clear Select Semester
selectSemester
.
innerHTML
=
""
;
var
schoolID
=
$
(
'
#selectSchool option:selected
'
).
val
();
var
schoolSlug
=
semesterData
.
schools
[
schoolID
];
var
school
=
semesterData
[
schoolSlug
];
for
(
i
=
0
;
i
<
school
.
semesters
.
length
;
i
++
)
{
var
semesterName
=
school
.
semesters
[
i
];
selectSemester
.
add
(
new
Option
(
semesterName
.
longName
,
i
));
}
}
schedules/views/index.jade
View file @
31e5281e
...
...
@@ -37,8 +37,6 @@ block content
label.col-md-4.control-label(for="selectSemester") Select a Semester
div.col-md-6
select#selectSemester.form-control(name="selectSemester")
option(value="1") Option one
option(value="2") Option two
// Text input
div.form-group
...
...
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