From d5c3416bc320ff594a3267b11a305605f2292791 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?N=2EGeisler=20=26=20B=2E=20H=C3=A4ttasch?= <ak@kif.rocks> Date: Wed, 8 Jan 2020 22:22:28 +0100 Subject: [PATCH] hide edit links when event is not active --- .../locale/de_DE/LC_MESSAGES/django.po | 4 + .../templates/AKSubmission/ak_detail.html | 17 ++-- .../templates/AKSubmission/ak_list_table.html | 92 ++++++++++--------- .../AKSubmission/submission_overview.html | 67 +++++++------- 4 files changed, 99 insertions(+), 81 deletions(-) diff --git a/AKSubmission/locale/de_DE/LC_MESSAGES/django.po b/AKSubmission/locale/de_DE/LC_MESSAGES/django.po index dde61690..3e01784c 100644 --- a/AKSubmission/locale/de_DE/LC_MESSAGES/django.po +++ b/AKSubmission/locale/de_DE/LC_MESSAGES/django.po @@ -222,6 +222,10 @@ msgstr "Neuer AK" msgid "Edit Person Info" msgstr "Personen-Info bearbeiten" +#: templates/AKSubmission/submission_overview.html:62 +msgid "This event is not active. You cannot add or change AKs" +msgstr "Dieses Event is nicht aktiv. Es können keine AKs hinzugefügt oder bearbeitet werden" + #: templates/AKSubmission/submission_overview.html:53 msgid "Current AKs" msgstr "Aktuelle AKs" diff --git a/AKSubmission/templates/AKSubmission/ak_detail.html b/AKSubmission/templates/AKSubmission/ak_detail.html index f680603d..3dbe0cc5 100644 --- a/AKSubmission/templates/AKSubmission/ak_detail.html +++ b/AKSubmission/templates/AKSubmission/ak_detail.html @@ -21,9 +21,10 @@ {% if ak.link != "" %} <a href="{{ ak.link }}" class="btn btn-info">{% fontawesome_icon 'external-link-alt' %}</a> {% endif %} - <a href="{% url 'submit:ak_edit' event_slug=ak.event.slug pk=ak.pk %}" - class="btn btn-success">{% fontawesome_icon 'pencil-alt' %}</a> - </div> + {% if ak.event.active %} + <a href="{% url 'submit:ak_edit' event_slug=ak.event.slug pk=ak.pk %}" + class="btn btn-success">{% fontawesome_icon 'pencil-alt' %}</a> + {% endif %} </div> <h2>{% if ak.wish %}{% trans "AK Wish" %}: {% endif %}{{ ak.name }}</h2> @@ -88,9 +89,11 @@ </tbody> </table> - <div class=""> - <a href="{% url 'submit:akslot_add' event_slug=ak.event.slug pk=ak.pk %}" - class="btn btn-success">{% fontawesome_icon 'plus' %} {% trans "Add another slot" %}</a> - </div> + {% if ak.event.active %} + <div class=""> + <a href="{% url 'submit:akslot_add' event_slug=ak.event.slug pk=ak.pk %}" + class="btn btn-success">{% fontawesome_icon 'plus' %} {% trans "Add another slot" %}</a> + </div> + {% endif %} {% endblock %} diff --git a/AKSubmission/templates/AKSubmission/ak_list_table.html b/AKSubmission/templates/AKSubmission/ak_list_table.html index f9d405e8..ccf3558d 100644 --- a/AKSubmission/templates/AKSubmission/ak_list_table.html +++ b/AKSubmission/templates/AKSubmission/ak_list_table.html @@ -4,47 +4,53 @@ {% load tags_AKSubmission %} <table id="akTable" class="table table-striped"> - <thead> - <tr> - <th>{% trans "Name" %}</th> - <th>{% trans "Who?" %}</th> - <th>{% trans 'Category' %}</th> - <th>{% trans "Tags" %}</th> - <th></th> - </tr> - </thead> - <tbody> - {% for ak in AKs %} - <tr> - <td> - <b>{{ ak.name }}</b> - {% if ak.present %} - <span class="badge badge-dark badge-pill" title="{% trans 'present this AK' %}">{% fontawesome_icon "bullhorn" %}</span> - {% endif %} - {% if ak.reso %} - <span class="badge badge-dark badge-pill" title="{% trans 'Reso' %}">{% fontawesome_icon "scroll" %}</span> - {% endif %} - </td> - <td> - {% if ak.wish %} - <span class="badge badge-dark badge-pill">{% trans "AK Wish" %}</span> - {% else %} - {{ ak.owners_list }} - {% endif %} - </td> - <td>{% category_linked_badge ak.category event.slug %}</td> - <td>{% tag_list ak.tags.all event.slug %}</td> - <td class="text-right"> - <a href="{% url 'submit:ak_detail' event_slug=ak.event.slug pk=ak.pk %}" class="btn btn-primary">{% fontawesome_icon 'info' %}</a> - {% if ak.link %} - <a href="{{ ak.link }}" class="btn btn-info">{% fontawesome_icon 'external-link-alt' %}</a> - {% endif %} - <a href="{% url 'submit:ak_edit' event_slug=event.slug pk=ak.pk %}" class="btn btn-success">{% fontawesome_icon 'pencil-alt' %}</a> - </td> - </tr> - <tr> - <td colspan="5" class="small">{{ ak.description }}</td> - </tr> - {% endfor %} - </tbody> + <thead> + <tr> + <th>{% trans "Name" %}</th> + <th>{% trans "Who?" %}</th> + <th>{% trans 'Category' %}</th> + <th>{% trans "Tags" %}</th> + <th></th> + </tr> + </thead> + <tbody> + {% for ak in AKs %} + <tr> + <td> + <b>{{ ak.name }}</b> + {% if ak.present %} + <span class="badge badge-dark badge-pill" + title="{% trans 'present this AK' %}">{% fontawesome_icon "bullhorn" %}</span> + {% endif %} + {% if ak.reso %} + <span class="badge badge-dark badge-pill" + title="{% trans 'Reso' %}">{% fontawesome_icon "scroll" %}</span> + {% endif %} + </td> + <td> + {% if ak.wish %} + <span class="badge badge-dark badge-pill">{% trans "AK Wish" %}</span> + {% else %} + {{ ak.owners_list }} + {% endif %} + </td> + <td>{% category_linked_badge ak.category event.slug %}</td> + <td>{% tag_list ak.tags.all event.slug %}</td> + <td class="text-right"> + <a href="{% url 'submit:ak_detail' event_slug=ak.event.slug pk=ak.pk %}" + class="btn btn-primary">{% fontawesome_icon 'info' %}</a> + {% if ak.link %} + <a href="{{ ak.link }}" class="btn btn-info">{% fontawesome_icon 'external-link-alt' %}</a> + {% endif %} + {% if event.active %} + <a href="{% url 'submit:ak_edit' event_slug=event.slug pk=ak.pk %}" + class="btn btn-success">{% fontawesome_icon 'pencil-alt' %}</a> + {% endif %} + </td> + </tr> + <tr> + <td colspan="5" class="small">{{ ak.description }}</td> + </tr> + {% endfor %} + </tbody> </table> diff --git a/AKSubmission/templates/AKSubmission/submission_overview.html b/AKSubmission/templates/AKSubmission/submission_overview.html index 04426377..e8d350da 100644 --- a/AKSubmission/templates/AKSubmission/submission_overview.html +++ b/AKSubmission/templates/AKSubmission/submission_overview.html @@ -26,37 +26,42 @@ {% blocktrans %}On this page you can see a list of current AKs, change them and add new ones.{% endblocktrans %} - <div class="jumbotron" style="margin-top:20px;"> - <form method="POST" action="#" class="form-row"> - {% csrf_token %} - <a href="{% url 'submit:submit_ak_wish' event_slug=event.slug %}" class="btn btn-info"> - {% trans "New AK Wish" %} - </a> - <span style="font-size: 1.5em"> - | - <label for="selectOwnerId" class="align-middle d-inline">{% trans "Who" %}:</label> - </span> - <select name="owner_id" id="selectOwnerId" class=""> - <option value="-1">{% trans "I do not own AKs yet" %}</option> - {% for owner in existingOwners %} - <option value="{{ owner.pk }}">{{ owner }}</option> - {% endfor %} - </select> - <input - type="submit" - class="btn btn-primary" - value="{% trans "New AK" %}" - formaction="{% url 'submit:akowner_select' event_slug=event.slug %}" - /> - <input - type="submit" - class="btn btn-success" - value="{% trans 'Edit Person Info' %}" - formaction="{% url 'submit:akowner_edit_dispatch' event_slug=event.slug %}" - /> - </form> - </div> - + {% if event.active %} + <div class="jumbotron" style="margin-top:20px;"> + <form method="POST" action="#" class="form-row"> + {% csrf_token %} + <a href="{% url 'submit:submit_ak_wish' event_slug=event.slug %}" class="btn btn-info"> + {% trans "New AK Wish" %} + </a> + <span style="font-size: 1.5em"> + | + <label for="selectOwnerId" class="align-middle d-inline">{% trans "Who" %}:</label> + </span> + <select name="owner_id" id="selectOwnerId" class=""> + <option value="-1">{% trans "I do not own AKs yet" %}</option> + {% for owner in existingOwners %} + <option value="{{ owner.pk }}">{{ owner }}</option> + {% endfor %} + </select> + <input + type="submit" + class="btn btn-primary" + value="{% trans "New AK" %}" + formaction="{% url 'submit:akowner_select' event_slug=event.slug %}" + /> + <input + type="submit" + class="btn btn-success" + value="{% trans 'Edit Person Info' %}" + formaction="{% url 'submit:akowner_edit_dispatch' event_slug=event.slug %}" + /> + </form> + </div> + {% else %} + <div class="alert alert-warning" style="margin-top:20px;margin-bottom: 20px;"> + {% trans "This event is not active. You cannot add or change AKs" %} + </div> + {% endif %} <h2>{% trans "Current AKs" %}</h2> -- GitLab