From c1b4a58f65f94760c23f8bbe5e5040955cc39e9b Mon Sep 17 00:00:00 2001 From: Dan Helfman Date: Thu, 15 Nov 2007 23:46:30 +0000 Subject: [PATCH] Adding a new notebook now puts you directly into renaming it. --- controller/Notebooks.py | 6 ++++-- static/js/Wiki.js | 4 ++++ static/js/test/Test_wiki.html | 1 + view/Main_page.py | 2 ++ 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/controller/Notebooks.py b/controller/Notebooks.py index edf3fb8..333636b 100644 --- a/controller/Notebooks.py +++ b/controller/Notebooks.py @@ -53,9 +53,10 @@ class Notebooks( object ): note_id = Valid_id(), parent_id = Valid_id(), revision = Valid_revision(), + rename = Valid_bool(), user_id = Valid_id( none_okay = True ), ) - def default( self, notebook_id, note_id = None, parent_id = None, revision = None, user_id = None ): + def default( self, notebook_id, note_id = None, parent_id = None, revision = None, rename = False, user_id = None ): """ Provide the information necessary to display the page for a particular notebook. If a particular note id is given without a revision, then the most recent version of that note is @@ -87,6 +88,7 @@ class Notebooks( object ): result[ "conversion" ] = u"demo" else: result[ "conversion" ] = u"signup" + result[ "rename" ] = rename return result @@ -739,7 +741,7 @@ class Notebooks( object ): self.__database.commit() return dict( - redirect = u"/notebooks/%s" % notebook_id, + redirect = u"/notebooks/%s?rename=true" % notebook_id, ) @expose( view = Json ) diff --git a/static/js/Wiki.js b/static/js/Wiki.js index 9fa5951..75dd9a0 100644 --- a/static/js/Wiki.js +++ b/static/js/Wiki.js @@ -76,6 +76,10 @@ function Wiki( invoker ) { event.stop(); } ); } + + var rename = evalJSON( getElement( "rename" ).value ); + if ( rename ) + this.start_notebook_rename(); } Wiki.prototype.update_next_id = function ( result ) { diff --git a/static/js/test/Test_wiki.html b/static/js/test/Test_wiki.html index 22af3da..0fe40ae 100644 --- a/static/js/test/Test_wiki.html +++ b/static/js/test/Test_wiki.html @@ -83,6 +83,7 @@ function test_Wiki() { +
diff --git a/view/Main_page.py b/view/Main_page.py index e9a8d81..7ffb1ad 100644 --- a/view/Main_page.py +++ b/view/Main_page.py @@ -27,6 +27,7 @@ class Main_page( Page ): count = None, http_url = None, conversion = None, + rename = False, ): startup_note_ids = [ startup_note.object_id for startup_note in startup_notes ] @@ -94,6 +95,7 @@ class Main_page( Page ): Input( type = u"hidden", name = u"startup_notes", id = u"startup_notes", value = json( startup_note_dicts ) ), Input( type = u"hidden", name = u"current_notes", id = u"current_notes", value = json( note_dicts ) ), Input( type = u"hidden", name = u"note_read_write", id = u"note_read_write", value = json( note_read_write ) ), + Input( type = u"hidden", name = u"rename", id = u"rename", value = json( rename ) ), Div( id = u"status_area", ),