mirror of
https://github.com/ae-utbm/sith.git
synced 2025-10-09 08:14:39 +00:00
@@ -76,18 +76,20 @@
|
||||
It will stay hidden for other users until it has been published.
|
||||
{% endtrans %}
|
||||
</p>
|
||||
{% if user.has_perm("com.moderate_news") %}
|
||||
{%- if user.has_perm("com.moderate_news") -%}
|
||||
{# This is an additional query for each non-moderated news,
|
||||
but it will be executed only for admin users, and only one time
|
||||
(if they do their job and moderated news as soon as they see them),
|
||||
(if they do their job and moderate news as soon as they see them),
|
||||
so it's still reasonable #}
|
||||
<div
|
||||
{% if news is integer or news is string %}
|
||||
{% if news is integer or news is string -%}
|
||||
x-data="{ nbEvents: 0 }"
|
||||
x-init="nbEvents = await nbToPublish()"
|
||||
{% else %}
|
||||
{%- elif news.is_published -%}
|
||||
x-data="{ nbEvents: 0 }"
|
||||
{%- else -%}
|
||||
x-data="{ nbEvents: {{ news.dates.count() }} }"
|
||||
{% endif %}
|
||||
{%- endif -%}
|
||||
>
|
||||
<template x-if="nbEvents > 1">
|
||||
<div>
|
||||
|
@@ -77,22 +77,22 @@
|
||||
<div class="notification" x-data="{display: false}" :class="{white: display}">
|
||||
<a href="#" @click.prevent="display = !display">
|
||||
<i :class="`fa-${display ? 'solid': 'regular'} fa-bell`" x-transition></i>
|
||||
{% set notification_count = user.notifications.filter(viewed=False).count() %}
|
||||
{% set notifications = user.notifications.filter(viewed=False).order_by("-date")|list %}
|
||||
|
||||
{% if notification_count > 0 %}
|
||||
{%- if notifications|length > 0 -%}
|
||||
<span>
|
||||
{% if notification_count < 100 %}
|
||||
{{ notification_count }}
|
||||
{% else %}
|
||||
|
||||
{% endif %}
|
||||
{% if notifications|length < 100 %}
|
||||
{{ notifications|length }}
|
||||
{%- else -%}
|
||||
99+
|
||||
{%- endif -%}
|
||||
</span>
|
||||
{% endif %}
|
||||
</a>
|
||||
<div id="header_notif" x-show="display" x-cloak x-transition @click.outside="display = false">
|
||||
<ul>
|
||||
{% if user.notifications.filter(viewed=False).count() > 0 %}
|
||||
{% for n in user.notifications.filter(viewed=False).order_by('-date') %}
|
||||
{%- if notifications|length > 0 -%}
|
||||
{%- for n in notifications -%}
|
||||
<li>
|
||||
<a href="{{ url("core:notification", notif_id=n.id) }}">
|
||||
<div class="datetime">
|
||||
@@ -108,10 +108,10 @@
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
{%- endfor -%}
|
||||
{%- else -%}
|
||||
<li class="empty-notification">{% trans %}You do not have any unread notification{% endtrans %}</li>
|
||||
{% endif %}
|
||||
{%- endif -%}
|
||||
</ul>
|
||||
<div class="options">
|
||||
<a href="{{ url('core:notification_list') }}">
|
||||
|
@@ -1,23 +1,25 @@
|
||||
{% for js in statics.js %}
|
||||
<script-once type="module" src="{{ js }}"></script-once>
|
||||
{% endfor %}
|
||||
{% for css in statics.css %}
|
||||
<link-once rel="stylesheet" type="text/css" href="{{ css }}" defer></link-once>
|
||||
{% endfor %}
|
||||
|
||||
<{{ component }} name="{{ widget.name }}" {% include "django/forms/widgets/attrs.html" %}>
|
||||
{% for group_name, group_choices, group_index in widget.optgroups %}
|
||||
{% if group_name %}
|
||||
<optgroup label="{{ group_name }}">
|
||||
{% endif %}
|
||||
{% for widget in group_choices %}
|
||||
{% include widget.template_name %}
|
||||
{% spaceless %}
|
||||
{% for js in statics.js %}
|
||||
<script-once type="module" src="{{ js }}"></script-once>
|
||||
{% endfor %}
|
||||
{% if group_name %}
|
||||
</optgroup>
|
||||
{% for css in statics.css %}
|
||||
<link-once rel="stylesheet" type="text/css" href="{{ css }}" defer></link-once>
|
||||
{% endfor %}
|
||||
|
||||
<{{ component }} name="{{ widget.name }}" {% include "django/forms/widgets/attrs.html" %}>
|
||||
{% for group_name, group_choices, group_index in widget.optgroups %}
|
||||
{% if group_name %}
|
||||
<optgroup label="{{ group_name }}">
|
||||
{% endif %}
|
||||
{% for widget in group_choices %}
|
||||
{% include widget.template_name %}
|
||||
{% endfor %}
|
||||
{% if group_name %}
|
||||
</optgroup>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% if initial %}
|
||||
<slot style="display:none" name="initial">{{ initial }}</slot>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% if initial %}
|
||||
<slot style="display:none" name="initial">{{ initial }}</slot>
|
||||
{% endif %}
|
||||
</{{ component }}>
|
||||
</{{ component }}>
|
||||
{% endspaceless %}
|
@@ -67,13 +67,13 @@
|
||||
<option value="FIN">{% trans %}Confirm (FIN){% endtrans %}</option>
|
||||
<option value="ANN">{% trans %}Cancel (ANN){% endtrans %}</option>
|
||||
</optgroup>
|
||||
{% for category in categories.keys() %}
|
||||
{%- for category in categories.keys() -%}
|
||||
<optgroup label="{{ category }}">
|
||||
{% for product in categories[category] %}
|
||||
{%- for product in categories[category] -%}
|
||||
<option value="{{ product.id }}">{{ product }}</option>
|
||||
{% endfor %}
|
||||
{%- endfor -%}
|
||||
</optgroup>
|
||||
{% endfor %}
|
||||
{%- endfor -%}
|
||||
</counter-product-select>
|
||||
|
||||
<input type="submit" value="{% trans %}Go{% endtrans %}"/>
|
||||
|
Reference in New Issue
Block a user