Some more light fixes, plus fix the subnode "404".

This commit is contained in:
Flancian 2020-11-16 21:15:02 +01:00
parent eaf64849c8
commit 25c554fe92
3 changed files with 18 additions and 6 deletions

View file

@ -182,8 +182,12 @@ def subnodes_by_user(user):
return subnodes return subnodes
def subnode_by_uri(uri): def subnode_by_uri(uri):
subnode = [subnode for subnode in all_subnodes() if subnode.uri == uri][0] subnode = [subnode for subnode in all_subnodes() if subnode.uri == uri]
return subnode if subnode:
return subnode[0]
else:
# TODO: handle.
return False
def nodes_by_outlink(wikilink): def nodes_by_outlink(wikilink):
nodes = [node for node in all_nodes() if wikilink in node.outlinks] nodes = [node for node in all_nodes() if wikilink in node.outlinks]

View file

@ -17,13 +17,16 @@
{% extends "base.html" %} {% extends "base.html" %}
{% block content %} {% block content %}
{% if not subnodes %} {% if not subnodes %}
No node found for '{{wikilink}}'. <div class="message">
No node found at [[{{wikilink}}]].
<br /><br /> <br /><br />
If you <a href="https://flancia.org/go/agora">contributed a subnode</a> named '{{wikilink}}' to the Agora, this node would not be empty :) If you <a href="https://flancia.org/go/agora">contributed a subnode</a> named '{{wikilink}}' to the Agora, this node would exist :)
<br /><br /> <br /><br />
Go back to <a href="/nodes">/nodes</a>? Try listing <a href="/nodes">nodes</a> or perhaps <a href="/search">search</a>.
</div>
{% endif %} {% endif %}
{% if subnodes %}
<div class="node"> <div class="node">
<span class="node-header"><strong>Node</strong> <a href="/node/{{wikilink}}">[[{{wikilink}}]]</a></span> <span class="node-header"><strong>Node</strong> <a href="/node/{{wikilink}}">[[{{wikilink}}]]</a></span>
@ -41,5 +44,6 @@ Go back to <a href="/nodes">/nodes</a>?
<a href="{{subnode.url}}">{{subnode.wikilink}}</a> by <a href="/@{{subnode.user}}">@{{subnode.user}}</a><br /> <a href="{{subnode.url}}">{{subnode.wikilink}}</a> by <a href="/@{{subnode.user}}">@{{subnode.user}}</a><br />
{% endfor %} {% endfor %}
</div> </div>
{% endif %}
{% endblock %} {% endblock %}

View file

@ -17,11 +17,14 @@
{% extends "base.html" %} {% extends "base.html" %}
{% block content %} {% block content %}
{% if not subnode %} {% if not subnode %}
<div class="message">
No subnode found matching '{{subnode}}'. No subnode found matching '{{subnode}}'.
<br /><br /> <br /><br />
Go back to <a href="/nodes">/nodes</a>, <a href="/subnodes">/nodes</a>? Try listing <a href="/subnodes">subnodes</a> or perhaps <a href="/search">search</a>.
</div>
{% endif %} {% endif %}
{% if subnode %}
<div class="subnode"> <div class="subnode">
<span class="subnode-header"><strong>Subnode</strong> <a href="{{subnode.url}}">{{subnode.uri}}</a> by <a href="/@{{subnode.user}}">@{{subnode.user}}</a> in <a href="/node/{{subnode.wikilink}}">[[{{subnode.wikilink}}]]</a></span> <span class="subnode-header"><strong>Subnode</strong> <a href="{{subnode.url}}">{{subnode.uri}}</a> by <a href="/@{{subnode.user}}">@{{subnode.user}}</a> in <a href="/node/{{subnode.wikilink}}">[[{{subnode.wikilink}}]]</a></span>
{{ subnode.content|markdown|linkify|safe }} {{ subnode.content|markdown|linkify|safe }}
@ -29,5 +32,6 @@ Go back to <a href="/nodes">/nodes</a>, <a href="/subnodes">/nodes</a>?
<div class="backlinks"> <div class="backlinks">
<span class="backlinks-header">To see backlinks, go up to node <a href="/node/{{subnode.wikilink}}">[[{{subnode.wikilink}}]]</a>.</span> <span class="backlinks-header">To see backlinks, go up to node <a href="/node/{{subnode.wikilink}}">[[{{subnode.wikilink}}]]</a>.</span>
{% endif %}
{% endblock %} {% endblock %}