Refactored polls module to use browser sessions for creation and voting routes.
CI / Formatting (push) Successful in 5s
CI / Linting (push) Successful in 5s
CI / Tests (Python 3.12) (push) Successful in 2m47s
CI / Tests (Python 3.13) (push) Successful in 2m46s
CI / Tests (Python 3.14) (push) Successful in 2m44s
CI / Type Checking (push) Successful in 9s
CI / Spelling (push) Successful in 6s
CI / Formatting (push) Successful in 5s
CI / Linting (push) Successful in 5s
CI / Tests (Python 3.12) (push) Successful in 2m47s
CI / Tests (Python 3.13) (push) Successful in 2m46s
CI / Tests (Python 3.14) (push) Successful in 2m44s
CI / Type Checking (push) Successful in 9s
CI / Spelling (push) Successful in 6s
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
<div id="poll-status" class="mb-4">
|
||||
<p class="text-body-secondary mb-1">Time remaining: <strong id="timer">--:--</strong></p>
|
||||
{% if poll.hidden %}
|
||||
{% if token.is_moderator %}
|
||||
{% if viewer_is_moderator %}
|
||||
<p class="text-body-secondary mb-0">Results are hidden until this poll ends. As a moderator, you can still see the real-time results.</p>
|
||||
{% else %}
|
||||
<p class="text-body-secondary mb-0">Results are hidden until this poll ends.</p>
|
||||
@@ -27,11 +27,11 @@
|
||||
{% if poll.allow_multiple %}
|
||||
<input type="checkbox" name="option" value="{{ loop.index0 }}" class="form-check-input me-2"
|
||||
{% if loop.index0 in current_votes %}checked{% endif %}
|
||||
{% if has_voted or (not token.is_authenticated and poll.requires_auth) %}disabled{% endif %}>
|
||||
{% if has_voted or (not viewer_is_authenticated and poll.requires_auth) %}disabled{% endif %}>
|
||||
{% else %}
|
||||
<input type="radio" name="option" value="{{ loop.index0 }}" class="form-check-input me-2" required
|
||||
{% if loop.index0 in current_votes %}checked{% endif %}
|
||||
{% if has_voted or (not token.is_authenticated and poll.requires_auth) %}disabled{% endif %}>
|
||||
{% if has_voted or (not viewer_is_authenticated and poll.requires_auth) %}disabled{% endif %}>
|
||||
{% endif %}
|
||||
{{ option }}
|
||||
</label>
|
||||
@@ -42,7 +42,7 @@
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
{% if poll.requires_auth and not token.is_authenticated %}
|
||||
{% if poll.requires_auth and not viewer_is_authenticated %}
|
||||
<div class="alert alert-warning mb-0" role="alert">This poll requires an authenticated account to vote. You are viewing results only.</div>
|
||||
{% elif not has_voted %}
|
||||
<button type="submit" class="btn btn-primary me-2">Vote</button>
|
||||
@@ -51,15 +51,15 @@
|
||||
{% endif %}
|
||||
</form>
|
||||
|
||||
{% if token.is_moderator %}
|
||||
{% if viewer_is_moderator %}
|
||||
<hr class="my-4">
|
||||
<h5>Manage Poll</h5>
|
||||
<p class="text-body-secondary">As a moderator, you can perform the following actions on this poll:</p>
|
||||
<div class="d-flex gap-2">
|
||||
<form method="POST" action="{{ vote_url }}/end">
|
||||
<form method="POST" action="{{ end_url }}">
|
||||
<button type="submit" class="btn btn-success">End Poll</button>
|
||||
</form>
|
||||
<form method="POST" action="{{ vote_url }}/cancel">
|
||||
<form method="POST" action="{{ cancel_url }}">
|
||||
<button type="submit" class="btn btn-danger">Cancel Poll</button>
|
||||
</form>
|
||||
</div>
|
||||
@@ -74,9 +74,9 @@ window.POLL_CONFIG = {
|
||||
minSelections: {{ poll.min_selections | tojson }},
|
||||
maxSelections: {{ poll.max_selections | tojson }}
|
||||
};
|
||||
window.TOKEN_INFO = {
|
||||
isModerator: {{ token.is_moderator | tojson }},
|
||||
eventsUrl: {{ (vote_url + "/events") | tojson }}
|
||||
window.VIEWER_INFO = {
|
||||
isModerator: {{ viewer_is_moderator | tojson }},
|
||||
eventsUrl: {{ events_url | tojson }}
|
||||
};
|
||||
</script>
|
||||
<script src="{{ polls_js_url }}?v={{ owlbot_version }}"></script>
|
||||
|
||||
Reference in New Issue
Block a user