SciPost Code Repository
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SciPost
Manage
Activity
Members
Labels
Plan
Issues
119
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SciPost
SciPost
Commits
d4dde186
Commit
d4dde186
authored
2 years ago
by
Jean-Sébastien Caux
Browse files
Options
Downloads
Patches
Plain Diff
Fix bug in meeting voting (by ensuring unique element identifiers)
parent
85749615
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
scipost_django/forums/templates/forums/_hx_motion_voting.html
+19
-17
19 additions, 17 deletions
...ost_django/forums/templates/forums/_hx_motion_voting.html
scipost_django/forums/views.py
+2
-3
2 additions, 3 deletions
scipost_django/forums/views.py
with
21 additions
and
20 deletions
scipost_django/forums/templates/forums/_hx_motion_voting.html
+
19
−
17
View file @
d4dde186
...
...
@@ -15,7 +15,7 @@
<table
class=
"table table-bordered"
>
<thead>
<tr>
<th>
Eligible
to
vot
e
</th>
<th>
Eligible
for
vot
ing
</th>
<th>
Agreed
</th>
<th>
Doubt
</th>
<th>
Disagreed
</th>
...
...
@@ -26,7 +26,7 @@
<tr>
<td>
<ul
class=
"list list-unstyled"
>
{% for voter in motion.eligible_
to
_vot
e
.all %}
{% for voter in motion.eligible_
for
_vot
ing
.all %}
<li>
{{ voter.contributor }}
</li>
{% empty %}
<li>
None
</li>
...
...
@@ -107,75 +107,77 @@
{% endfor %}
{% endif %}
<form
hx-post=
"{% url 'forums:_hx_motion_voting' slug=forum.slug motion_id=motion.id %}"
<form
id=
"motion-{{ motion.id }}-voting-form"
hx-post=
"{% url 'forums:_hx_motion_voting' slug=forum.slug motion_id=motion.id %}"
hx-target=
"#motion-{{ motion.id }}-voting"
hx-trigger=
"change"
>
{% csrf_token %}
<input
type=
"hidden"
name=
"user"
value=
"{{ request.user.id }}"
id=
"id_user"
>
<input
type=
"hidden"
name=
"motion"
value=
"{{ motion.id }}"
id=
"id_motion"
>
<div
class=
"btn-group"
role=
"group"
aria-label=
"motion voting buttons"
>
<input
type=
"hidden"
name=
"user"
value=
"{{ request.user.id }}"
id=
"motion-{{ motion.id }}-id_user"
>
<input
type=
"hidden"
name=
"motion"
value=
"{{ motion.id }}"
id=
"motion-{{ motion.id }}-id_motion"
>
<div
id=
"motion-{{ motion.id }}-voting-options"
class=
"btn-group"
role=
"group"
aria-label=
"motion voting buttons"
>
<input
type=
"radio"
class=
"btn-check"
name=
"vote"
id=
"vote-Y"
value=
"Y"
id=
"
motion-{{ motion.id }}-
vote-Y"
value=
"Y"
{%
if
request.user
in
motion.in_agreement.all
%}
checked
{%
endif
%}
{%
if
not
motion.open_for_voting
or
request.user
not
in
motion.eligible_for_voting.all
%}
disabled
{%
endif
%}
>
{% if request.user in motion.in_agreement.all %}
<label
class=
"btn btn-success text-white"
for=
"vote-Y"
>
<label
class=
"btn btn-success text-white"
for=
"
motion-{{ motion.id }}-
vote-Y"
>
<strong>
Agree
{% include "bi/check-square-fill.html" %}
</strong>
<br>
{{ motion.in_agreement.all|length }}
</label>
{% else %}
<label
class=
"btn btn-success"
for=
"vote-Y"
>
<label
class=
"btn btn-success"
for=
"
motion-{{ motion.id }}-
vote-Y"
>
Agree
{% include "bi/square.html" %}
<br>
{{ motion.in_agreement.all|length }}
</label>
{% endif %}
<input
type=
"radio"
class=
"btn-check"
name=
"vote"
id=
"vote-M"
value=
"M"
id=
"
motion-{{ motion.id }}-
vote-M"
value=
"M"
{%
if
request.user
in
motion.in_doubt.all
%}
checked
{%
endif
%}
{%
if
not
motion.open_for_voting
or
request.user
not
in
motion.eligible_for_voting.all
%}
disabled
{%
endif
%}
>
{% if request.user in motion.in_doubt.all %}
<label
class=
"btn btn-warning text-white"
for=
"vote-M"
>
<label
class=
"btn btn-warning text-white"
for=
"
motion-{{ motion.id }}-
vote-M"
>
<strong>
Doubt
{% include "bi/check-square-fill.html" %}
</strong>
<br>
{{ motion.in_doubt.all|length }}
</label>
{% else %}
<label
class=
"btn btn-warning"
for=
"vote-M"
>
<label
class=
"btn btn-warning"
for=
"
motion-{{ motion.id }}-
vote-M"
>
Doubt
{% include "bi/square.html" %}
<br>
{{ motion.in_doubt.all|length }}
</label>
{% endif %}
<input
type=
"radio"
class=
"btn-check"
name=
"vote"
id=
"vote-N"
value=
"N"
id=
"
motion-{{ motion.id }}-
vote-N"
value=
"N"
{%
if
request.user
in
motion.in_disagreement.all
%}
checked
{%
endif
%}
{%
if
not
motion.open_for_voting
or
request.user
not
in
motion.eligible_for_voting.all
%}
disabled
{%
endif
%}
>
{% if request.user in motion.in_disagreement.all %}
<label
class=
"btn btn-danger text-white"
for=
"vote-N"
>
<label
class=
"btn btn-danger text-white"
for=
"
motion-{{ motion.id }}-
vote-N"
>
<strong>
Disagree
{% include "bi/check-square-fill.html" %}
</strong>
<br>
{{ motion.in_disagreement.all|length }}
</label>
{% else %}
<label
class=
"btn btn-danger text-dark"
for=
"vote-N"
>
<label
class=
"btn btn-danger text-dark"
for=
"
motion-{{ motion.id }}-
vote-N"
>
Disagree
{% include "bi/square.html" %}
<br>
{{ motion.in_disagreement.all|length }}
</label>
{% endif %}
<input
type=
"radio"
class=
"btn-check"
name=
"vote"
id=
"vote-A"
value=
"A"
id=
"
motion-{{ motion.id }}-
vote-A"
value=
"A"
{%
if
request.user
in
motion.in_abstain.all
%}
checked
{%
endif
%}
{%
if
not
motion.open_for_voting
or
request.user
not
in
motion.eligible_for_voting.all
%}
disabled
{%
endif
%}
>
<label
class=
"btn btn-secondary"
for=
"vote-A"
>
<label
class=
"btn btn-secondary"
for=
"
motion-{{ motion.id }}-
vote-A"
>
Abstain
{% if request.user in motion.in_abstain.all %}
{% include "bi/check-square-fill.html" %}
...
...
This diff is collapsed.
Click to expand it.
scipost_django/forums/views.py
+
2
−
3
View file @
d4dde186
...
...
@@ -294,7 +294,6 @@ def _hx_post_form(request, slug, parent_model, parent_id, origin, target, text):
response
[
"
HX-Trigger-After-Settle
"
]
=
json
.
dumps
(
{
"
newPost
"
:
f
"
thread-
{
thread_initiator
.
id
}
"
,}
)
print
(
f
'
{
response
[
"
HX-Trigger-After-Settle
"
]
=
}
'
)
return
response
else
:
subject
=
""
...
...
@@ -409,8 +408,8 @@ def _hx_motion_voting(request, slug, motion_id):
"
in_abstain__contributor__user
"
,
),
pk
=
motion_id
)
initial
=
{
"
user
"
:
request
.
user
.
id
,
"
motion
"
:
motion
.
id
,
"
user
"
:
request
.
user
,
"
motion
"
:
motion
,
}
form
=
MotionVoteForm
(
request
.
POST
or
None
,
initial
=
initial
)
if
form
.
is_valid
():
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment