From 7c51c029284943d69e9e383506f0e86ab59fe80e Mon Sep 17 00:00:00 2001 From: Dan Helfman Date: Tue, 11 Mar 2008 04:52:23 +0000 Subject: [PATCH] Show list of all notes on startup if there are no startup notes and the notebook isn't empty. --- NEWS | 4 ++++ static/js/Wiki.js | 16 ++++++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 3362b41..a44af7b 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,7 @@ +1.2.9: March 10, 2008 + * Show list of all notes on startup if there are no startup notes and the + notebook isn't empty. + 1.2.8: March 10, 2008 * No longer popping up a link info box when clicking on a note link. diff --git a/static/js/Wiki.js b/static/js/Wiki.js index 049e7e7..003b0d3 100644 --- a/static/js/Wiki.js +++ b/static/js/Wiki.js @@ -1328,8 +1328,11 @@ Wiki.prototype.display_all_notes_list = function ( result ) { // build up a list of all notes in this notebook, one link per note var list = createDOM( "ul", { "id": "notes_list" } ); - if ( this.focused_editor ) - appendChildNodes( list, this.create_all_notes_link( this.focused_editor.id, this.focused_editor.title || "untitled note" ) ); + if ( this.focused_editor ) { + var focused_title = this.focused_editor.title; + if ( focused_title != "all notes" && focused_title != "search results" && focused_title != "share this notebook" ) + appendChildNodes( list, this.create_all_notes_link( this.focused_editor.id, this.focused_editor.title || "untitled note" ) ); + } for ( var i in result.notes ) { var note_tuple = result.notes[ i ] @@ -1675,6 +1678,15 @@ Wiki.prototype.display_empty_message = function ( replace_messages ) { return true; } + if ( !replace_messages ) { + var self = this; + this.invoker.invoke( + "/notebooks/all_notes", "GET", { "notebook_id": this.notebook.object_id }, + function( result ) { self.display_all_notes_list( result ); } + ); + return true; + } + return false; }