</div>
</section>
- {% else %}
+ {% elif current_user and current_user.is_staff() %}
{# Recently Joined #}
{% set recently_registered = backend.accounts.get_recently_registered(limit=4) %}
</section>
{% end %}
- {% if current_user and current_user.is_staff() %}
- {% set total_accounts = len(backend.accounts) %}
- {% set countries = backend.accounts.countries %}
+ {% set total_accounts = len(backend.accounts) %}
+ {% set countries = backend.accounts.countries %}
- {# Stats #}
+ {# Stats #}
- <section class="section">
- <div class="container">
- <div class="level">
- <div class="level-item has-text-centered">
- <div>
- <p class="heading">{{ _("Total Accounts") }}</p>
- <p class="title">
- {{ total_accounts }}
- </p>
- </div>
+ <section class="section">
+ <div class="container">
+ <div class="level">
+ <div class="level-item has-text-centered">
+ <div>
+ <p class="heading">{{ _("Total Accounts") }}</p>
+ <p class="title">
+ {{ total_accounts }}
+ </p>
</div>
+ </div>
- {% set t = now - datetime.timedelta(days=7) %}
+ {% set t = now - datetime.timedelta(days=7) %}
- <div class="level-item has-text-centered">
- <div>
- <p class="heading">{{ _("Created This Week") }}</p>
- <p class="title">
- {{ backend.accounts.count_created_after(t) }}
- </p>
- </div>
+ <div class="level-item has-text-centered">
+ <div>
+ <p class="heading">{{ _("Created This Week") }}</p>
+ <p class="title">
+ {{ backend.accounts.count_created_after(t) }}
+ </p>
</div>
+ </div>
- {% set t = now - datetime.timedelta(days=30) %}
+ {% set t = now - datetime.timedelta(days=30) %}
+ <div class="level-item has-text-centered">
+ <div>
+ <p class="heading">{{ _("Created This Month") }}</p>
+ <p class="title">
+ {{ backend.accounts.count_created_after(t) }}
+ </p>
+ </div>
+ </div>
+
+ {% set pending_registrations = backend.accounts.pending_registrations %}
+ {% if pending_registrations %}
<div class="level-item has-text-centered">
<div>
- <p class="heading">{{ _("Created This Month") }}</p>
+ <p class="heading">{{ _("Pending Registrations") }}</p>
<p class="title">
- {{ backend.accounts.count_created_after(t) }}
+ {{ pending_registrations }}
</p>
</div>
</div>
-
- {% set pending_registrations = backend.accounts.pending_registrations %}
- {% if pending_registrations %}
- <div class="level-item has-text-centered">
- <div>
- <p class="heading">{{ _("Pending Registrations") }}</p>
- <p class="title">
- {{ pending_registrations }}
- </p>
- </div>
- </div>
- {% end %}
- </div>
+ {% end %}
</div>
- </section>
-
- {# Countries #}
+ </div>
+ </section>
- <section class="section">
- <div class="container">
- <h4 class="title is-4">{{ _("Origin") }}</h4>
+ {# Countries #}
- <nav class="panel">
- {% for country in sorted(countries, key=lambda c: countries[c], reverse=True) %}
- {% set percentage = countries[country] / total_accounts %}
+ <section class="section">
+ <div class="container">
+ <h4 class="title is-4">{{ _("Origin") }}</h4>
- <div class="panel-block is-justify-content-space-between">
- <span>
- <span class="panel-icon">
- <i class="flag-icon flag-icon-{{ country.alpha2.lower() }}"
- aria-hidden="true"></i>
- </span>
+ <nav class="panel">
+ {% for country in sorted(countries, key=lambda c: countries[c], reverse=True) %}
+ {% set percentage = countries[country] / total_accounts %}
- {{ country.apolitical_name }}
+ <div class="panel-block is-justify-content-space-between">
+ <span>
+ <span class="panel-icon">
+ <i class="flag-icon flag-icon-{{ country.alpha2.lower() }}"
+ aria-hidden="true"></i>
</span>
- <span class="tag">
- {{ "%.1f%%" % (percentage * 100) }}
- </span>
- </div>
- {% end %}
- </div>
+ {{ country.apolitical_name }}
+ </span>
+
+ <span class="tag">
+ {{ "%.1f%%" % (percentage * 100) }}
+ </span>
+ </div>
+ {% end %}
</div>
- </section>
- {% end %}
+ </div>
+ </section>
{% end %}
{% end block %}