<div class=course id=PROTO_course>
<div class=dept>__department__</div>
<div class=name>
- <a href="javascript:goLectures('___id__')">__number__: __name__</a>
+ <a href="javascript:goPage('/course/___id__')">__number__: __name__</a>
</div>
</div>
</div>
<div class=page id=pg_lectures>
- <h1>Lectures for <span id=course_name></span></h1>
+ <div class=lectures_head id=PROTO_lectures_head>
+ <h1>Lectures for Course __number__ : __name__</h1>
+ Subject: __subject__<br>
+ Department: __department__<br>
+ </div>
+ <div class=lectures_instructor id=PROTO_lectures_instructor>
+ Instructor: __name__ (__email__)<br>
+ </div>
<div class=lecture id=PROTO_lecture>
<div class=name>
- <a href="javascript:goPads('___id__')">__name__</a>
+ <a href="javascript:goPage('/note/___id__')">__name__</a><br>
+ Created: __date__<br>
</div>
</div>
</div>
// go to the page that lists the lectures for a specific course
-var lectures = []
-function goLectures(courseId) {
+function showLectures(matches, cb) {
+
+ var courseId = matches[1]
+
ProtoDiv.reset("PROTO_lecture");
- hideAllPages();
+
$.get("/course/"+courseId, {}, function(response) {
-response = {
- course: {
- name: "FooCourse",
- lectures: [
- { _id: 1, name: "lecture 1" },
- { _id: 2, name: "lecture 2" },
- ]
- }
-}
- lectures = []
+ ProtoDiv.reset("PROTO_lectures_head")
+ ProtoDiv.reset("PROTO_lectures_instructor")
+ ProtoDiv.reset("PROTO_lecture")
+
if(typeof response == 'object') {
+
var course = response.course
- $("#course_name").html(course.name);
- lectures = course.lectures
+ if(course)
+ ProtoDiv.replicate("PROTO_lectures_head", [course])
+
+ var instructor = response.instructor
+ if(instructor)
+ ProtoDiv.replicate("PROTO_lectures_instructor", [instructor])
+
+ var lectures = response.lectures
+ if(lectures)
+ ProtoDiv.replicate("PROTO_lecture", lectures);
+
}
- ProtoDiv.replicate("PROTO_lecture", lectures);
- goPage("lectures")
+
+ cb("lectures")
});
}
{ regex: /^\/(index.html)?$/, func: showHome },
{ regex: /^\/schools/, func: showSchools },
{ regex: /^\/school\/([a-f0-9]{24})/, func: showCourses },
+ { regex: /^\/course\/([a-f0-9]{24})/, func: showLectures },
{ regex: /^\/login/, func: showLogin },
{ regex: /^\/register/, func: showRegister },
{ regex: /^\/press/, func: showPress },