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

View File

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

View File

@ -48,9 +48,10 @@ def send_upload(path):
def home_page(): def home_page():
query = Package.query.filter_by(approved=True, soft_deleted=False) query = Package.query.filter_by(approved=True, soft_deleted=False)
count = query.count() 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() 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 users, githublogin, packages, meta, threads, api
from . import tasks, admin, notifications, tagseditor, licenseseditor from . import tasks, admin, notifications, tagseditor, licenseseditor