Now the tree expander arrow only displays if there are actually any links within the note.
This commit is contained in:
parent
ae5fbd5837
commit
cd98b7c9e6
|
@ -525,10 +525,12 @@ img {
|
||||||
|
|
||||||
.link_area_item {
|
.link_area_item {
|
||||||
padding: 0.2em 0.25em 0.2em 0.5em;
|
padding: 0.2em 0.25em 0.2em 0.5em;
|
||||||
|
font-size: 90%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.note_tree_item {
|
.note_tree_item {
|
||||||
padding: 0.2em 0.25em 0.2em 0;
|
padding: 0.2em 0.25em 0.2em 0;
|
||||||
|
font-size: 90%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tree_expander {
|
.tree_expander {
|
||||||
|
@ -543,6 +545,12 @@ img {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.tree_expander_empty {
|
||||||
|
float: left;
|
||||||
|
width: 20px;
|
||||||
|
height: 1.5em;
|
||||||
|
}
|
||||||
|
|
||||||
#storage_usage_area {
|
#storage_usage_area {
|
||||||
padding-top: 0.1em;
|
padding-top: 0.1em;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2588,12 +2588,19 @@ Note_tree.prototype.link_clicked = function ( event ) {
|
||||||
event.stop();
|
event.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LINK_PATTERN = /<a\s+([^>]+\s)?href="[^"]+"[^>]*>/;
|
||||||
|
|
||||||
Note_tree.prototype.add_link = function ( editor ) {
|
Note_tree.prototype.add_link = function ( editor ) {
|
||||||
// for now, only add startup notes to the note tree
|
// for now, only add startup notes to the note tree
|
||||||
if ( !editor.startup )
|
if ( !editor.startup )
|
||||||
return;
|
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", {
|
var link = createDOM( "a", {
|
||||||
"href": "/notebooks/" + this.notebook_id + "?note_id=" + editor.id,
|
"href": "/notebooks/" + this.notebook_id + "?note_id=" + editor.id,
|
||||||
"id": "note_tree_link_" + editor.id,
|
"id": "note_tree_link_" + editor.id,
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
|
import re
|
||||||
from Tags import Div, Span, H4, A
|
from Tags import Div, Span, H4, A
|
||||||
|
|
||||||
|
|
||||||
class Note_tree_area( Div ):
|
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 ):
|
def __init__( self, toolbar, notebook, root_notes, total_notes_count ):
|
||||||
Div.__init__(
|
Div.__init__(
|
||||||
self,
|
self,
|
||||||
|
@ -15,7 +18,9 @@ class Note_tree_area( Div ):
|
||||||
id = u"note_tree_area_title",
|
id = u"note_tree_area_title",
|
||||||
),
|
),
|
||||||
[ Div(
|
[ 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(
|
A(
|
||||||
note.title or u"untitled note",
|
note.title or u"untitled note",
|
||||||
href = u"/notebooks/%s?note_id=%s" % ( notebook.object_id, note.object_id ),
|
href = u"/notebooks/%s?note_id=%s" % ( notebook.object_id, note.object_id ),
|
||||||
|
|
Reference in New Issue