mirror of
https://github.com/minetest/contentdb.git
synced 2025-01-08 22:17:34 +01:00
Add packages page to list all types
This commit is contained in:
parent
4e870bd641
commit
87d7b14283
@ -5,6 +5,12 @@ Dashboard
|
|||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
||||||
|
<form method="get" action="/packages/">
|
||||||
|
<input type="text" name="q" value="{{ query or ''}}" />
|
||||||
|
<input type="submit" value="Search" />
|
||||||
|
</form>
|
||||||
|
|
||||||
<div class="box box_grey">
|
<div class="box box_grey">
|
||||||
<h2>{{ self.title() }}</h2>
|
<h2>{{ self.title() }}</h2>
|
||||||
|
|
||||||
|
@ -13,26 +13,35 @@ from wtforms.validators import *
|
|||||||
# to do the menu
|
# to do the menu
|
||||||
|
|
||||||
def doPackageList(type):
|
def doPackageList(type):
|
||||||
packagesQ = Package.query.filter_by(type=type, approved=True)
|
title = "Packages"
|
||||||
|
query = Package.query
|
||||||
|
|
||||||
query = request.args.get("q")
|
if type is not None:
|
||||||
if query is not None:
|
title = type.value + "s"
|
||||||
packagesQ = packagesQ.filter(Package.title.contains(query))
|
query = query.filter_by(type=type, approved=True)
|
||||||
|
|
||||||
return render_template('packages.html', title=type.value + "s", packages=packagesQ.all(), query=query)
|
search = request.args.get("q")
|
||||||
|
if search is not None:
|
||||||
|
query = query.filter(Package.title.contains(search))
|
||||||
|
|
||||||
|
return render_template('packages.html', title=title, packages=query.all(), query=search)
|
||||||
|
|
||||||
|
@app.route('/packages/')
|
||||||
|
def packages_page():
|
||||||
|
return doPackageList(None)
|
||||||
|
|
||||||
@app.route('/mods/')
|
@app.route('/mods/')
|
||||||
@menu.register_menu(app, '.mods', 'Mods', order=10)
|
@menu.register_menu(app, '.mods', 'Mods', order=11)
|
||||||
def mods_page():
|
def mods_page():
|
||||||
return doPackageList(PackageType.MOD)
|
return doPackageList(PackageType.MOD)
|
||||||
|
|
||||||
@app.route('/games/')
|
@app.route('/games/')
|
||||||
@menu.register_menu(app, '.games', 'Games', order=11)
|
@menu.register_menu(app, '.games', 'Games', order=12)
|
||||||
def games_page():
|
def games_page():
|
||||||
return doPackageList(PackageType.GAME)
|
return doPackageList(PackageType.GAME)
|
||||||
|
|
||||||
@app.route('/texturepacks/')
|
@app.route('/texturepacks/')
|
||||||
@menu.register_menu(app, '.txp', 'Texture Packs', order=12)
|
@menu.register_menu(app, '.txp', 'Texture Packs', order=13)
|
||||||
def txp_page():
|
def txp_page():
|
||||||
return doPackageList(PackageType.TXP)
|
return doPackageList(PackageType.TXP)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user