SciPost Code Repository

Skip to content
Snippets Groups Projects
Commit 3c08b6fc authored by George Katsikas's avatar George Katsikas :goat:
Browse files

reload nomination voting details on form submit

parent f74fd1d5
No related branches found
No related tags found
No related merge requests found
...@@ -65,7 +65,10 @@ ...@@ -65,7 +65,10 @@
<div class="col-12 col-md-5"> <div class="col-12 col-md-5">
{% if nomination.latest_voting_round %} {% if nomination.latest_voting_round %}
{% include "colleges/_hx_voting_round_summary.html" with round=nomination.latest_voting_round %} <div hx-get="{% url "colleges:_hx_voting_round_summary" round_id=nomination.latest_voting_round.id %}"
hx-trigger="submit from:#nomination-{{ nomination.id }}-details target:form delay:1000">
{% include "colleges/_hx_voting_round_summary.html" with round=nomination.latest_voting_round %}
</div>
{% else %} {% else %}
<div class="h-100 d-flex align-items-center justify-content-end"> <div class="h-100 d-flex align-items-center justify-content-end">
......
...@@ -17,9 +17,11 @@ ...@@ -17,9 +17,11 @@
{% for voting_round in voting_rounds %} {% for voting_round in voting_rounds %}
<div id="nomination-{{ nomination.id }}-round-{{ voting_round.id }}-tab-btn" type="button" class="me-2 nav-link <div id="nomination-{{ nomination.id }}-round-{{ voting_round.id }}-tab-btn" type="button" class="me-2 nav-link
{% if selected_round and selected_round.id == voting_round.id %}active{% endif %} {% if selected_round and selected_round.id == voting_round.id %}active{% endif %}
{% if voting_round.id in inaccessible_round_ids %}disabled opacity-50{% endif %} {% if voting_round.id in inaccessible_round_ids %}disabled opacity-50{% endif %}
" hx-get="{% url 'colleges:_hx_nomination_voting_rounds_tab' nomination_id=nomination.id round_id=voting_round.id %}" hx-target="#nomination-{{ nomination.id }}-round-tab-holder" hx-swap="outerHTML"> " hx-get="{% url 'colleges:_hx_nomination_voting_rounds_tab' nomination_id=nomination.id round_id=voting_round.id %}"
hx-target="#nomination-{{ nomination.id }}-round-tab-holder"
hx-swap="outerHTML"
hx-trigger="click{% if selected_round and selected_round.id == voting_round.id %}, submit from:#nomination-{{ nomination.id }}-round-tab-holder target:form delay:1000{% endif %}">
<span class="d-block text-nowrap"> <span class="d-block text-nowrap">
{% if voting_round.voting_opens and voting_round.voting_deadline %} {% if voting_round.voting_opens and voting_round.voting_deadline %}
......
...@@ -238,6 +238,11 @@ urlpatterns = [ ...@@ -238,6 +238,11 @@ urlpatterns = [
views._hx_nomination_voter_table, views._hx_nomination_voter_table,
name="_hx_nomination_voter_table", name="_hx_nomination_voter_table",
), ),
path(
"_hx_voting_round_summary",
views._hx_voting_round_summary,
name="_hx_voting_round_summary",
),
path( path(
"forms/", "forms/",
include( include(
......
...@@ -766,6 +766,17 @@ def _hx_nomination_details_contents(request, nomination_id): ...@@ -766,6 +766,17 @@ def _hx_nomination_details_contents(request, nomination_id):
return render(request, "colleges/_hx_nomination_details_contents.html", context) return render(request, "colleges/_hx_nomination_details_contents.html", context)
@login_required
@user_passes_test(is_edadmin_or_advisory_or_active_regular_or_senior_fellow)
def _hx_voting_round_summary(request, round_id):
"""For (re)loading the round summary if modified."""
round = get_object_or_404(FellowshipNominationVotingRound, pk=round_id)
context = {
"round": round,
}
return render(request, "colleges/_hx_voting_round_summary.html", context)
def _hx_nominations_search_form(request, filter_set: str): def _hx_nominations_search_form(request, filter_set: str):
form = FellowshipNominationSearchForm( form = FellowshipNominationSearchForm(
user=request.user, user=request.user,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment