Fixed bug where note deletion didn't properly remove the note link from the note tree.
Add a brief paragraph with instructions on how to add a note to the note tree, shown only when there are no notes there. Added a heading for "recent notes", which should be filled out with links in a subsequent commit.
This commit is contained in:
parent
db03f39c06
commit
efd9755547
|
@ -279,6 +279,11 @@ img {
|
|||
margin-bottom: 0.25em;
|
||||
}
|
||||
|
||||
#recent_notes_area_title {
|
||||
margin-top: 0.5em;
|
||||
margin-bottom: 0.25em;
|
||||
}
|
||||
|
||||
.note_tree_link {
|
||||
background: url(/static/images/note_icon.png) left center no-repeat;
|
||||
padding-left: 19px;
|
||||
|
@ -716,6 +721,7 @@ img {
|
|||
|
||||
.small_text {
|
||||
font-size: 90%;
|
||||
line-height: 140%;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
|
|
|
@ -1130,7 +1130,7 @@ Wiki.prototype.delete_editor = function ( event, editor ) {
|
|||
editor.shutdown();
|
||||
self.decrement_total_notes_count();
|
||||
self.display_empty_message();
|
||||
} );
|
||||
}, false, true );
|
||||
|
||||
event.stop();
|
||||
}
|
||||
|
@ -1219,7 +1219,7 @@ Wiki.prototype.compare_versions = function( event, editor, previous_revision ) {
|
|||
this.load_editor( editor.title, editor.id, null, null, editor.closed ? null : editor.iframe );
|
||||
}
|
||||
|
||||
Wiki.prototype.save_editor = function ( editor, fire_and_forget, callback, synchronous ) {
|
||||
Wiki.prototype.save_editor = function ( editor, fire_and_forget, callback, synchronous, suppress_save_signal ) {
|
||||
if ( !editor )
|
||||
editor = this.focused_editor;
|
||||
|
||||
|
@ -1237,7 +1237,8 @@ Wiki.prototype.save_editor = function ( editor, fire_and_forget, callback, synch
|
|||
editor.mark_clean();
|
||||
if ( callback )
|
||||
callback();
|
||||
signal( self, "note_saved", editor );
|
||||
if ( !suppress_save_signal )
|
||||
signal( self, "note_saved", editor );
|
||||
}, null, synchronous, fire_and_forget );
|
||||
} else {
|
||||
if ( callback )
|
||||
|
@ -2632,6 +2633,10 @@ Note_tree.prototype.add_root_link = function ( editor ) {
|
|||
var self = this;
|
||||
connect( expander, "onclick", function ( event ) { self.expand_link( event, editor.id ); } );
|
||||
connect( link, "onclick", function ( event ) { self.link_clicked( event ); } );
|
||||
|
||||
var instructions = getElement( "note_tree_instructions" );
|
||||
if ( instructions )
|
||||
addElementClass( instructions, "undisplayed" );
|
||||
}
|
||||
|
||||
Note_tree.prototype.remove_link = function ( note_id ) {
|
||||
|
@ -2639,6 +2644,13 @@ Note_tree.prototype.remove_link = function ( note_id ) {
|
|||
|
||||
if ( item )
|
||||
removeElement( item );
|
||||
|
||||
if ( getFirstElementByTagAndClassName( "a", null, "note_tree_root_table" ) )
|
||||
return;
|
||||
|
||||
var instructions = getElement( "note_tree_instructions" );
|
||||
if ( instructions )
|
||||
removeElementClass( instructions, "undisplayed" );
|
||||
}
|
||||
|
||||
Note_tree.prototype.rename_link = function ( editor, new_title ) {
|
||||
|
|
|
@ -25,9 +25,25 @@ class Note_tree_area( Div ):
|
|||
has_children = ( notebook.name != u"trash" ) and self.LINK_PATTERN.search( note.contents ) or False,
|
||||
root_note_id = note.object_id,
|
||||
) for note in root_notes ],
|
||||
Div(
|
||||
u'Add a note here: Click the "options" tab on a note, then "show on startup".',
|
||||
id = "note_tree_instructions",
|
||||
class_ = u"small_text link_area_item" + ( ( len( root_notes ) > 0 ) and u" undisplayed" or u"" ),
|
||||
) or None,
|
||||
tree_id = "note_tree_root_table",
|
||||
),
|
||||
id = u"note_tree_area_holder",
|
||||
H4( u"recent notes",
|
||||
id = u"recent_notes_area_title",
|
||||
),
|
||||
self.make_tree(
|
||||
[ self.make_item(
|
||||
title = note.title,
|
||||
link_attributes = u'href="/notebooks/%s?note_id=%s"' % ( notebook.object_id, note.object_id ),
|
||||
link_class = u"note_tree_link",
|
||||
has_children = False,
|
||||
) for note in []],#recent_notes ],
|
||||
),
|
||||
id = u"recent_notes_area_holder",
|
||||
),
|
||||
Span( id = "tree_arrow_hover_preload" ),
|
||||
Span( id = "tree_arrow_down_preload" ),
|
||||
|
@ -55,9 +71,10 @@ class Note_tree_area( Div ):
|
|||
)
|
||||
|
||||
@staticmethod
|
||||
def make_tree( items, tree_id = None ):
|
||||
def make_tree( items, other_node = None, tree_id = None ):
|
||||
return Table(
|
||||
items,
|
||||
other_node,
|
||||
id = tree_id or None,
|
||||
class_ = u"note_tree_table",
|
||||
)
|
||||
|
|
Reference in New Issue