diff --git a/app/models/packages.py b/app/models/packages.py
index 2421f5a3..c6e40726 100644
--- a/app/models/packages.py
+++ b/app/models/packages.py
@@ -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
diff --git a/app/templates/macros/audit_log.html b/app/templates/macros/audit_log.html
index 6e895758..77008161 100644
--- a/app/templates/macros/audit_log.html
+++ b/app/templates/macros/audit_log.html
@@ -50,7 +50,7 @@
+ src="{{ entry.package.getThumbnailOrPlaceholder() }}" />
{% endif %}
diff --git a/app/templates/macros/packagegridtile.html b/app/templates/macros/packagegridtile.html
index 3f9d3643..725f8ccb 100644
--- a/app/templates/macros/packagegridtile.html
+++ b/app/templates/macros/packagegridtile.html
@@ -1,6 +1,6 @@
{% macro render_pkgtile(package, show_author) -%}
+ style="background-image: url({{ package.getThumbnailOrPlaceholder(2) }});">
diff --git a/app/templates/macros/threads.html b/app/templates/macros/threads.html
index 70d63cf9..08e09712 100644
--- a/app/templates/macros/threads.html
+++ b/app/templates/macros/threads.html
@@ -186,7 +186,7 @@
+ src="{{ t.package.getThumbnailOrPlaceholder() }}" />
{{ t.package.title }}
diff --git a/app/templates/macros/todo.html b/app/templates/macros/todo.html
index 8e432bd4..02676d9c 100644
--- a/app/templates/macros/todo.html
+++ b/app/templates/macros/todo.html
@@ -8,7 +8,7 @@
+ src="{{ package.getThumbnailOrPlaceholder() }}" />
{{ package.title }}
diff --git a/app/templates/notifications/list.html b/app/templates/notifications/list.html
index d2f54901..38c3b9b8 100644
--- a/app/templates/notifications/list.html
+++ b/app/templates/notifications/list.html
@@ -37,7 +37,7 @@ Notifications
+ src="{{ n.package.getThumbnailOrPlaceholder() }}" />
{{ n.package.title }}
@@ -75,7 +75,7 @@ Notifications
+ src="{{ n.package.getThumbnailOrPlaceholder() }}" />
{{ n.package.title }}
diff --git a/app/templates/todo/editor.html b/app/templates/todo/editor.html
index 18872801..5924c5e7 100644
--- a/app/templates/todo/editor.html
+++ b/app/templates/todo/editor.html
@@ -18,7 +18,7 @@