Display a nice icon on jstree if item is free

This commit is contained in:
Pablo Vazquez 2016-11-29 15:35:12 +01:00
parent 9783711818
commit 7fb94a86e8
2 changed files with 23 additions and 0 deletions

View File

@ -18,6 +18,7 @@ def jstree_parse_node(node, children=None):
# Define better the node type # Define better the node type
if node_type == 'asset': if node_type == 'asset':
node_type = node.properties.content_type node_type = node.properties.content_type
parsed_node = dict( parsed_node = dict(
id="n_{0}".format(node._id), id="n_{0}".format(node._id),
a_attr={"href": url_for_node(node=node)}, a_attr={"href": url_for_node(node=node)},
@ -25,10 +26,14 @@ def jstree_parse_node(node, children=None):
text=Markup.escape(node.name), text=Markup.escape(node.name),
type=node_type, type=node_type,
children=False) children=False)
# Append children property only if it is a directory type # Append children property only if it is a directory type
if node_type in GROUP_NODES: if node_type in GROUP_NODES:
parsed_node['children'] = True parsed_node['children'] = True
if node.permissions and node.permissions.world:
parsed_node['li_attr']['is_free'] = True
return parsed_node return parsed_node

View File

@ -20,6 +20,24 @@ $tree-color-highlight-background-text: white
+media-xs +media-xs
width: 100% width: 100%
&[is_free='true']
.jstree-anchor
padding-right: 20px
&:before
font-family: 'pillar-font'
content: '\e84e'
color: $color-success
font-size: .8em
padding: 0 5px
position: absolute
right: 5px
&.jstree-clicked
padding-right: 30px
&:before
color: $tree-color-highlight-background-text !important
right: 15px
&[data-node-type="page"], &[data-node-type="page"],
&[data-node-type="blog"] &[data-node-type="blog"]
font-size: 1.15em font-size: 1.15em