From: chapel Date: Sun, 13 Nov 2011 23:13:36 +0000 (-0800) Subject: Fix archived notes and break cache for json X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=26cf927218d3d643c75cd5eac7d953314f6e8604;p=oweals%2Ffinalsclub.git Fix archived notes and break cache for json --- diff --git a/app.js b/app.js index 7c98b19..202ab0e 100644 --- a/app.js +++ b/app.js @@ -157,6 +157,7 @@ app.configure(function(){ app.use( express.methodOverride() ); // Sets the routers middleware to load after everything set // before it, but before static files. + app.use(express.logger({ format: ':method :url' })); app.use( app.router ); // Static files are loaded when no dynamic views match. app.use( express.static( __dirname + '/public' ) ); @@ -1591,7 +1592,7 @@ app.get( '/archive/course/:id', checkAjax, loadUser, loadOldCourse, function( re }) }) -app.get( '/archive/note/:id', loadUser, function( req, res ) { +app.get( '/archive/note/:id', checkAjax, loadUser, function( req, res ) { ArchivedNote.findById(req.params.id, function(err, note) { if ( err ) { res.json( {status: 'error', message: 'This is not a valid id for a note'} ); diff --git a/public/javascripts/main.js b/public/javascripts/main.js index f9b69ff..5488477 100644 --- a/public/javascripts/main.js +++ b/public/javascripts/main.js @@ -27,7 +27,7 @@ function showSchools(matches, cb) { ProtoDiv.reset("PROTO_school"); - $.get("/schools", {}, function(response) { + $.get("/schools", { cache: false }, function(response) { var schools = [] if(typeof response == 'object') { @@ -51,7 +51,7 @@ function showCourses(matches, cb) { ProtoDiv.reset("PROTO_course"); - $.get("/school/"+schoolId, {}, function(response) { + $.get("/school/"+schoolId, { cache: false }, function(response) { var courses = [] if(typeof response == 'object') { @@ -77,7 +77,7 @@ function showLectures(matches, cb) { ProtoDiv.reset("PROTO_lecture"); - $.get("/course/"+courseId, {}, function(response) { + $.get("/course/"+courseId, { cache: false }, function(response) { ProtoDiv.reset("PROTO_lectures_head") ProtoDiv.reset("PROTO_lectures_instructor") @@ -112,7 +112,7 @@ function showNotes(matches, cb) { ProtoDiv.reset("PROTO_note"); - $.get("/lecture/"+lectureId, {}, function(response) { + $.get("/lecture/"+lectureId, { cache: false }, function(response) { if(typeof response == 'object') { @@ -147,7 +147,7 @@ function showArchiveSubjects(matches, cb) { ProtoDiv.reset("PROTO_archive_subject") - $.get("/archive", { }, function(response) { + $.get("/archive", { cache: false }, function(response) { var subjects = response.subjects @@ -166,7 +166,7 @@ function showArchiveCourses(matches, cb) { ProtoDiv.reset("PROTO_archive_course") - $.get("/archive/subject/"+subjectId, { }, function(response) { + $.get("/archive/subject/"+subjectId, { cache: false }, function(response) { var courses = response.courses @@ -185,7 +185,7 @@ function showArchiveNotes(matches, cb) { ProtoDiv.reset("PROTO_archive_note") - $.get("/archive/course/"+courseId, { }, function(response) { + $.get("/archive/course/"+courseId, { cache: false }, function(response) { var notes = response.notes $.each(notes, function(i, note) {