Improve home page

This commit is contained in:
rubenwardy 2018-12-22 21:03:01 +00:00
parent 8eedbf64a4
commit 5f40d68441
3 changed files with 26 additions and 16 deletions

View File

@ -4,8 +4,8 @@
Welcome
{% endblock %}
{% block container %}
<header class="jumbotron">
{% block content %}
<!-- <header class="jumbotron">
<div class="container">
<h1 class="display-3">{{ config.USER_APP_NAME }}</h1>
@ -18,16 +18,29 @@ Welcome
</div>
</header>
<main class="container">
<main class="container"> -->
{% from "macros/packagegridtile.html" import render_pkggrid %}
<h2>Popular</h2>
{{ render_pkggrid(popular) }}
<a href="{{ url_for('packages_page') }}" class="btn">Show More</a>
<h2 style="margin-top:2em;">Newly Added</h2>
<a href="{{ url_for('packages_page', sort='created_at', order='desc') }}" class="btn btn-secondary float-right">
See more
</a>
<h2 class="my-3">Newly Added</h2>
{{ render_pkggrid(new) }}
</main>
<a href="{{ url_for('packages_page') }}" class="btn btn-secondary float-right">
See more
</a>
<h2 class="my-3">Popular</h2>
{{ render_pkggrid(popular) }}
<a href="{{ url_for('packages_page', type='txp') }}" class="btn btn-secondary float-right">
See more
</a>
<h2 class="my-3">Top Texture Packs</h2>
{{ render_pkggrid(pop_txp) }}
<!-- </main> -->
{% endblock %}

View File

@ -40,11 +40,7 @@
{% else %}
<li><i>No packages available</i></ul>
{% endfor %}
{% set amt=packages|length %}
{% if amt > 4 %}
{% set amt=4 %}
{% endif %}
{% for i in range(amt) %}
{% for i in range(4) %}
<li class="packagetile flex-fill"></li>
{% endfor %}
</ul>

View File

@ -48,9 +48,10 @@ def send_upload(path):
def home_page():
query = Package.query.filter_by(approved=True, soft_deleted=False)
count = query.count()
new = query.order_by(db.desc(Package.created_at)).limit(12).all()
new = query.order_by(db.desc(Package.created_at)).limit(8).all()
popular = query.order_by(db.desc(Package.score)).limit(8).all()
return render_template("index.html", new=new, popular=popular, count=count)
pop_txp = query.filter_by(type=PackageType.TXP).order_by(db.desc(Package.score)).limit(4).all()
return render_template("index.html", new=new, popular=popular, count=count, pop_txp=pop_txp)
from . import users, githublogin, packages, meta, threads, api
from . import tasks, admin, notifications, tagseditor, licenseseditor