mirror of
https://gitlab.crans.org/bde/nk20
synced 2024-11-27 02:43:01 +00:00
[activity] Fix button shortcut to entries page
Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
This commit is contained in:
parent
f29054558a
commit
69b3d2ac9c
@ -10,21 +10,25 @@ SPDX-License-Identifier: GPL-2.0-or-later
|
|||||||
{# bandeau transfert/crédit/débit/activité #}
|
{# bandeau transfert/crédit/débit/activité #}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-xl-12">
|
<div class="col-xl-12">
|
||||||
<div class="btn-group btn-group-toggle btn-block" data-toggle="buttons">
|
<div class="btn-group btn-block">
|
||||||
<label for="type_transfer" class="btn btn-sm btn-outline-primary active">
|
<div class="btn-group btn-group-toggle btn-block" data-toggle="buttons">
|
||||||
<input type="radio" name="transaction_type" id="type_transfer">
|
<label for="type_transfer" class="btn btn-sm btn-outline-primary active">
|
||||||
{% trans "Transfer" %}
|
<input type="radio" name="transaction_type" id="type_transfer">
|
||||||
</label>
|
{% trans "Transfer" %}
|
||||||
{% if "note.notespecial"|not_empty_model_list %}
|
|
||||||
<label for="type_credit" class="btn btn-sm btn-outline-primary">
|
|
||||||
<input type="radio" name="transaction_type" id="type_credit">
|
|
||||||
{% trans "Credit" %}
|
|
||||||
</label>
|
</label>
|
||||||
<label for="type_debit" class="btn btn-sm btn-outline-primary">
|
{% if "note.notespecial"|not_empty_model_list %}
|
||||||
<input type="radio" name="transaction_type" id="type_debit">
|
<label for="type_credit" class="btn btn-sm btn-outline-primary">
|
||||||
{% trans "Debit" %}
|
<input type="radio" name="transaction_type" id="type_credit">
|
||||||
</label>
|
{% trans "Credit" %}
|
||||||
{% endif %}
|
</label>
|
||||||
|
<label for="type_debit" class="btn btn-sm btn-outline-primary">
|
||||||
|
<input type="radio" name="transaction_type" id="type_debit">
|
||||||
|
{% trans "Debit" %}
|
||||||
|
</label>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{# Add shortcuts for opened activites if necessary #}
|
||||||
{% for activity in activities_open %}
|
{% for activity in activities_open %}
|
||||||
<a href="{% url "activity:activity_entry" pk=activity.pk %}" class="btn btn-sm btn-outline-primary">
|
<a href="{% url "activity:activity_entry" pk=activity.pk %}" class="btn btn-sm btn-outline-primary">
|
||||||
{% trans "Entries" %} {{ activity.name }}
|
{% trans "Entries" %} {{ activity.name }}
|
||||||
|
@ -53,7 +53,7 @@ class TransactionCreateView(ProtectQuerysetMixin, LoginRequiredMixin, SingleTabl
|
|||||||
# Add a shortcut for entry page for open activities
|
# Add a shortcut for entry page for open activities
|
||||||
if "activity" in settings.INSTALLED_APPS:
|
if "activity" in settings.INSTALLED_APPS:
|
||||||
from activity.models import Activity
|
from activity.models import Activity
|
||||||
activities_open = Activity.objects.filter(open=True).filter(
|
activities_open = Activity.objects.filter(open=True, activity_type__manage_entries=True).filter(
|
||||||
PermissionBackend.filter_queryset(self.request, Activity, "view")).distinct().all()
|
PermissionBackend.filter_queryset(self.request, Activity, "view")).distinct().all()
|
||||||
context["activities_open"] = [a for a in activities_open
|
context["activities_open"] = [a for a in activities_open
|
||||||
if PermissionBackend.check_perm(self.request,
|
if PermissionBackend.check_perm(self.request,
|
||||||
|
Loading…
Reference in New Issue
Block a user