diff --git a/static/css/style.css b/static/css/style.css index 30cc2e1..fd69348 100644 --- a/static/css/style.css +++ b/static/css/style.css @@ -527,6 +527,10 @@ img { padding: 0.2em 0.25em 0.2em 0.5em; } +.note_tree_item { + padding: 0.2em 0.25em 0.2em 0; +} + .tree_expander { float: left; width: 20px; diff --git a/static/js/Wiki.js b/static/js/Wiki.js index 227b1c7..894e6ed 100644 --- a/static/js/Wiki.js +++ b/static/js/Wiki.js @@ -2597,11 +2597,11 @@ Note_tree.prototype.add_link = function ( editor ) { "href": "/notebooks/" + this.notebook_id + "?note_id=" + editor.id, "id": "note_tree_link_" + editor.id, "class": "note_tree_link" - }, editor.title ); + }, editor.title || "untitled note" ); appendChildNodes( "note_tree_area_holder", createDOM( "div", - { "id": "note_tree_item_" + editor.id, "class": "link_area_item" }, + { "id": "note_tree_item_" + editor.id, "class": "note_tree_item" }, expander, link ) ); @@ -2616,6 +2616,14 @@ Note_tree.prototype.remove_link = function ( id ) { } Note_tree.prototype.rename_link = function ( editor, new_title ) { + var link = getElement( "note_tree_link_" + editor.id ); + + if ( !link ) { + this.add_link( editor ); + return; + } + + replaceChildNodes( link, new_title || "untitled note" ); } Note_tree.prototype.expand_link = function ( id ) { diff --git a/view/Note_tree_area.py b/view/Note_tree_area.py index c8e5c1f..bf86955 100644 --- a/view/Note_tree_area.py +++ b/view/Note_tree_area.py @@ -17,13 +17,13 @@ class Note_tree_area( Div ): [ Div( Div( class_ = u"tree_expander" ), A( - note.title, + note.title or u"untitled note", href = u"/notebooks/%s?note_id=%s" % ( notebook.object_id, note.object_id ), id = u"note_tree_link_" + note.object_id, class_ = u"note_tree_link", ), id = u"note_tree_item_" + note.object_id, - class_ = u"link_area_item", + class_ = u"note_tree_item", ) for note in root_notes ], id = u"note_tree_area_holder", ),