47 lines
2.1 KiB
Django/Jinja
47 lines
2.1 KiB
Django/Jinja
{% macro dashboard_lexicon_item(lexicon) %}
|
|
{% set status = "completed" if lexicon.completed else "ongoing" if lexicon.started else "unstarted" %}
|
|
<div class="dashboard-lexicon-item dashboard-lexicon-{{ status }}">
|
|
<p>
|
|
<span class="dashboard-lexicon-item-title">
|
|
<a href="#{#{ url_for('lexicon.contents', name=lexicon.cfg.name) }#}">{{ lexicon.full_title }}</a>
|
|
</span>
|
|
[{{ status.capitalize() }}]
|
|
</p>
|
|
<p><i>{{ lexicon.prompt }}</i></p>
|
|
{% if current_user.is_authenticated %}
|
|
<p>
|
|
{#-
|
|
Show detailed player information if the current user is a member of the lexicon or if the current user is a site admin. The filter sequence must be converted to a list because it returns a generator, which is truthy.
|
|
-#}
|
|
{%-
|
|
if lexicon.memberships|map(attribute="user_id")|select("equalto", current_user.id)|list
|
|
or current_user.is_site_admin
|
|
-%}
|
|
Editor: {{
|
|
lexicon.memberships|selectattr("is_editor")|map(attribute="user")|map(attribute="username")|join(", ")
|
|
}} / Players: {{
|
|
lexicon.memberships|map(attribute="user")|map(attribute="username")|join(", ")
|
|
}} ({{ lexicon.memberships|count }}
|
|
{%- if lexicon.player_limit is not none -%}
|
|
/{{ lexicon.player_limit }}
|
|
{%- endif -%})
|
|
{%- else -%}
|
|
Players: {{ lexicon.memberships|count }}{% if lexicon.player_limit is not none %} / {{ lexicon.player_limit }}{% endif -%}
|
|
{%-
|
|
if lexicon.public and lexicon.joinable
|
|
%} / <a href="#{#{ url_for('lexicon.join', name=lexicon.cfg.name) }#}">Join game</a>
|
|
{%- endif -%}
|
|
{%- endif -%}
|
|
</p>
|
|
{% endif %}
|
|
</div>
|
|
{% endmacro %}
|
|
|
|
{% macro dashboard_user_item(user) %}
|
|
<div class="dashboard-lexicon-item">
|
|
<p>
|
|
<b>{{ user.username }}</b> {% if user.username != user.display_name %} / {{ user.display_name }}{% endif %} (id #{{user.id}}){% if user.is_site_admin %} <b>[ADMIN]</b>{% endif %}
|
|
</p>
|
|
<p>Last activity: {{ user.last_activity|date }} — Last login: {{ user.last_login|date }}</p>
|
|
</div>
|
|
{% endmacro %} |