mirror of
https://github.com/minetest/contentdb.git
synced 2024-11-10 01:23:48 +01:00
Add metapackages pages
This commit is contained in:
parent
7b6ad051c4
commit
f4c9348b7f
15
app/templates/meta/list.html
Normal file
15
app/templates/meta/list.html
Normal file
@ -0,0 +1,15 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block title %}
|
||||
Meta Packages
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<ul>
|
||||
{% for meta in mpackages %}
|
||||
<li><a href="{{ url_for('meta_package_page', name=meta.name) }}">{{ meta.name }}</a> ({{ meta.packages | count }} packages)</li>
|
||||
{% else %}
|
||||
<li><i>No meta packages found.</i></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endblock %}
|
12
app/templates/meta/view.html
Normal file
12
app/templates/meta/view.html
Normal file
@ -0,0 +1,12 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block title %}
|
||||
Packages providing '{{ mpackage.name }}''
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h1>Packages providing '{{ mpackage.name }}''</h1>
|
||||
|
||||
{% from "macros/packagegridtile.html" import render_pkggrid %}
|
||||
{{ render_pkggrid(mpackage.packages) }}
|
||||
{% endblock %}
|
@ -69,7 +69,12 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Provides</td>
|
||||
<td>{{ package.provides | join(', ') }}</td>
|
||||
<td>{% for meta in package.provides %}
|
||||
<a href="{{ url_for('meta_package_page', name=meta.name) }}">{{ meta.name }}</a>
|
||||
{%- if not loop.last %}
|
||||
,
|
||||
{% endif %}
|
||||
{% endfor %}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Author</td>
|
||||
|
@ -43,7 +43,7 @@ def home_page():
|
||||
packages = query.order_by(db.desc(Package.created_at)).limit(15).all()
|
||||
return render_template("index.html", packages=packages, count=count)
|
||||
|
||||
from . import users, githublogin, packages, sass, tasks, admin, notifications, tagseditor
|
||||
from . import users, githublogin, packages, sass, tasks, admin, notifications, tagseditor, meta
|
||||
|
||||
@menu.register_menu(app, ".help", "Help", order=19, endpoint_arguments_constructor=lambda: { 'path': 'help' })
|
||||
@app.route('/<path:path>/')
|
||||
|
34
app/views/meta.py
Normal file
34
app/views/meta.py
Normal file
@ -0,0 +1,34 @@
|
||||
# Content DB
|
||||
# Copyright (C) 2018 rubenwardy
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
from flask import *
|
||||
from flask_user import *
|
||||
from app import app
|
||||
from app.models import *
|
||||
|
||||
@app.route("/metapackages/")
|
||||
def meta_package_list_page():
|
||||
mpackages = MetaPackage.query.order_by(db.desc(MetaPackage.name)).all()
|
||||
return render_template("meta/list.html", mpackages=mpackages)
|
||||
|
||||
@app.route("/metapackages/<name>/")
|
||||
def meta_package_page(name):
|
||||
mpackage = MetaPackage.query.filter_by(name=name).first()
|
||||
if mpackage is None:
|
||||
abort(404)
|
||||
|
||||
return render_template("meta/view.html", mpackage=mpackage)
|
Loading…
Reference in New Issue
Block a user