contentdb/app/blueprints/packages/__init__.py

69 lines
1.8 KiB
Python
Raw Normal View History

2020-07-12 17:34:25 +02:00
# ContentDB
2021-01-30 17:59:42 +01:00
# Copyright (C) 2018-21 rubenwardy
2018-05-25 18:28:32 +02:00
#
# This program is free software: you can redistribute it and/or modify
2021-01-30 17:59:42 +01:00
# it under the terms of the GNU Affero General Public License as published by
2018-05-25 18:28:32 +02:00
# 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
2021-01-30 17:59:42 +01:00
# GNU Affero General Public License for more details.
2018-05-25 18:28:32 +02:00
#
2021-01-30 17:59:42 +01:00
# You should have received a copy of the GNU Affero General Public License
2018-05-25 18:28:32 +02:00
# along with this program. If not, see <https://www.gnu.org/licenses/>.
from flask import Blueprint
2022-01-07 23:11:12 +01:00
from flask_babel import gettext
2021-05-04 04:15:26 +02:00
from app.models import User, Package, Permission
bp = Blueprint("packages", __name__)
2018-05-25 18:28:32 +02:00
2021-05-04 04:15:26 +02:00
def get_package_tabs(user: User, package: Package):
if package is None or not package.checkPerm(user, Permission.EDIT_PACKAGE):
return []
return [
{
"id": "edit",
2022-01-07 23:11:12 +01:00
"title": gettext("Edit Details"),
2021-07-24 05:30:14 +02:00
"url": package.getURL("packages.create_edit")
2021-05-04 04:15:26 +02:00
},
{
"id": "releases",
2022-01-07 23:11:12 +01:00
"title": gettext("Releases"),
2021-07-24 05:30:14 +02:00
"url": package.getURL("packages.list_releases")
2021-05-04 04:15:26 +02:00
},
{
"id": "screenshots",
2022-01-07 23:11:12 +01:00
"title": gettext("Screenshots"),
2021-07-24 05:30:14 +02:00
"url": package.getURL("packages.screenshots")
2021-05-04 04:15:26 +02:00
},
{
"id": "maintainers",
2022-01-07 23:11:12 +01:00
"title": gettext("Maintainers"),
2021-07-24 05:30:14 +02:00
"url": package.getURL("packages.edit_maintainers")
2021-05-04 04:15:26 +02:00
},
2021-07-24 04:56:43 +02:00
{
"id": "audit",
2022-01-07 23:11:12 +01:00
"title": gettext("Audit Log"),
2021-07-24 04:56:43 +02:00
"url": package.getURL("packages.audit")
},
{
"id": "share",
2022-01-07 23:11:12 +01:00
"title": gettext("Share and Badges"),
2021-07-24 04:56:43 +02:00
"url": package.getURL("packages.share")
},
2021-05-04 04:15:26 +02:00
{
"id": "remove",
2022-01-07 23:11:12 +01:00
"title": gettext("Remove"),
2021-07-24 05:30:14 +02:00
"url": package.getURL("packages.remove")
2021-05-04 04:15:26 +02:00
}
]
2022-02-01 22:22:28 +01:00
from . import packages, screenshots, releases, reviews, game_hub