From: ec2-user Date: Sun, 13 Nov 2011 20:54:50 +0000 (+0000) Subject: lecture list working w/1page X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=9b7537d19a3d7122066ca3d2dfa9e9eb25e2c7cd;p=oweals%2Ffinalsclub.git lecture list working w/1page --- diff --git a/public/index.html b/public/index.html index b2dde81..9e64cb7 100644 --- a/public/index.html +++ b/public/index.html @@ -101,7 +101,7 @@
__department__
@@ -109,10 +109,18 @@
-

Lectures for

+
+

Lectures for Course __number__ : __name__

+ Subject: __subject__
+ Department: __department__
+
+
+ Instructor: __name__ (__email__)
+
- __name__ + __name__
+ Created: __date__
diff --git a/public/javascripts/main.js b/public/javascripts/main.js index 47ee283..294427e 100644 --- a/public/javascripts/main.js +++ b/public/javascripts/main.js @@ -71,29 +71,35 @@ function showCourses(matches, cb) { // 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") }); } @@ -189,6 +195,7 @@ var pageVectors = [ { 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 }, diff --git a/public/stylesheets/fc2.css b/public/stylesheets/fc2.css index 6ae1b86..44bd112 100644 --- a/public/stylesheets/fc2.css +++ b/public/stylesheets/fc2.css @@ -872,5 +872,15 @@ div.conduct p.vague { color: #888; } +.lectures_instructor, .lectures_head { +} + +.lecture { + margin: 0.5em 0; + padding: 0.5em 1em; + border: solid 1px #888; + -moz-border-radius: 0.20em; + -webkit-border-radius: 0.20em; +}