From 773ea3bf2b2fdf403cc932e66bc8dc6bc83fd627 Mon Sep 17 00:00:00 2001 From: Dan Helfman Date: Fri, 7 Sep 2007 23:46:01 +0000 Subject: [PATCH] If a link had title "all notes" but a different link id for the destination, and you clicked on the link without opening the link pulldown first, then the link would open up "all notes" instead of the correct link destination. --- static/js/Wiki.js | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/static/js/Wiki.js b/static/js/Wiki.js index c1b0776..ee1f7a3 100644 --- a/static/js/Wiki.js +++ b/static/js/Wiki.js @@ -283,24 +283,24 @@ Wiki.prototype.load_editor = function ( note_title, note_id, revision, link ) { } } - // if the note_title corresponds to a "magic" note's title, then dynamically create the note + // if there's not a valid destination note id, then load by title instead of by id var self = this; - if ( note_title == "all notes" ) { - var editor = this.open_editors[ note_title ]; - if ( editor ) { - editor.highlight(); + if ( pulldown_title || note_id == undefined || note_id == "new" || note_id == "null" ) { + // if the note_title corresponds to a "magic" note's title, then dynamically create the note + if ( note_title == "all notes" ) { + var editor = this.open_editors[ note_title ]; + if ( editor ) { + editor.highlight(); + return; + } + + this.invoker.invoke( + "/notebooks/all_notes", "GET", { "notebook_id": this.notebook.object_id }, + function( result ) { self.display_all_notes_list( result ); } + ); return; } - this.invoker.invoke( - "/notebooks/all_notes", "GET", { "notebook_id": this.notebook.object_id }, - function( result ) { self.display_all_notes_list( result ); } - ); - return; - } - - // if there's not a valid destination note id, then load by title instead of by id - if ( pulldown_title || note_id == undefined || note_id == "new" || note_id == "null" ) { // but if the note corresponding to the link's title is already open, highlight it and bail if ( !revision ) { var editor = this.open_editors[ note_title ];