This commit is contained in:
Flancian 2021-01-02 17:48:04 +01:00
parent cec60fa344
commit fdef705efe
3 changed files with 19 additions and 9 deletions

View file

@ -13,8 +13,9 @@
# limitations under the License. # limitations under the License.
import datetime import datetime
from flask import Blueprint, url_for, render_template, current_app, Response, redirect from flask import Blueprint, url_for, render_template, current_app, Response, redirect, request
from markupsafe import escape from markupsafe import escape
from slugify import slugify, SLUG_OK
from . import config from . import config
from . import db from . import db
from . import forms from . import forms
@ -97,16 +98,22 @@ def pull(node):
Here it "broadcasts": it renders all nodes that pull from a given node. Here it "broadcasts": it renders all nodes that pull from a given node.
Unclear at this point if this should exist at all, or whether it should do something else. Unclear at this point if this should exist at all, or whether it should do something else.
TODO: probably remove this, [[pull]] changed.
""" """
return redirect('/node/{}'.format(node)) return redirect('/node/{}'.format(node))
@bp.route('/jump')
def jump():
"""Redirects to the right node."""
jump = request.args.get('jump')
return redirect(url_for('.node', node=slugify(jump)))
# Entities # Entities
@bp.route('/wikilink/<node>')
@bp.route('/node/<node>') @bp.route('/node/<node>')
@bp.route('/wikilink/<node>') # alias for now def node(node):
def wikilink(node):
n = G.node(node) n = G.node(node)
n.subnodes = util.uprank(n.subnodes, user='flancian') n.subnodes = util.uprank(n.subnodes, user='flancian')

View file

@ -43,12 +43,12 @@
<nav class="navigation"> <nav class="navigation">
<a href="/"><img src="/static/img/agora.png" class="logo" style="vertical-align: top" width="19" height="19"></a> <a href="/"><img src="/static/img/agora.png" class="logo" style="vertical-align: top" width="19" height="19"></a>
| <a href="/nodes">nodes</a> | <a href="/nodes">nodes</a>
| <a href="/journals">journals</a> | <a href="/users">@</a>
| <a href="/users">users</a> | <form action="/jump" method="get" style="display: inline;">jump: <input type="text" name="jump"></form>
| <a href="/latest">latest</a>
| <a href="/search">search</a>
| <a href="#" style="text-decoration: none;" class="theme-toggle">🌙</a> | <a href="#" style="text-decoration: none;" class="theme-toggle">🌙</a>
| <a href="/node/agora-help" style="text-decoration: none;" class="help-button"></a> <!-- doesn't fit on mobile right now.
| <a href="/node/agora-help" style="text-decoration: none;" class="help-button"></a>
-->
</nav> </nav>
<hr> <hr>
<div class="content"> <div class="content">

View file

@ -23,7 +23,10 @@ python-Levenshtein==0.12.0
pytz==2020.4 pytz==2020.4
regex==2020.11.13 regex==2020.11.13
six==1.15.0 six==1.15.0
text-unidecode==1.3
tzlocal==2.1 tzlocal==2.1
unicode-slugify==0.1.3
Unidecode==1.1.2
uWSGI==2.0.19.1 uWSGI==2.0.19.1
webencodings==0.5.1 webencodings==0.5.1
Werkzeug==1.0.1 Werkzeug==1.0.1