-
Notifications
You must be signed in to change notification settings - Fork 18
/
courses.mustache
375 lines (317 loc) · 13.1 KB
/
courses.mustache
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/html">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Classes</title>
<!--<link rel="stylesheet" type="text/css" href="stylesheets/resetHome.css" />-->
<!--<link rel="stylesheet" type="text/css" href="stylesheets/home.css" />-->
<!--<link rel="stylesheet" type="text/css" href="stylesheets/style-responsive.css" />-->
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<link rel="stylesheet" type="text/css" href="/stylesheets/global.css">
<link rel="stylesheet" type="text/css" href="/stylesheets/courseTable.css">
</head>
<body style="padding-top: 10rem">
<header class="navbar navbar-default navbar-fixed-top navmain" >
<div class="container" >
<a href="/" class="CTtitle"><h1>Class Transcribe</h1></a>
</div>
<ul class="nav navbar-nav navbar-right" margin='100'>
<li style='margin: 25px 25px 25px 25px;'><button type="button" class="btn btn-default" onclick="window.location.href='/logout'">Sign out</button</li>
</ul>
</header>
<div class="container" role="main">
<div class="row">
<div class="col-md-2">
</div>
<div class="col-md-10">
<!--Select a term:-->
<select id="school-term" value="All" hidden="yes">
<!--<select id="school-term" value="All">/-->
</select>
<form action="/courses/search" id="search-form" method="GET" class="pull-right" role="search">
<input type='input' id='search-input' name="q">
<input type='submit' id='search-button' value='Search' class="btn">
</form>
{{{createClassButton}}}
</div>
</div>
<div style="margin:3rem">
</div>
<div class="row">
<div class="col-lg-2 filterbox">
<div>
<h5>Filter By Terms</h5>
<div id="termFilterData">
{{{termfilterdata}}}
</div>
</div>
<div>
<h5>Filter By Subject</h5>
<div id="subjectFilterData">
{{{subjectfilterdata}}}
</div>
</div>
</div>
<div class="col-lg-10">
<table class="table table-sm table-striped" id="course-list"><tbody>
<!--<tr id="#header">-->
<!--<th>University</th>-->
<!--<th>Subject</th>-->
<!--<th>Course Number</th>-->
<!--<th>Section Number</th>-->
<!--<th>Course Name</th>-->
<!--<th>Course Instructor</th>-->
<!--<th>Course Description</th>-->
<!--<th>Action</th>-->
<!--</tr>-->
{{{tabledata}}}
</tbody></table>
{{{createform}}}
</div>
</div>
</div>
<!--modify panel-->
<div id="modpanel" class="modal fade" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<h2>Modify Course</h2>
<button type="button" class="close" data-dismiss="modal">×</button>
</div>
<div class="modal-body">
<form id ='modform' class="" method="POST">
<div class="row">
<div class="col-lg-3">
<label>University</label> <input type="text" class="form-control" id="mfmin1" name="University" readonly>
<label>Subject</label> <input type="text" class="form-control" id="mfmin3" name="Subject" readonly>
<label>Course Number</label> <input type="text" class="form-control" id="mfmin4" name="Course Number" readonly>
</div>
<div class="col-lg-3">
<label>Instructor</label> <input type="text" class="form-control" id="mfmin2" name="Instructor" readonly>
<label>Class Name</label> <input type="text" class="form-control" id="mfmin5" name="Class Name" >
<label>Section Number</label> <input type="text" class="form-control" id="mfmin6" name="Section Number" readonly>
</div>
<div class="col-lg-6"><label>Course Description</label> <textarea type="text" class="form-control" id="mfmin7" name="Course Description" style="resize: vertical;"></textarea>
</div>
</div>
</form>
</div>
<div class="modal-footer">
<button id="mfmapply" type="button" class="btn btn-default" form="#modform">Apply</button>
<button id='mfmcancel' type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<section class="footer" role="contentinfo">
<div class="margin">
<div class="menu-footer">
<a href="/">Home</a>
</div>
<div class="copyright"> © 2016-2019. UIUC</div>
</div>
</section>
<!-- Scripts -->
<script src="/javascripts/libraries/jquery.parallax.js"></script> <!-- jQuery Parallax -->
<script src="/javascripts/libraries/jquery.nicescroll.js"></script> <!-- jQuery NiceScroll -->
<script src="/javascripts/libraries/jquery.sticky.js"></script> <!-- jQuery Stick Menu -->
<script>
// populate school term options
<!--var schoolTermsList="{{termlist}}".split(",");-->
<!--var termSelection = document.getElementById("school-term");-->
<!--schoolTermsList.forEach(function(element) {-->
<!--var option = document.createElement("option");-->
<!--option.text = element;-->
<!--option.value = element;-->
<!--termSelection.add(option);-->
<!--});-->
// Delete button, outdated and should be removed from this page
$(document).on('click',".actionbtn.rmbtn",function (e) {
e.preventDefault();
var retd = {};
for (var d in $(this).parent().parent()[0]){
retd[d] = d;
}
var row = $(this).closest("tr");
$.ajax({
url : "/courses/deleteclass/",
type: "DELETE",
data:'term='+$("#school-term").val()+'&classinfo='+$(this).closest("tr").find('td').map(function() {
return $(this).text();
}).get().join(',,'),
success: function (data) {
row.html("");
location.reload();
},
error: function (jXHR, textStatus, errorThrown) {
alert(errorThrown);
}
});
});
// needed for modify
termselected = '';
uniselected = '';
// Modify button, outdated and should be removed from this page
$(document).on('click',".actionbtn.modbtn",function (e) {
e.preventDefault();
var retd = {};
for (var d in $(this).parent().parent()[0]){
retd[d] = d;
}
var row = $(this).closest("tr");
var info = $(this).closest("tr").find('td').map(function() {
return $(this).text()});
termselected = info[0];
uniselected = info[1];
populateForm(info);
});
function populateForm(info) {
$('#mfmin1').val(info[1]);
$('#mfmin2').val(info[6]);
$('#mfmin3').val(info[2]);
$('#mfmin4').val(info[3]);
$('#mfmin5').val(info[5]);
$('#mfmin6').val(info[4]);
$('#mfmin7').val(info[7]);
}
$(document).on('click',"#mfmapply",function (e) {
e.preventDefault();
var row = $(this).closest("tr");
var info = $(this).closest("tr").find('td').map(function() {
return $(this).text()});
$.ajax({
url : "/courses/modifyclass/",
type: "POST",
data:$('#modform').serialize()+'&uni=' +uniselected+'&term='+termselected,
success: function (data) {
console.log(data)
$('#modpanel').modal('hide');
location.reload();
},
error: function (jXHR, textStatus, errorThrown) {
alert(errorThrown);
}
});
});
function refreshFilters() {
var fterm=$("#termFilterData input:checked").map(function(i,e){return e.value;}).get().join(';;');
var fsubject=$("#subjectFilterData input:checked").map(function(i,e){return e.value;}).get().join(';;');
$.ajax({
url : "/courses/applyfilter",
type: "POST",
data:'termfilter='+fterm+'&subjectfilter='+fsubject,
success: function (data) {
$('#course-list').html(data);
},
error: function (jXHR, textStatus, errorThrown) {
alert(errorThrown);
}
});
}
refreshFilters();
$(document).on('click',".form-check-input",function (e) {
refreshFilters();
});
// Manage
$(document).on('click',".actionbtn.mnbtn",function (e) {
e.preventDefault();
var retd = {};
for (var d in $(this).parent().parent()[0]){
retd[d] = d;
}
var row = $(this).closest("tr");
var attributes = $(this).closest("tr").find('td').map(function() {
return $(this).text();
})
console.log(attributes);
className = attributes.get(1)
className = className.replace(/\s/g, '')
console.log($.get(className))
// $.post('/'+className)
window.location = '/manage/' + className;
});
// Enroll
$(document).on('click',".actionbtn.erbtn",function (e) {
e.preventDefault();
var retd = {};
for (var d in $(this).parent().parent()[0]){
retd[d] = d;
}
var row = $(this).closest("tr");
$.ajax({
url : "/courses/enroll/",
type: "POST",
data:'cid='+$(this).closest("tr").attr('id')+'&classinfo='+$(this).closest("tr").find('td').map(function() {
return $(this).text();
}).get().join(',,'),
success: function (data) {
location.reload();
},
error: function (jXHR, textStatus, errorThrown) {
alert(errorThrown);
}
});
});
// Drop
$(document).on('click',".actionbtn.dpbtn",function (e) {
e.preventDefault();
var retd = {};
for (var d in $(this).parent().parent()[0]){
retd[d] = d;
}
var row = $(this).closest("tr");
$.ajax({
url : "/courses/drop/",
type: "POST",
data:'cid='+$(this).closest("tr").attr('id')+'&classinfo='+$(this).closest("tr").find('td').map(function() {
return $(this).text();
}).get().join(',,'),
success: function (data) {
location.reload();
},
error: function (jXHR, textStatus, errorThrown) {
alert(errorThrown);
}
});
});
// Watch
$(document).on('click',".actionbtn.viewbtn",function (e) {
e.preventDefault();
// var retd = {};
// for (var d in $(this).parent().parent()[0]){
// retd[d] = d;
// }
// var row = $(this).closest("tr");
// $.ajax({
// url : "/watchLectureVideos",
// type: "POST",
// data:'cid='+$(this).closest("tr").attr('id')+'&classinfo='+$(this).closest("tr").find('td').map(function() {
// return $(this).text();
// }).get().join(',,'),
// success: function (data) {
// location.reload();
// },
// error: function (jXHR, textStatus, errorThrown) {
// alert(errorThrown);
// }
// });
var attributes = $(this).closest("tr").find('td').map(function() {
return $(this).text();
})
console.log(attributes);
className = attributes.get(1)
className = className.replace(/\s/g, '')
console.log($.get(className))
window.location = '/watchLectureVideos/' + className;
});
</script>
</body>
</html>