Add game jam ad

This commit is contained in:
rubenwardy 2021-11-23 00:58:53 +00:00
parent e5ae41901c
commit 20c93925a8
2 changed files with 50 additions and 24 deletions

View File

@ -6,6 +6,24 @@ from app.models import *
import flask_menu as menu
from sqlalchemy.orm import joinedload
from sqlalchemy.sql.expression import func
from flask_login import current_user
class GameJam:
cover_image = type("", (), dict(url="/static/gamejam.png"))()
tags = []
def getURL(self, _name):
return "https://forum.minetest.net/viewtopic.php?t=27512"
title = "Minetest Game Jam 2021"
author = None
short_desc = "We're holding a 3-week Game Jam starting December 1st! Sharpen your gamedev skills with a chance for a cash prize."
type = type("", (), dict(value="Competition"))()
content_warnings = []
reviews = []
@bp.route("/")
@menu.register_menu(bp, ".", "Home")
@ -19,6 +37,8 @@ def home():
count = query.count()
featured = query.filter(Package.tags.any(name="featured")).order_by(func.random()).limit(6).all()
if current_user.is_authenticated:
featured.insert(0, GameJam())
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()

View File

@ -39,37 +39,43 @@
</div>
<div class="carousel-caption text-shadow">
<h3 class="mt-0 mb-3">
{{ _('<strong>%(title)s</strong> by %(author)s', title=package.title, author=package.author.display_name) }}
{% if package.author %}
{{ _('<strong>%(title)s</strong> by %(author)s', title=package.title, author=package.author.display_name) }}
{% else %}
<strong>{{ package.title }}</strong>
{% endif %}
</h3>
<p>
{{ package.short_desc }}
</p>
<div class="d-none d-md-block">
<span class="mr-2">
{{ package.type.value }}
</span>
{% for warning in package.content_warnings %}
<span class="badge badge-warning" title="{{ warning.description }}">
<i class="fas fa-exclamation-circle" style="margin-right: 0.3em;"></i>
{{ warning.title }}
{% if package.author %}
<div class="d-none d-md-block">
<span class="mr-2">
{{ package.type.value }}
</span>
{% endfor %}
{% for t in tags[:3] %}
{% if t.name != "featured" %}
<span class="badge badge-primary" title="{{ t.description or '' }}">
{{ t.title }}
{% for warning in package.content_warnings %}
<span class="badge badge-warning" title="{{ warning.description }}">
<i class="fas fa-exclamation-circle" style="margin-right: 0.3em;"></i>
{{ warning.title }}
</span>
{% endfor %}
{% for t in tags[:3] %}
{% if t.name != "featured" %}
<span class="badge badge-primary" title="{{ t.description or '' }}">
{{ t.title }}
</span>
{% endif %}
{% endfor %}
<span class="btn" 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>
{% endif %}
{% endfor %}
<span class="btn" 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>
</span>
</div>
</div>
{% endif %}
</div>
</a>
</div>