diff --git a/suchwow/routes/post.py b/suchwow/routes/post.py index e5dd803..6c8ddd5 100644 --- a/suchwow/routes/post.py +++ b/suchwow/routes/post.py @@ -10,6 +10,19 @@ from suchwow.utils.helpers import allowed_file bp = Blueprint("post", "post") +@bp.route("/posts/top") +def top(): + top_posts = {} + posts = Post.select() + for post in posts: + balance = float(wownero.Wallet().balances(post.account_index)[1]) + if balance > 0: + top_posts[post.id] = { + "post": post, + "balance": balance + } + return render_template("post/top.html", posts=top_posts) + @bp.route("/post/") def read(id): if Post.filter(id=id): diff --git a/suchwow/templates/index.html b/suchwow/templates/index.html index c86b057..7891cc5 100644 --- a/suchwow/templates/index.html +++ b/suchwow/templates/index.html @@ -5,7 +5,7 @@
-

{% block title %}Latest Submissions{% endblock %}

+

{% block title %}Latest Posts{% endblock %}

{% if posts %} @@ -28,6 +28,9 @@ Next {% endif %} +
+ +
{% endblock %} diff --git a/suchwow/templates/post/top.html b/suchwow/templates/post/top.html new file mode 100644 index 0000000..3957174 --- /dev/null +++ b/suchwow/templates/post/top.html @@ -0,0 +1,24 @@ +{% extends 'base.html' %} + +{% block content %} + +
+ +
+

{% block title %}Top Posts{% endblock %}

+
+ + {% if posts %} + + {% else %} +

No posts yet!

+ {% endif %} + + +
+ +{% endblock %}