Add metapackages pages

This commit is contained in:
rubenwardy 2018-05-27 16:51:46 +01:00
parent 7b6ad051c4
commit f4c9348b7f
No known key found for this signature in database
GPG Key ID: A1E29D52FF81513C
5 changed files with 68 additions and 2 deletions

@ -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 %}

@ -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

@ -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)