Skip to content

Commit

Permalink
Merge pull request #2403 from franga2000/feature/barcode-on-privateurl
Browse files Browse the repository at this point in the history
Display check-in barcode on private URL
  • Loading branch information
tienne-B authored Mar 3, 2024
2 parents 873dd1c + 96c68b1 commit a8fa6b5
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 3 deletions.
40 changes: 37 additions & 3 deletions tabbycat/privateurls/templates/public_url_landing.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% extends "tables/base_vue_table.html" %}
{% load i18n debate_tags %}
{% load i18n static debate_tags %}

{% block page-title %}{% trans "Private URL" %}{% endblock %}
{% block head-title %}{% trans "Private URL" %}{% endblock %}
Expand Down Expand Up @@ -50,13 +50,18 @@
{% blocktrans trimmed with check_time=event.time asvar text %}
You have been checked in at {{ check_time }}
{% endblocktrans %}
{% include "components/item-info.html" with type='success' %}
{% include "components/item-info.html" with type='success' nopad=True %}
{% else %}
{% trans "You are not currently checked in." as text %}
{% include "components/item-info.html" with type='warning' %}
{% include "components/item-info.html" with type='warning' nopad=True %}
{% endif %}
{% endif %}

{% if checkins_used %}
{% trans "Show barcode for check-in" as text %}
{% include "components/item-action.html" with id="openBarcode" url="" icon="grid" child=False %}
{% endif %}

{% if object.adjudicator and pref.participant_ballots == 'private-urls' %}
{% for dadj in debateadjudications %}
{% roundurl 'results-public-ballotset-new-randomised' dadj.debate.round url_key as url %}
Expand Down Expand Up @@ -95,6 +100,25 @@
{{ block.super }} {# this is the Vue table, which is populated with previous results #}
</div>

<div class="modal fade" id="barcodeModal" tabindex="-1" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body text-center">
<svg id="{{ identifier.barcode }}" title="{{ identifier.owner }}"
class="barcode-placeholder w-100 h-auto" jsbarcode-value="{{ identifier.barcode }}"
jsbarcode-text="{{ identifier.barcode }} {{ identifier.owner.name|abbreviatename }}"
jsbarcode-width="7" jsbarcode-height="150">
</div>
</div>
</div>
</div>


{% endblock %}


Expand All @@ -108,4 +132,14 @@
});
});
</script>
{% if checkins_used %}
<script src="{% static 'js/vendor/JsBarcode.all.min.js' %}"></script>
<script>
JsBarcode(".barcode-placeholder").init();
$("#openBarcode").click( function() {
$("#barcodeModal").modal('show');
return false;
});
</script>
{% endif %}
{% endblock js %}
1 change: 1 addition & 0 deletions tabbycat/privateurls/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ def get_context_data(self, **kwargs) -> Dict[str, Any]:
try:
checkin_id = PersonIdentifier.objects.get(person=self.object)
kwargs['checkins_used'] = True
kwargs['identifier'] = checkin_id

checkins = get_unexpired_checkins(t, 'checkin_window_people')

Expand Down

0 comments on commit a8fa6b5

Please sign in to comment.