witten
/
luminotes
Archived
1
0
Fork 0

Now the tree expander arrow only displays if there are actually any links within the note.

This commit is contained in:
Dan Helfman 2008-04-10 19:40:17 +00:00
parent ae5fbd5837
commit cd98b7c9e6
3 changed files with 22 additions and 2 deletions

View File

@ -525,10 +525,12 @@ img {
.link_area_item {
padding: 0.2em 0.25em 0.2em 0.5em;
font-size: 90%;
}
.note_tree_item {
padding: 0.2em 0.25em 0.2em 0;
font-size: 90%;
}
.tree_expander {
@ -543,6 +545,12 @@ img {
cursor: pointer;
}
.tree_expander_empty {
float: left;
width: 20px;
height: 1.5em;
}
#storage_usage_area {
padding-top: 0.1em;
}

View File

@ -2588,12 +2588,19 @@ Note_tree.prototype.link_clicked = function ( event ) {
event.stop();
}
LINK_PATTERN = /<a\s+([^>]+\s)?href="[^"]+"[^>]*>/;
Note_tree.prototype.add_link = function ( editor ) {
// for now, only add startup notes to the note tree
if ( !editor.startup )
return;
var expander = createDOM( "div", { "class": "tree_expander" } );
// display the tree expander arrow if the given note's editor contains any outgoing links
if ( LINK_PATTERN.exec( editor.contents() ) )
var expander = createDOM( "div", { "class": "tree_expander" } );
else
var expander = createDOM( "div", { "class": "tree_expander_empty" } );
var link = createDOM( "a", {
"href": "/notebooks/" + this.notebook_id + "?note_id=" + editor.id,
"id": "note_tree_link_" + editor.id,

View File

@ -1,7 +1,10 @@
import re
from Tags import Div, Span, H4, A
class Note_tree_area( Div ):
LINK_PATTERN = re.compile( u'<a\s+([^>]+\s)?href="[^"]+"[^>]*>', re.IGNORECASE )
def __init__( self, toolbar, notebook, root_notes, total_notes_count ):
Div.__init__(
self,
@ -15,7 +18,9 @@ class Note_tree_area( Div ):
id = u"note_tree_area_title",
),
[ Div(
Div( class_ = u"tree_expander" ),
self.LINK_PATTERN.search( note.contents ) and \
Div( id = u"note_tree_expander_" + note.object_id, class_ = u"tree_expander" ) or
Div( id = u"note_tree_expander_" + note.object_id, class_ = u"tree_expander_empty" ),
A(
note.title or u"untitled note",
href = u"/notebooks/%s?note_id=%s" % ( notebook.object_id, note.object_id ),