mirror of
https://github.com/minetest/contentdb.git
synced 2025-01-08 22:17:34 +01:00
Fix broken package icons
This commit is contained in:
parent
ef9860b6cc
commit
f1edfcebc0
@ -444,6 +444,9 @@ class Package(db.Model):
|
||||
"downloads": self.downloads
|
||||
}
|
||||
|
||||
def getThumbnailOrPlaceholder(self, level=2):
|
||||
return self.getThumbnailURL(level) or "/static/placeholder.png"
|
||||
|
||||
def getThumbnailURL(self, level=2):
|
||||
screenshot = self.screenshots.filter_by(approved=True).order_by(db.asc(PackageScreenshot.id)).first()
|
||||
return screenshot.getThumbnailURL(level) if screenshot is not None else None
|
||||
|
@ -50,7 +50,7 @@
|
||||
<img
|
||||
class="img-fluid"
|
||||
style="max-height: 22px; max-width: 22px;"
|
||||
src="{{ entry.package.getThumbnailURL(1) }}" />
|
||||
src="{{ entry.package.getThumbnailOrPlaceholder() }}" />
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
{% macro render_pkgtile(package, show_author) -%}
|
||||
<li class="packagetile flex-fill"><a href="{{ package.getDetailsURL() }}"
|
||||
style="background-image: url({{ package.getThumbnailURL() or '/static/placeholder.png' }});">
|
||||
style="background-image: url({{ package.getThumbnailOrPlaceholder(2) }});">
|
||||
<div class="packagegridscrub"></div>
|
||||
<div class="packagegridinfo">
|
||||
<h3>
|
||||
|
@ -186,7 +186,7 @@
|
||||
<img
|
||||
class="img-fluid"
|
||||
style="max-height: 22px; max-width: 22px;"
|
||||
src="{{ t.package.getThumbnailURL(1) }}" /><br />
|
||||
src="{{ t.package.getThumbnailOrPlaceholder() }}" /><br />
|
||||
|
||||
<span class="pl-2">
|
||||
{{ t.package.title }}
|
||||
|
@ -8,7 +8,7 @@
|
||||
<img
|
||||
class="img-fluid"
|
||||
style="max-height: 22px; max-width: 22px;"
|
||||
src="{{ package.getThumbnailURL(1) }}" />
|
||||
src="{{ package.getThumbnailOrPlaceholder() }}" />
|
||||
|
||||
<span class="pl-2">
|
||||
{{ package.title }}
|
||||
|
@ -37,7 +37,7 @@ Notifications
|
||||
<img
|
||||
class="img-fluid"
|
||||
style="max-height: 22px; max-width: 22px;"
|
||||
src="{{ n.package.getThumbnailURL(1) }}" />
|
||||
src="{{ n.package.getThumbnailOrPlaceholder() }}" />
|
||||
|
||||
<span class="pl-2">
|
||||
{{ n.package.title }}
|
||||
@ -75,7 +75,7 @@ Notifications
|
||||
<img
|
||||
class="img-fluid"
|
||||
style="max-height: 22px; max-width: 22px;"
|
||||
src="{{ n.package.getThumbnailURL(1) }}" />
|
||||
src="{{ n.package.getThumbnailOrPlaceholder() }}" />
|
||||
|
||||
<span class="pl-2">
|
||||
{{ n.package.title }}
|
||||
|
@ -18,7 +18,7 @@
|
||||
<ul class="card-body d-flex p-0 flex-row flex-wrap justify-content-start align-content-start p-4">
|
||||
{% for s in screenshots %}
|
||||
<li class="packagetile flex-fill"><a href="{{ s.getEditURL() }}"
|
||||
style="background-image: url({{ s.getThumbnailURL(3) or '/static/placeholder.png' }});">
|
||||
style="background-image: url({{ s.getThumbnailOrPlaceholder(3) }});">
|
||||
<div class="packagegridscrub"></div>
|
||||
<div class="packagegridinfo">
|
||||
<h3>
|
||||
|
@ -15,7 +15,7 @@
|
||||
<img
|
||||
class="img-fluid"
|
||||
style="max-height: 22px; max-width: 22px;"
|
||||
src="{{ package.getThumbnailURL(1) }}" />
|
||||
src="{{ package.getThumbnailOrPlaceholder() }}" />
|
||||
|
||||
<span class="pl-2">
|
||||
{{ package.title }}
|
||||
|
Loading…
Reference in New Issue
Block a user