From 7f07fd0e31ca8a67d67af40a81f64405fd4c0da0 Mon Sep 17 00:00:00 2001 From: Flancian <0@flancia.org> Date: Fri, 4 Dec 2020 22:11:44 +0100 Subject: [PATCH] Move index to be just another node. --- app/agora.py | 5 ++++- app/templates/index.html | 14 +++++++++----- app/util.py | 4 ++++ 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/app/agora.py b/app/agora.py index e449c73..2e2ecf1 100644 --- a/app/agora.py +++ b/app/agora.py @@ -18,13 +18,16 @@ from markupsafe import escape from . import config from . import db from . import forms +from . import util bp = Blueprint('agora', __name__) @bp.route('/index') @bp.route('/') def index(): - return render_template('index.html', version=config.AGORA_VERSION, help=url_for('agora.help'), nodes=url_for('agora.nodes'), subnodes=url_for('agora.subnodes'), users=url_for('agora.users'), journals=url_for('agora.journals'), search=url_for('agora.search'), latest=url_for('agora.latest')) + node='index' + # return render_template('index.html', version=config.AGORA_VERSION, help_url=url_for('agora.help'), nodes_url=url_for('agora.nodes'), subnodes_url=url_for('agora.subnodes'), users_url=url_for('agora.users'), journals_url=url_for('agora.journals'), search_url=url_for('agora.search'), latest_url=url_for('agora.latest'), wikilink=node, subnodes=db.subnodes_by_wikilink(node), backlinks=db.subnodes_by_outlink(node)) + return render_template('node_rendered.html', wikilink=node, subnodes=util.rank(db.subnodes_by_wikilink(node), user='agora'), backlinks=db.subnodes_by_outlink(node)) @bp.route('/help') def help(): diff --git a/app/templates/index.html b/app/templates/index.html index ef08eae..7689db3 100644 --- a/app/templates/index.html +++ b/app/templates/index.html @@ -14,6 +14,8 @@ limitations under the License. --> + + {% extends "base.html" %} {% block content %}
@@ -23,11 +25,11 @@ This is the Agora v{{version}}.

This site is very much under construction, but feel free to look around: The [[wikilink]] is the heart of the Agora. /node/foo will render every subnode that resolves to wikilink [[foo]]. For example: [[Agora]]. @@ -35,4 +37,6 @@ The [[wikilink]] is the heart of the Agora.
For more information, please visit the
Agora repository. If you're interested in knowing what's coming, please refer to Agora plan.
+ +{% include "node_rendered.html" %} {% endblock %} diff --git a/app/util.py b/app/util.py index f70a978..90e32fe 100644 --- a/app/util.py +++ b/app/util.py @@ -17,6 +17,10 @@ from functools import lru_cache parser = DateDataParser(languages=['en']) +def rank(l, user): + # hack hack + return sorted(l, key=lambda x: x.user) + def canonical_wikilink(wikilink): if is_journal(wikilink):