SciPost Code Repository

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

fix decision form for nominations

fix htmx target errors on nomination rounds
parent fb71dfaa
No related branches found
No related tags found
1 merge request!58[Fellowship Nominations] Rework the fellowship nomination system and UI
Showing with 56 additions and 62 deletions
......@@ -568,8 +568,8 @@ class FellowshipNominationDecisionForm(forms.ModelForm):
css_class="row",
),
)
if voting_round:
self.fields["voting_round"].initial = voting_round
self.fields["outcome"].initial = voting_round.vote_outcome
......
{% load crispy_forms_tags %}
{% load automarkup %}
{% if voting_round.decision %}
{{ voting_round.decision }}
<p>Fixed on: {{ voting_round.decision.fixed_on }}</p>
<div id="nomination-{{ voting_round.id }}-decision">
{% if voting_round.decision.comments %}
<p>Comments:</p>
{% automarkup voting_round.decision.comments %}
{% endif %}
{% if voting_round.decision %}
{% if voting_round.decision.outcome == 'elected' %}
<div class="badge fs-4 mb-2 bg-success">{{ voting_round.decision.get_outcome_display }}</div>
{% elif voting_round.decision.outcome == 'notelected' %}
<div class="badge fs-4 mb-2 bg-danger">{{ voting_round.decision.get_outcome_display }}</div>
{% endif %}
{% if voting_round.decision.comments %}
<h5>Decision comments</h5>
<p>{{ voting_round.decision.comments }}</p>
{% endif %}
{% else %}
{% else %}
{% with blocks=voting_round.decision_blocks %}
{% if "edadmin" in user_roles %}
{% if not voting_round.is_open %}
{% with blocks=voting_round.decision_blocks %}
{% if blocks %}
<p>The decision cannot be fixed at this moment: {{ blocks }}</p>
{% else %}
<form hx-post="{% url 'colleges:_hx_nomination_decision_form' round_id=voting_round.id %}"
hx-target="#nomination-{{ voting_round.id }}-decision">
{% crispy decision_form %}
</form>
{% endif %}
{% endwith %}
{% else %}
<p class="text-warning">The voting round is still open. You many not draft a decision yet.</p>
{% endif %}
{% if blocks %}
<p>The decision cannot be fixed at this moment: {{ blocks }}</p>
{% else %}
<form hx-post="{% url 'colleges:_hx_nomination_decision_form' round_id=voting_round.id %}"
hx-target="#nomination-{{ voting_round.id }}-decision">
{% crispy decision_form %}
</form>
<p class="text-warning">No decision has been formulated yet.</p>
{% endif %}
{% endwith %}
{% endif %}
{% endif %}
</div>
......@@ -50,7 +50,6 @@
<div id="nomination-{{ nomination.id }}-li-contents"
hx-get="{% url 'colleges:_hx_nomination_li_contents' nomination_id=nomination.id %}"
hx-trigger="toggle from:#nomination-{{ nomination.id }}-li-details"
hx-target="this"></div>
hx-trigger="intersect once"></div>
</details>
</div>
......@@ -118,8 +118,7 @@
<div id="nomination-{{ nomination.id }}-comments"
hx-get="{% url 'colleges:_hx_nomination_comments' nomination_id=nomination.id %}"
hx-trigger="revealed"
hx-target="this"></div>
hx-trigger="intersect once"></div>
</div>
</details>
</div>
......@@ -139,8 +138,7 @@
{% if round.is_open and session_fellowship in round.eligible_to_vote.all %}
<div id="nomination-{{ round.nomination.id }}-vote"
hx-get="{% url 'colleges:_hx_nomination_vote' voting_round_id=round.id %}"
hx-trigger="revealed"
hx-target="this"></div>
hx-trigger="intersect once"></div>
{% else %}
{% include "colleges/_hx_voting_round_results.html" with voting_round=round %}
{% endif %}
......
......@@ -49,8 +49,7 @@
<h4>Update the response to this invitation:</h4>
<div id="invitation-{{ invitation.id }}-update-response"
hx-get="{% url 'colleges:_hx_fellowship_invitation_update_response' invitation_id=invitation.id %}"
hx-trigger="toggle from:#invitation-{{ invitation.id }}-details"
hx-target="this"></div>
hx-trigger="toggle from:#invitation-{{ invitation.id }}-details"></div>
</div>
</details>
{% empty %}
......
......@@ -6,7 +6,7 @@
class="p-2 mt-2"
hx-get="{% url 'profiles:_hx_profile_specialties' profile_id=nomination.profile.id %}"
hx-trigger="toggle from:#nomination-{{ nomination.id }}-specialties"></div>
<button class="btn btn-success text-white m-2"
<button class="btn btn-success text-white m-2 nomination-specialties-done-btn"
hx-get="{% url 'colleges:_hx_nominations_needing_specialties' %}"
hx-target="#nominations_needing_specialties">Done</button>
</details>
......
......@@ -5,36 +5,15 @@
<h3>Votes</h3>
<div id="nomination-{{ nomination.id }}-round-{{ voting_round.id }}-votes"
hx-get="{% url 'colleges:_hx_nomination_voter_table' round_id=voting_round.id %}"
hx-trigger="revealed"
hx-target="this"></div>
hx-trigger="intersect once"></div>
{% endif %}
<div class="row mb-0">
<div class="col-12 col-md mt-3">
<h3>Decision</h3>
{% if voting_round.decision.outcome == 'elected' %}
<div class="badge fs-4 ms-2 bg-success">{{ voting_round.decision.get_outcome_display }}</div>
{% elif voting_round.decision.outcome == 'notelected' %}
<div class="badge fs-4 ms-2 bg-danger">{{ voting_round.decision.get_outcome_display }}</div>
{% else %}
{% if "edadmin" in user_roles %}
{% if not voting_round.is_open %}
<div id="nomination-{{ nomination.id }}-decision_form"
hx-get="{% url 'colleges:_hx_nomination_decision_form' round_id=voting_round.id %}"
hx-trigger="revealed"
hx-target="this"></div>
{% else %}
<p class="text-warning">The voting round is still open. You many not draft a decision yet.</p>
{% endif %}
{% else %}
<p class="text-warning">No decision has been formulated yet.</p>
{% endif %}
{% endif %}
<div hx-get="{% url 'colleges:_hx_nomination_decision_form' round_id=voting_round.id %}"
hx-trigger="intersect once"></div>
</div>
<div class="col-12 col-md mt-3">{% include "colleges/_voting_results_box.html" with voting_round=voting_round %}</div>
......
<div class="tablist">
{% for tab_choice in tab_choices %}
<a hx-get="{% url 'colleges:_hx_voting_rounds' %}?tab={{ tab_choice.0 }}"
{% if selected == tab_choice.0 %}class="selected"{% endif %}
<a hx-get="{% url 'colleges:_hx_voting_rounds' %}?tab={{ tab_choice.0 }}" hx-target="#voting_tablist"
{% if selected == tab_choice.0 %}class="selected"{% endif %}
>{{ tab_choice.1 }}</a>
{% endfor %}
</div>
......@@ -113,12 +113,12 @@
<h3>Add specialties</h3>
<div id="nominations_needing_specialties"
hx-get="{% url 'colleges:_hx_nominations_needing_specialties' %}"
hx-trigger="toggle from:#ensure-specialties-details"></div>
hx-trigger="intersect once"></div>
<h3 class="mt-4 ">Start round</h3>
<div id="nominations_no_round_started"
hx-get="{% url 'colleges:_hx_nominations_no_round_started' %}"
hx-trigger="toggle from:#ensure-specialties-details, click from:body target:.nomination-start-round-btn">
hx-trigger="intersect once, click from:body target:.nomination-start-round-btn, click from:body target:.nomination-specialties-done-btn">
</div>
</div>
</details>
......@@ -138,10 +138,8 @@
</summary>
<div class="p-2">
<div id="voting_tablist" hx-get="{% url 'colleges:_hx_voting_rounds' %}?tab=
{% if 'edadmin' in user_roles %}ongoing{% else %}ongoing-vote_required{% endif %}
" hx-trigger="toggle from:#voting-details, click from:body target:.nomination-start-round-btn" hx-target="this" hx-swap="innerHTML">
</div>
<div id="voting_tablist" hx-trigger="toggle from:#voting-details, click from:body target:.nomination-start-round-btn"
hx-get="{% url 'colleges:_hx_voting_rounds' %}?tab={% if 'edadmin' in user_roles %}ongoing{% else %}ongoing-vote_required{% endif %}" ></div>
</div>
</details>
......@@ -154,9 +152,7 @@
<div class="p-2 mt-2">
<div id="invitations_tablist"
hx-get="{% url 'colleges:_hx_nominations_invitations' %}?response=notyetinvited"
hx-trigger="toggle from:#invitations-details"
hx-target="this"
hx-swap="innerHTML"></div>
hx-trigger="toggle from:#invitations-details"></div>
</div>
</details>
{% endif %}
......
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