contentdb/app/templates/packages/view.html

464 lines
16 KiB
HTML
Raw Normal View History

2018-12-21 17:06:52 +01:00
{% set query=package.name %}
2018-03-19 19:08:41 +01:00
{% extends "base.html" %}
{% block title %}
2018-03-20 03:17:33 +01:00
{{ package.title }}
2018-03-19 19:08:41 +01:00
{% endblock %}
2020-04-23 19:25:38 +02:00
{% block headextra %}
<meta name="og:title" content="{{ package.title }}"/>
<meta name="og:description" content="{{ package.short_desc }}"/>
<meta name="description" content="{{ package.short_desc }}"/>
2021-07-24 05:30:14 +02:00
<meta name="og:url" content="{{ package.getURL("packages.view", absolute=True) }}"/>
2020-04-23 19:25:38 +02:00
{% if package.getMainScreenshotURL() %}
2020-04-24 00:49:46 +02:00
<meta name="og:image" content="{{ package.getMainScreenshotURL(absolute=True) }}"/>
2020-04-23 19:25:38 +02:00
{% endif %}
{% endblock %}
2021-07-31 22:03:45 +02:00
{% macro render_license(license) %}
{% if license.url %}
<a href="{{ license.url }}">{{ license.name }}</a>
{% else %}
{{ license.name }}
{% endif %}
{% endmacro %}
2018-12-21 16:58:43 +01:00
{% block container %}
2020-01-21 23:40:51 +01:00
{% if not package.license.is_foss and not package.media_license.is_foss and package.type != package.type.TXP %}
{% set package_warning="Non-free code and media" %}
{% elif not package.license.is_foss and package.type != package.type.TXP %}
{% set package_warning="Non-free code" %}
{% elif not package.media_license.is_foss %}
{% set package_warning="Non-free media" %}
{% endif %}
{% set release = package.getDownloadRelease() %}
<main>
{% set cover_image = package.cover_image.url or package.getMainScreenshotURL() %}
2018-12-21 17:36:54 +01:00
<header class="jumbotron pb-3"
style="background: linear-gradient(rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.7)), url('{{ cover_image }}');
2020-12-06 05:07:51 +01:00
background-size: cover;
background-repeat: no-repeat;
background-position: center;">
2018-12-21 16:58:43 +01:00
<div class="container">
2021-02-03 18:40:03 +01:00
<div class="btn-group float-right mb-4">
{% if package.checkPerm(current_user, "EDIT_PACKAGE") %}
2021-07-24 05:30:14 +02:00
<a class="btn btn-primary" href="{{ package.getURL("packages.create_edit") }}">
2021-02-28 06:16:15 +01:00
<i class="fas fa-pen mr-1"></i>
2021-02-03 18:40:03 +01:00
{{ _("Edit") }}
</a>
{% endif %}
{% if package.checkPerm(current_user, "MAKE_RELEASE") %}
2021-07-24 05:30:14 +02:00
<a class="btn btn-primary" href="{{ package.getURL("packages.create_release") }}">
2021-02-03 18:40:03 +01:00
<i class="fas fa-plus mr-1"></i>
{{ _("Release") }}
</a>
{% endif %}
{% if package.checkPerm(current_user, "DELETE_PACKAGE") or package.checkPerm(current_user, "UNAPPROVE_PACKAGE") %}
2021-07-24 05:30:14 +02:00
<a class="btn btn-danger" href="{{ package.getURL("packages.remove") }}">
2021-02-03 18:40:03 +01:00
<i class="fas fa-trash mr-1"></i>
{{ _("Remove") }}
</a>
{% endif %}
</div>
2018-12-23 17:28:15 +01:00
<h1 class="display-3">
{{ package.title }}
</h1>
2018-03-20 03:17:33 +01:00
2018-12-21 16:58:43 +01:00
<p class="lead">
2019-01-29 04:00:01 +01:00
{{ package.short_desc }}
2018-12-21 16:58:43 +01:00
</p>
2018-05-29 22:24:50 +02:00
2020-01-21 23:40:51 +01:00
<p>
{% if package_warning %}
2020-05-29 16:52:30 +02:00
<a class="badge badge-danger" href="/help/non_free/">
2020-01-21 23:40:51 +01:00
<i class="fas fa-exclamation-circle" style="margin-right: 0.3em;"></i>
{{ package_warning }}
2020-05-29 16:52:30 +02:00
</a>
2020-01-21 23:40:51 +01:00
{% endif %}
2020-07-17 21:48:51 +02:00
{% for warning in package.content_warnings %}
<a class="badge badge-warning" rel="nofollow" href="/help/content_flags/"
title="{{ warning.description }}">
<i class="fas fa-exclamation-circle" style="margin-right: 0.3em;"></i>
{{ warning.title }}
</a>
{% endfor %}
2020-01-21 23:40:51 +01:00
{% for t in package.tags %}
2020-07-16 15:06:29 +02:00
<a class="badge badge-primary" rel="nofollow"
2020-07-18 03:54:40 +02:00
title="{{ t.description or '' }}"
href="{{ url_for('packages.list_all', tag=t.name) }}">
{{ t.title }}
</a>
2020-01-21 23:40:51 +01:00
{% endfor %}
</p>
<div class="info-row row" style="margin-top: 2rem;">
<div class="btn-group-horizontal col">
2021-02-03 18:40:03 +01:00
<a class="btn" href="{{ url_for('users.profile', username=package.author.username) }}" title="{{ _("Author") }}">
2020-01-21 23:40:51 +01:00
<i class="fas fa-user"></i>
<span class="count">
{{ package.author.display_name }}
</span>
</a>
2021-05-08 01:30:57 +02:00
{% if release %}
2021-07-24 05:30:14 +02:00
<a class="btn" rel="nofollow" href="{{ package.getURL("packages.download") }}" title="{{ _("Downloads") }}"
2021-05-08 01:30:57 +02:00
download="{{ release.getDownloadFileName() }}">
<i class="fas fa-download"></i>
<span class="count">{{ package.downloads }}</span>
</a>
{% endif %}
2021-02-03 18:40:03 +01:00
<a class="btn" href="{{ url_for('threads.list_all', pid=package.id) }}" title="{{ _("Threads") }}">
2020-01-21 23:40:51 +01:00
<i class="fas fa-comment-alt"></i>
<span class="count">{{ threads | length }}</span>
</a>
2021-02-03 18:40:03 +01:00
<a class="btn" href="#reviews" title="{{ _("Reviews") }}">
<i class="fas fa-star-half-alt"></i>
<span class="count">
+{{ package.reviews | selectattr("recommends") | list | length }}
/
-{{ package.reviews | rejectattr("recommends") | list | length }}
</span>
</a>
2020-01-21 23:40:51 +01:00
{% if package.website %}
<a class="btn" href="{{ package.website }}">
<i class="fas fa-globe-europe"></i>
<span class="count">{{ _("Website") }}</span>
</a>
{% endif %}
{% if package.repo %}
<a class="btn" href="{{ package.repo }}">
<i class="fas fa-code"></i>
<span class="count">{{ _("Source") }}</span>
</a>
{% endif %}
{% if package.forums %}
<a class="btn" href="https://forum.minetest.net/viewtopic.php?t={{ package.forums }}">
<i class="fas fa-comments"></i>
<span class="count">{{ _("Forums") }}</span>
</a>
{% endif %}
{% if package.issueTracker %}
<a class="btn" href="{{ package.issueTracker }}">
<i class="fas fa-bug"></i>
<span class="count">{{ _("Issue Tracker") }}</span>
</a>
{% endif %}
2018-12-21 17:36:54 +01:00
</div>
2020-01-21 23:40:51 +01:00
{% if release and (release.min_rel or release.max_rel) %}
2020-01-22 00:42:41 +01:00
<div class="btn col-md-auto">
2020-01-21 23:40:51 +01:00
<img src="https://www.minetest.net/media/icon.svg" style="max-height: 1.2em;">
<span class="count">
{% if release.min_rel and release.max_rel %}
{{ _("%(min)s - %(max)s", min=release.min_rel.name, max=release.max_rel.name) }}
{% elif release.min_rel %}
{{ _("%(min)s and above", min=release.min_rel.name) }}
{% elif release.max_rel %}
{{ _("%(max)s and below", max=release.max_rel.name) }}
{% endif %}
</span>
</div>
{% endif %}
<div class="btn-group btn-group-horizontal col-md-auto">
2020-01-21 23:40:51 +01:00
{% if release %}
2021-05-04 23:06:31 +02:00
<a class="btn btn-download" rel="nofollow" download="{{ release.getDownloadFileName() }}"
2021-07-24 05:30:14 +02:00
href="{{ package.getURL("packages.download") }}">
2020-01-21 23:40:51 +01:00
{{ _("Download") }}
</a>
{% if package.type == package.type.MOD %}
{% set installing_url = "https://wiki.minetest.net/Installing_Mods" %}
{% elif package.type == package.type.GAME %}
{% set installing_url = "https://wiki.minetest.net/Games#Installing_games" %}
{% elif package.type == package.type.TXP %}
{% set installing_url = "https://wiki.minetest.net/Installing_Texture_Packs" %}
{% else %}
{{ 0 / 0 }}
{% endif %}
<a href="{{ installing_url }}" class="btn btn-download">
<i class="fas fa-question-circle"></i>
</a>
2020-01-21 23:40:51 +01:00
{% else %}
<i>
{{ _("No downloads available") }}
</i>
{% endif %}
2018-12-21 17:36:54 +01:00
</div>
2018-12-21 16:58:43 +01:00
</div>
2018-05-21 23:42:02 +02:00
</div>
2018-12-21 17:36:54 +01:00
</header>
{% if not package.approved %}
<section class="my-4 pb-3" style="border-bottom: 1px solid rgba(0,0,0,0.5);">
<div class="container">
{% from "macros/package_approval.html" import render_banners %}
2021-07-29 20:34:47 +02:00
{{ render_banners(package, current_user, topic_error, topic_error_lvl, conflicting_modnames) }}
{% if review_thread and review_thread.checkPerm(current_user, "SEE_THREAD") %}
<h2>{% if review_thread.private %}&#x1f512;{% endif %} {{ review_thread.title }}</h2>
{% if review_thread.private %}
<p><i>
This thread is only visible to the package owner and users of
2021-08-16 19:57:05 +02:00
Approver rank or above.
</i></p>
{% endif %}
2018-12-21 17:55:22 +01:00
{% from "macros/threads.html" import render_thread %}
{{ render_thread(review_thread, current_user) }}
{% endif %}
</div>
</section>
{% endif %}
2018-03-20 03:17:33 +01:00
<section class="container mt-4">
2021-02-03 18:40:03 +01:00
<div class="row">
<div class="col-md-9" style="padding-right: 45px;">
{% set screenshots = package.screenshots.all() %}
{% if screenshots or package.checkPerm(current_user, "ADD_SCREENSHOTS") %}
{% if package.checkPerm(current_user, "ADD_SCREENSHOTS") %}
2021-07-24 05:30:14 +02:00
<a href="{{ package.getURL("packages.screenshots") }}" class="btn btn-primary float-right">
2021-02-03 18:40:03 +01:00
<i class="fas fa-images mr-1"></i>
Edit
2021-01-30 01:15:07 +01:00
</a>
2018-12-21 16:58:43 +01:00
{% endif %}
2020-05-29 16:52:30 +02:00
2021-02-03 18:40:03 +01:00
<ul class="screenshot_list">
{% for ss in screenshots %}
{% if ss.approved or package.checkPerm(current_user, "ADD_SCREENSHOTS") %}
<li>
<a href="{{ ss.url }}" class="position-relative">
2021-02-03 18:40:03 +01:00
<img src="{{ ss.getThumbnailURL() }}" alt="{{ ss.title }}" />
{% if not ss.approved %}
<span class="badge bg-dark badge-tr">{{ _("Awaiting review") }}</span>
{% endif %}
2021-02-03 18:40:03 +01:00
</a>
</li>
{% endif %}
{% else %}
<li>
2021-07-24 05:30:14 +02:00
<a href="{{ package.getURL("packages.create_screenshot") }}">
2021-02-03 18:40:03 +01:00
<i class="fas fa-plus screenshot-add"></i>
</a>
</li>
{% endfor %}
</ul>
{% endif %}
2021-02-03 18:40:03 +01:00
{% if package.desc %}
<article class="markdown panel mb-5">
{{ package.desc | markdown }}
</article>
{% endif %}
<h2 id="reviews" class="mt-0">{{ _("Reviews") }}</h2>
2021-08-18 23:09:41 +02:00
{% from "macros/reviews.html" import render_reviews, render_review_form, render_review_preview with context %}
2021-02-03 18:40:03 +01:00
{% if current_user.is_authenticated %}
{% if has_review %}
<p>
2021-07-24 05:30:14 +02:00
<a class="btn btn-primary" href="{{ package.getURL("packages.review") }}">
2021-02-03 18:40:03 +01:00
{{ _("Edit Review") }}
</a>
</p>
{% elif current_user in package.maintainers %}
<p>
{{ _("You can't review your own package.") }}
</p>
{% else %}
{{ render_review_preview(package) }}
2018-12-21 16:58:43 +01:00
{% endif %}
2021-02-03 18:40:03 +01:00
{% else %}
{{ render_review_preview(package) }}
{% endif %}
{{ render_reviews(package.reviews, current_user) }}
{% if packages_uses %}
<h2>Used By</h2>
2021-02-03 18:40:03 +01:00
{% from "macros/packagegridtile.html" import render_pkggrid %}
{{ render_pkggrid(packages_uses) }}
2021-02-03 18:40:03 +01:00
{% endif %}
2018-12-21 16:58:43 +01:00
</div>
2018-12-21 17:00:18 +01:00
2021-02-03 18:40:03 +01:00
<aside class="col-md-3 info-sidebar">
{% if package.checkPerm(current_user, "MAKE_RELEASE") and package.update_config and package.update_config.outdated_at %}
{% set config = package.update_config %}
<div class="alert alert-warning">
<p class="mt-0 my-1">
<b>Package may be outdated</b>
</p>
<p class="mt-0 my-1">
{{ config.get_message() }}
</p>
<p class="mt-0 my-1" style="font-size: 80%; opacity: 85%;">
<i class="fas fa-lock mr-1"></i>
{{ _("Only visible to the author and Editors.") }}
</p>
<div class="btn-group btn-group-sm my-0">
<a class="btn btn-warning" href="{{ config.get_create_release_url() }}">
<i class="fas fa-plus mr-1"></i>
{{ _("Release") }}
</a>
2021-07-24 05:30:14 +02:00
<a class="btn btn-warning" href="{{ package.getURL("packages.update_config") }}">
2021-02-03 18:40:03 +01:00
<i class="fas fa-cog mr-1"></i>
{{ _("Update settings") }}
</a>
</div>
</div>
{% endif %}
{% if package_warning %}
<p class="alert alert-danger">
<a href="/help/non_free/" class="float-right">Info</a>
<b>Warning:</b> {{ package_warning }}
</p>
{% endif %}
2020-01-21 23:59:44 +01:00
2021-02-03 18:40:03 +01:00
{% if package.type != package.type.TXP %}
<h3>{{ _("Dependencies") }}</h3>
<dl>
<dt>{{ _("Required") }}</dt>
<dd>
{% for dep in package.getSortedHardDependencies() %}
2020-01-21 23:59:44 +01:00
{%- if dep.package %}
2021-02-03 18:40:03 +01:00
<a class="badge badge-primary"
2021-07-24 05:30:14 +02:00
href="{{ dep.package.getURL("packages.view") }}">
2020-01-21 23:59:44 +01:00
{{ dep.package.title }} by {{ dep.package.author.display_name }}
2021-02-03 18:40:03 +01:00
</a>
2020-01-21 23:59:44 +01:00
{% elif dep.meta_package %}
2021-02-03 18:40:03 +01:00
<a class="badge badge-primary"
2020-01-21 23:59:44 +01:00
href="{{ url_for('metapackages.view', name=dep.meta_package.name) }}">
{{ dep.meta_package.name }}
2021-02-03 18:40:03 +01:00
</a>
2020-01-21 23:59:44 +01:00
{% else %}
2021-02-08 01:46:39 +01:00
{{ "Expected package or meta_package in dep!" | throw }}
2021-02-03 18:40:03 +01:00
{% endif %}
{% else %}
No required dependencies
2020-01-21 23:59:44 +01:00
{% endfor %}
2021-02-03 18:40:03 +01:00
</dd>
{% set optional_deps=package.getSortedOptionalDependencies() %}
{% if optional_deps %}
<dt>{{ _("Optional") }}</dt>
<dd>
{% for dep in optional_deps %}
{%- if dep.package %}
<a class="badge badge-secondary"
2021-07-24 05:30:14 +02:00
href="{{ dep.package.getURL("packages.view") }}">
2021-02-03 18:40:03 +01:00
{{ dep.package.title }} by {{ dep.package.author.display_name }}
{% elif dep.meta_package %}
<a class="badge badge-secondary"
href="{{ url_for('metapackages.view', name=dep.meta_package.name) }}">
{{ dep.meta_package.name }}
{% else %}
{{ "Expected package or meta_package in dep!" | throw }}
{% endif %}</a>
{% endfor %}
</dd>
2020-01-21 23:59:44 +01:00
{% endif %}
2021-02-03 18:40:03 +01:00
</dl>
{% endif %}
2018-12-21 17:00:18 +01:00
2021-02-03 18:40:03 +01:00
<h3>
{{ _("Information") }}
</h3>
<dl>
<dt>{{ _("Type") }}</dt>
<dd>{{ package.type.value }}</dd>
<dt>{{ _("Technical Name") }}</dt>
<dd>{{ package.name }}</dd>
<dt>{{ _("License") }}</dt>
<dd>
{% if package.license == package.media_license %}
2021-07-31 22:03:45 +02:00
{{ render_license(package.license) }}
2021-02-03 18:40:03 +01:00
{% elif package.type == package.type.TXP %}
2021-07-31 22:03:45 +02:00
{{ render_license(package.media_license) }}
2021-02-03 18:40:03 +01:00
{% else %}
2021-07-31 22:03:45 +02:00
{{ render_license(package.license) }} for code,<br />
{{ render_license(package.media_license) }} for media.
2021-02-03 18:40:03 +01:00
{% endif %}
</dd>
<dt>Added</dt>
<dd>{{ package.created_at | datetime }}</dd>
<dt>Maintainers</dt>
<dd>
{% for user in package.maintainers %}
2021-07-24 04:56:43 +02:00
<a class="badge badge-secondary"
2021-02-03 18:40:03 +01:00
href="{{ url_for('users.profile', username=user.username) }}">
{{ user.display_name }}
</a>
{% endfor %}
{% if current_user in package.maintainers and current_user != package.author %}
2021-07-24 05:30:14 +02:00
<form class="mt-2" method="post" action="{{ package.getURL("packages.remove_self_maintainers") }}">
2021-02-03 18:40:03 +01:00
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
2021-07-24 04:56:43 +02:00
<input class="btn btn-sm btn-link p-0" type="submit" value="{{ _('Remove myself') }}" />
2021-02-03 18:40:03 +01:00
</form>
{% endif %}
</dd>
{% if package.provides %}
<dt>Provides</dt>
<dd>{% for meta in package.provides %}
<a class="badge badge-secondary"
href="{{ url_for('metapackages.view', name=meta.name) }}">{{ meta.name }}</a>
{% endfor %}</dd>
{% endif %}
</dl>
{% if package.author.donate_url %}
<a class="btn btn-secondary btn-block my-4" href="{{ package.author.donate_url }}" rel="nofollow">
Like {{ package.author.display_name }}'s work? Donate now!
</a>
{% endif %}
<h3>
2020-01-21 23:40:51 +01:00
{% if package.checkPerm(current_user, "MAKE_RELEASE") %}
2021-07-24 05:30:14 +02:00
<a class="btn btn-primary btn-sm float-right" href="{{ package.getURL("packages.create_release") }}"><i class="fas fa-plus"></i></a>
2020-01-21 23:40:51 +01:00
{% endif %}
2021-07-24 04:56:43 +02:00
{{ _("Releases") }}
2021-02-03 18:40:03 +01:00
</h3>
2021-07-24 04:56:43 +02:00
<div class="list-group">
{% from "macros/releases.html" import render_releases, render_releases_download %}
{% if package.checkPerm(current_user, "MAKE_RELEASE") %}
{{ render_releases(releases, package, current_user) }}
{% else %}
{{ render_releases_download(releases, package, current_user) }}
2021-07-24 04:56:43 +02:00
{% endif %}
2021-07-24 05:30:14 +02:00
<a class="list-group-item list-group-item-action text-center py-1 text-muted" href="{{ package.getURL("packages.list_releases") }}">
2021-07-24 04:56:43 +02:00
More
</a>
</div>
2021-05-04 22:52:43 +02:00
2021-02-03 18:40:03 +01:00
<h3>
2020-01-21 23:40:51 +01:00
{% if package.approved and package.checkPerm(current_user, "CREATE_THREAD") %}
<div class="btn-group float-right">
<a class="btn btn-primary btn-sm mx-1" href="{{ url_for('threads.new', pid=package.id) }}"><i class="fas fa-plus"></i></a>
</div>
{% endif %}
Threads
2021-02-03 18:40:03 +01:00
</h3>
<div class="list-group">
2020-12-22 13:22:52 +01:00
{% from "macros/threads.html" import render_compact_threadlist %}
{{ render_compact_threadlist(threads) }}
2021-02-03 18:40:03 +01:00
</div>
2019-01-28 20:41:24 +01:00
2021-02-03 18:40:03 +01:00
<p class="mt-3">
{% if package.approved and current_user != package.author %}
<a class="float-right"
href="{{ url_for('threads.new', pid=package.id) }}">
Report a problem with this listing
2018-12-21 16:58:43 +01:00
</a>
2021-02-03 18:40:03 +01:00
{% endif %}
2021-08-16 19:57:05 +02:00
{% if package.checkPerm(current_user, "EDIT_PACKAGE") or package.checkPerm(current_user, "APPROVE_NEW") %}
2021-07-24 05:30:14 +02:00
<a class="float-right" href="{{ package.getURL("packages.audit") }}">
2021-02-03 18:40:03 +01:00
See audit log
</a>
2021-02-03 18:40:03 +01:00
{% endif %}
2020-07-10 20:12:08 +02:00
</p>
2021-02-03 18:40:03 +01:00
</aside>
</div>
</section>
</main>
2018-03-19 19:08:41 +01:00
{% endblock %}