Move links section to an include.

This commit is contained in:
Flancian 2020-12-21 14:38:50 +01:00
parent 4b8a6ada90
commit 38c35a8220
2 changed files with 59 additions and 45 deletions

58
app/templates/links.html Normal file
View file

@ -0,0 +1,58 @@
<!--
Copyright 2020 Google LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<span class="links-header">Links</span><br />
<div class="links">
{% if backlinks %}
<div class="backlinks">
<span class="backlinks-header">← back</span><br />
{% for subnode in backlinks %}
<a href="{{subnode.url}}">{{subnode.wikilink}}</a> by <a href="/@{{subnode.user}}">@{{subnode.user}}</a><br />
{% endfor %}
<br />
</div>
{% endif %}
{% if pushlinks %}
<div class="pushlinks">
<span class="pushlinks-header">⇇ push</span><br />
{% for subnode in pushlinks %}
<a href="{{subnode.url}}">{{subnode.wikilink}}</a> by <a href="/@{{subnode.user}}">@{{subnode.user}}</a><br />
{% endfor %}
<br />
</div>
{% endif %}
{% if pulllinks %}
<div class="pulllinks">
<span class="pulllinks-header">⇉ pull</span><br />
{% for subnode in pulllinks %}
<a href="{{subnode.url}}">{{subnode.wikilink}}</a> by <a href="/@{{subnode.user}}">@{{subnode.user}}</a><br />
{% endfor %}
<br />
</div>
{% endif %}
{% if forwardlinks %}
<div class="forwardlinks">
<span class="forwardlinks-header">→ forward</span><br />
{% for subnode in forwardlinks %}
<a href="{{subnode.url}}">{{subnode.wikilink}}</a> by <a href="/@{{subnode.user}}">@{{subnode.user}}</a><br />
{% endfor %}
<br />
</div>
{% endif %}
</div>

View file

@ -39,50 +39,6 @@ Try listing <a href="/nodes">nodes</a> or perhaps <a href="/search">search</a>.
</div>
{% endif %}
<!-- this should be an include -->
<span class="links-header">Links</span><br />
<div class="links">
{% if backlinks %}
<div class="backlinks">
<span class="backlinks-header">← back</span><br />
{% for subnode in backlinks %}
<a href="{{subnode.url}}">{{subnode.wikilink}}</a> by <a href="/@{{subnode.user}}">@{{subnode.user}}</a><br />
{% endfor %}
<br />
</div>
{% endif %}
{% if pushlinks %}
<div class="pushlinks">
<span class="pushlinks-header">⇇ push</span><br />
{% for subnode in pushlinks %}
<a href="{{subnode.url}}">{{subnode.wikilink}}</a> by <a href="/@{{subnode.user}}">@{{subnode.user}}</a><br />
{% endfor %}
<br />
</div>
{% endif %}
{% if pulllinks %}
<div class="pulllinks">
<span class="pulllinks-header">⇉ pull</span><br />
{% for subnode in pulllinks %}
<a href="{{subnode.url}}">{{subnode.wikilink}}</a> by <a href="/@{{subnode.user}}">@{{subnode.user}}</a><br />
{% endfor %}
<br />
</div>
{% endif %}
{% if forwardlinks %}
<div class="forwardlinks">
<span class="forwardlinks-header">→ forward</span><br />
{% for subnode in forwardlinks %}
<a href="{{subnode.url}}">{{subnode.wikilink}}</a> by <a href="/@{{subnode.user}}">@{{subnode.user}}</a><br />
{% endfor %}
<br />
</div>
{% endif %}
</div>
</div>
{% include "links.html" %}
{% endblock %}