mirror of
https://github.com/minetest/contentdb.git
synced 2025-01-09 14:37:36 +01:00
Enable game support for texture packs
This commit is contained in:
parent
605015f812
commit
42b9986fc8
@ -38,7 +38,6 @@ def game_hub(package: Package):
|
|||||||
|
|
||||||
new = join(query.order_by(db.desc(Package.approved_at))).limit(4).all()
|
new = join(query.order_by(db.desc(Package.approved_at))).limit(4).all()
|
||||||
pop_mod = join(query.filter_by(type=PackageType.MOD).order_by(db.desc(Package.score))).limit(8).all()
|
pop_mod = join(query.filter_by(type=PackageType.MOD).order_by(db.desc(Package.score))).limit(8).all()
|
||||||
pop_gam = join(query.filter_by(type=PackageType.GAME).order_by(db.desc(Package.score))).limit(8).all()
|
|
||||||
pop_txp = join(query.filter_by(type=PackageType.TXP).order_by(db.desc(Package.score))).limit(8).all()
|
pop_txp = join(query.filter_by(type=PackageType.TXP).order_by(db.desc(Package.score))).limit(8).all()
|
||||||
high_reviewed = join(query.order_by(db.desc(Package.score - Package.score_downloads))) \
|
high_reviewed = join(query.order_by(db.desc(Package.score - Package.score_downloads))) \
|
||||||
.filter(Package.reviews.any()).limit(4).all()
|
.filter(Package.reviews.any()).limit(4).all()
|
||||||
@ -50,5 +49,5 @@ def game_hub(package: Package):
|
|||||||
updated = updated[:4]
|
updated = updated[:4]
|
||||||
|
|
||||||
return render_template("packages/game_hub.html", package=package, count=count,
|
return render_template("packages/game_hub.html", package=package, count=count,
|
||||||
new=new, updated=updated, pop_mod=pop_mod, pop_txp=pop_txp, pop_gam=pop_gam,
|
new=new, updated=updated, pop_mod=pop_mod, pop_txp=pop_txp,
|
||||||
high_reviewed=high_reviewed)
|
high_reviewed=high_reviewed)
|
||||||
|
@ -648,7 +648,7 @@ class GameSupportForm(FlaskForm):
|
|||||||
@login_required
|
@login_required
|
||||||
@is_package_page
|
@is_package_page
|
||||||
def game_support(package):
|
def game_support(package):
|
||||||
if package.type != PackageType.MOD:
|
if package.type != PackageType.MOD and package.type != PackageType.TXP:
|
||||||
abort(404)
|
abort(404)
|
||||||
|
|
||||||
can_edit = package.checkPerm(current_user, Permission.EDIT_PACKAGE)
|
can_edit = package.checkPerm(current_user, Permission.EDIT_PACKAGE)
|
||||||
|
@ -145,7 +145,7 @@ def postReleaseCheckUpdate(self, release: PackageRelease, path):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
# Update game support
|
# Update game support
|
||||||
if package.type == PackageType.MOD:
|
if package.type == PackageType.MOD or package.type == PackageType.TXP:
|
||||||
try:
|
try:
|
||||||
resolver = GameSupportResolver(db.session)
|
resolver = GameSupportResolver(db.session)
|
||||||
|
|
||||||
@ -158,7 +158,8 @@ def postReleaseCheckUpdate(self, release: PackageRelease, path):
|
|||||||
game_is_supported[game.id] = False
|
game_is_supported[game.id] = False
|
||||||
|
|
||||||
resolver.set_supported(package, game_is_supported, 10)
|
resolver.set_supported(package, game_is_supported, 10)
|
||||||
resolver.update(package)
|
if package.type == PackageType.MOD:
|
||||||
|
resolver.update(package)
|
||||||
except LogicError as e:
|
except LogicError as e:
|
||||||
raise TaskError(e.message)
|
raise TaskError(e.message)
|
||||||
|
|
||||||
|
@ -48,6 +48,13 @@
|
|||||||
{{ render_pkggrid(pop_mod) }}
|
{{ render_pkggrid(pop_mod) }}
|
||||||
|
|
||||||
|
|
||||||
|
<a href="{{ url_for('packages.list_all', type='txp', sort='score', order='desc', game=package.getId()) }}" class="btn btn-secondary float-right">
|
||||||
|
{{ _("See more") }}
|
||||||
|
</a>
|
||||||
|
<h2 class="my-3">{{ _("Top Texture Packs") }}</h2>
|
||||||
|
{{ render_pkggrid(pop_txp) }}
|
||||||
|
|
||||||
|
|
||||||
<a href="{{ url_for('packages.list_all', sort='reviews', order='desc', game=package.getId()) }}" class="btn btn-secondary float-right">
|
<a href="{{ url_for('packages.list_all', sort='reviews', order='desc', game=package.getId()) }}" class="btn btn-secondary float-right">
|
||||||
{{ _("See more") }}
|
{{ _("See more") }}
|
||||||
</a>
|
</a>
|
||||||
|
@ -442,31 +442,45 @@
|
|||||||
</dl>
|
</dl>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if package.type == package.type.MOD %}
|
{% if package.type == package.type.MOD or package.type == package.type.TXP %}
|
||||||
<h3>
|
{% set supported_games = package.getSortedSupportedGames() %}
|
||||||
{% if package.checkPerm(current_user, "EDIT_PACKAGE") %}
|
{% if supported_games or package.type == package.type.MOD %}
|
||||||
<a href="{{ package.getURL('packages.game_support') }}" class="btn btn-secondary btn-sm float-right">
|
<h3>
|
||||||
<i class="fas fa-pen"></i>
|
{% if package.checkPerm(current_user, "EDIT_PACKAGE") %}
|
||||||
</a>
|
<a href="{{ package.getURL('packages.game_support') }}" class="btn btn-secondary btn-sm float-right">
|
||||||
{% endif %}
|
<i class="fas fa-pen"></i>
|
||||||
{{ _("Compatible Games") }}
|
</a>
|
||||||
</h3>
|
{% endif %}
|
||||||
<div style="max-height: 300px; overflow: hidden auto;">
|
{{ _("Compatible Games") }}
|
||||||
{% for support in package.getSortedSupportedGames() %}
|
</h3>
|
||||||
<a class="badge badge-secondary"
|
<div style="max-height: 300px; overflow: hidden auto;">
|
||||||
href="{{ support.game.getURL('packages.view') }}">
|
{% for support in supported_games %}
|
||||||
{{ _("%(title)s by %(display_name)s",
|
<a class="badge badge-secondary"
|
||||||
title=support.game.title, display_name=support.game.author.display_name) }}
|
href="{{ support.game.getURL('packages.view') }}">
|
||||||
</a>
|
{{ _("%(title)s by %(display_name)s",
|
||||||
{% else %}
|
title=support.game.title, display_name=support.game.author.display_name) }}
|
||||||
{{ _("No specific game is required") }}
|
</a>
|
||||||
{% endfor %}
|
{% else %}
|
||||||
</div>
|
{{ _("No specific game is required") }}
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
|
||||||
<p class="text-muted small mt-2 mb-0">
|
{% if package.type == package.type.MOD %}
|
||||||
{{ _("This is an experimental feature.") }}
|
<p class="text-muted small mt-2 mb-0">
|
||||||
{{ _("Supported games are determined by an algorithm, and may not be correct.") }}
|
{{ _("This is an experimental feature.") }}
|
||||||
</p>
|
{{ _("Supported games are determined by an algorithm, and may not be correct.") }}
|
||||||
|
</p>
|
||||||
|
{% endif %}
|
||||||
|
{% elif package.checkPerm(current_user, "EDIT_PACKAGE") %}
|
||||||
|
<p class="alert alert-warning">
|
||||||
|
{% if package.checkPerm(current_user, "EDIT_PACKAGE") %}
|
||||||
|
<a href="{{ package.getURL('packages.game_support') }}" class="btn btn-warning btn-sm float-right">
|
||||||
|
<i class="fas fa-pen"></i>
|
||||||
|
</a>
|
||||||
|
{% endif %}
|
||||||
|
{{ _("Please specify compatible games") }}
|
||||||
|
</p>
|
||||||
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<h3>
|
<h3>
|
||||||
|
Loading…
Reference in New Issue
Block a user