Skip to content

Commit

Permalink
show emoji awards on dojos
Browse files Browse the repository at this point in the history
  • Loading branch information
zardus committed Jan 22, 2024
1 parent 5f03383 commit d6f746e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
3 changes: 2 additions & 1 deletion dojo_theme/templates/dojos.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ <h2>{{ type | title }}</h2>
{{ card(url_for("pwncollege_dojos.view_dojo", dojo=dojo.reference_id),
title=dojo.name,
text="{} Modules : ".format(dojo.modules | length) + "{} / {}".format(dojo.solves(user=user, ignore_visibility=True, ignore_admins=False).count() if user else 0, dojo.challenges | length),
icon="/themes/dojo_theme/static/img/dojo/{}.svg".format(dojo.award.belt) if (dojo.award.belt and dojo.official) else None) }}
icon="/themes/dojo_theme/static/img/dojo/{}.svg".format(dojo.award.belt) if (dojo.award.belt and dojo.official) else None,
emoji=dojo.award.emoji ) }}
{% endfor %}

{% if type == "More" %}
Expand Down
7 changes: 5 additions & 2 deletions dojo_theme/templates/macros/widgets.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,16 @@
</li>
{% endmacro %}

{% macro card(url, title=None, text=None, icon=None, custom=False) -%}
{% macro card(url, title=None, text=None, icon=None, emoji=None, custom=False) -%}
<a class="text-decoration-none" href="{{ url }}">
<li class="card card-small">
<div class="card-body">
{% if title %}<h4 class="card-title">{{ title }}</h4>{% endif %}
{% if text %}<p class="card-text">{{ text }}</p>{% endif %}
{% if icon %}<img class="card-icon" src={{ icon }}>{% endif %}
<div class="card-icon">
{% if icon %}<img src={{ icon }}>{% endif %}
{% if emoji %}<big>{{ emoji }}</big>{% endif %}
</div>
{% if custom %}{{ caller() }}{% endif %}
</div>
</li>
Expand Down

0 comments on commit d6f746e

Please sign in to comment.