Skip to content

Commit

Permalink
fix create event button on empty event list
Browse files Browse the repository at this point in the history
  • Loading branch information
felixrindt committed Jul 30, 2024
1 parent f6aeda9 commit 60b73a5
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 51 deletions.
30 changes: 6 additions & 24 deletions ephios/core/templates/core/event_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -80,24 +80,8 @@ <h1>{% translate "Events" %}
</form>
{% if mode == "calendar" or mode == "day" %}
{% if perms.core.add_event %}
<div class="dropdown">
<button class="btn btn-primary btn-sm dropdown-toggle d-none d-md-inline-block" type="button"
id="eventCreateButton"
data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="fa fa-plus"></span>
{% translate "Add event" %}
</button>
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="eventCreateButton">
{% for eventtype in eventtypes %}
<a class="dropdown-item" href="{% url "core:event_create" eventtype.pk %}">
{% blocktranslate trimmed with title=eventtype.title %}
Add {{ title }}
{% endblocktranslate %}</a>
{% endfor %}
</div>
</div>
{% include "core/fragments/event_list_add_event_button.html" %}
{% endif %}

<div class="d-flex justify-content-between mt-2">
<a class="btn btn-secondary"
href="?{% param_replace date=previous_date|date:"Y-m-d" %}"
Expand Down Expand Up @@ -128,21 +112,19 @@ <h3 class="mx-3">
<i class="fas fa-arrow-right"></i></a>
</div>
{% endif %}


</div>

{% if mode == "calendar" %}
{{ calendar }}
{% if mode == "list" %}
{% include "core/fragments/event_list_list_mode.html" %}
{% elif not event_list %}
<div class="mb-3">
<h5 class="mt-5 text-center">
{% translate "No results." %}
{% translate "No results" %}
</h5>
</div>
{% elif mode == "calendar" %}
{{ calendar }}
{% elif mode == "day" %}
{% include "core/fragments/event_list_day_mode.html" %}
{% else %}
{% include "core/fragments/event_list_list_mode.html" %}
{% endif %}
{% endblock %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{% load i18n %}
<div class="dropdown m-1 ms-0">
<button class="btn btn-primary btn-sm dropdown-toggle d-none d-md-inline-block" type="button"
id="eventCreateButton"
data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="fa fa-plus"></span>
{% translate "Add event" %}
</button>
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="eventCreateButton">
{% for eventtype in eventtypes %}
<a class="dropdown-item" href="{% url "core:event_create" eventtype.pk %}">
{% blocktranslate trimmed with title=eventtype.title %}
Add {{ title }}
{% endblocktranslate %}</a>
{% endfor %}
</div>
</div>
32 changes: 8 additions & 24 deletions ephios/core/templates/core/fragments/event_list_list_mode.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,7 @@
{% csrf_token %}
{% if perms.core.add_event %}
<div id="event-controls" class="d-flex flex-wrap pb-3">
<div class="dropdown m-1 ms-0">
<button class="btn btn-primary btn-sm dropdown-toggle" type="button" id="eventCreateButton"
data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="fa fa-plus"></span>
{% translate "Add event" %}
</button>
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="eventCreateButton">
{% for eventtype in eventtypes %}
<a class="dropdown-item" href="{% url "core:event_create" eventtype.pk %}">
{% blocktranslate trimmed with title=eventtype.title %}
Add {{ title }}
{% endblocktranslate %}</a>
{% endfor %}
</div>
</div>
{% include "core/fragments/event_list_add_event_button.html" %}
<div class="bulk-actions">
<button class="btn btn-secondary btn-sm m-1 ms-0" type="submit" name="delete"
formaction="{% url "core:event_bulk_delete" %}"><span
Expand All @@ -31,7 +17,7 @@
{% endif %}

<ul class="list-group mb-3">
{% if perms.core.add_event %}
{% if event_list and perms.core.add_event %}
<li class="list-group-item px-0">
<div class="ps-2">
<input type="checkbox" id="checkall">
Expand All @@ -47,14 +33,6 @@
data-bs-toggle="tooltip" data-bs-placement="bottom" data-bs-html="true"
title="{% for state in counter %}<div>
{% if event.shifts.all|length > 1 %}{{ counter|get:state }} {% endif %}{{ ParticipationStates.labels_dict|get:state }}</div>{% endfor %}"
{% endif %}>
{% if counter|get:ParticipationStates.CONFIRMED > 0 %}
Expand Down Expand Up @@ -126,6 +104,12 @@ <h5 class="mb-0 text-break">
</a>
</li>
{% endwith %}
{% empty %}
<div class="mb-3">
<h5 class="mt-5 text-center">
{% translate "No results" %}
</h5>
</div>
{% endfor %}
</ul>
{% include 'core/pagination.html' %}
Expand Down
4 changes: 2 additions & 2 deletions ephios/locale/de/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -1908,8 +1908,8 @@ msgstr "%(title)s hinzufügen"

#: ephios/core/templates/core/event_list.html:140
#: ephios/plugins/federation/templates/federation/external_event_list.html:67
msgid "No results."
msgstr "Keine Ergebnisse."
msgid "No results"
msgstr "Keine Ergebnisse"

#: ephios/core/templates/core/event_notification.html:7
#: ephios/core/templates/core/event_notification.html:16
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ <h5 class="mb-0 text-break d-inline-block">
{% empty %}
<div class="mb-3">
<h5 class="mt-5 text-center">
{% translate "No results." %}
{% translate "No results" %}
</h5>
</div>
{% endfor %}
Expand Down

0 comments on commit 60b73a5

Please sign in to comment.