test with tree
parent
85087c9f56
commit
8e9f113fc1
@ -0,0 +1,34 @@
|
||||
:root {
|
||||
--size: 100px;
|
||||
}
|
||||
|
||||
svg {
|
||||
width: var(--size);
|
||||
height: var(--size);
|
||||
}
|
||||
|
||||
.branches {
|
||||
display: block;
|
||||
position: sticky;
|
||||
top: calc(-1 * var(--size));
|
||||
}
|
||||
|
||||
.node {
|
||||
position: sticky;
|
||||
top: calc(-1 * var(--size));
|
||||
display: inline-flex;
|
||||
justify-content: center;
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.children {
|
||||
height: var(--size);
|
||||
overflow: scroll;
|
||||
position: -webkit-sticky;
|
||||
position: sticky;
|
||||
top: calc(-1 * var(--size));
|
||||
display: inline-flex;
|
||||
align-items: flex-start;
|
||||
flex-direction: column;
|
||||
height: var(--size);
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
<%inherit file="base_mako.html" />
|
||||
|
||||
<%block name="head">
|
||||
<link rel="stylesheet" href="${url_for('static', filename='css/display_mako_bis.css')}">
|
||||
</%block>
|
||||
|
||||
<%def name="render_node(node)">
|
||||
<div class="node">
|
||||
<a href="${url_for('draw.draw', parent=node.name)}" target="__blank">
|
||||
${node.content}
|
||||
</a>
|
||||
% if len(node.children) > 0:
|
||||
<div class="children">
|
||||
% for child in node.children:
|
||||
${render_node(child)}
|
||||
% endfor
|
||||
</div>
|
||||
% endif
|
||||
</div>
|
||||
</%def>
|
||||
|
||||
|
||||
<main class="container">
|
||||
|
||||
% for branch in root.children:
|
||||
<div class="branches">
|
||||
${render_node(branch)}
|
||||
</div>
|
||||
% endfor
|
||||
|
||||
</main>
|
@ -0,0 +1,23 @@
|
||||
from bigtree import Node, print_tree, get_subtree
|
||||
from exquisite_branch.db import get_db, dict_factory
|
||||
|
||||
|
||||
def make_tree(branches):
|
||||
|
||||
nodes = {}
|
||||
nodes["NEW"] = Node("NEW")
|
||||
|
||||
for branch in branches:
|
||||
try:
|
||||
id = branch["branch"]
|
||||
parent_id = branch["parent"]
|
||||
content = branch["content"]
|
||||
username = branch["username"]
|
||||
nodes[id] = Node(
|
||||
id, parent=nodes[parent_id], content=content, username=username
|
||||
)
|
||||
except Exception as e:
|
||||
print(e)
|
||||
|
||||
nodes["NEW"].hshow(style="rounded")
|
||||
return nodes["NEW"]
|
@ -0,0 +1 @@
|
||||
Subproject commit ae185baf0c048ac5f9171314ea5e842362b99dcd
|
Loading…
Reference in New Issue