diff --git a/election/models.py b/election/models.py index 18343383..525dc7a4 100644 --- a/election/models.py +++ b/election/models.py @@ -39,6 +39,12 @@ class Election(models.Model): def has_voted(self, user): return hasattr(user, 'has_voted') and user.has_voted.all() == list(self.role.all()) + def can_candidate(self, user): + for group in self.candidature_groups.all(): + if user.is_in_group(group): + return True + return False + # Permissions diff --git a/election/templates/election/election_detail.jinja b/election/templates/election/election_detail.jinja index ebcd4cb6..43a07ce3 100644 --- a/election/templates/election/election_detail.jinja +++ b/election/templates/election/election_detail.jinja @@ -35,6 +35,17 @@ th { margin-bottom: 5px; } +.election__elector-infos { + margin: 0; + margin-bottom: 5px; + font-weight: bolder; + color: darkgreen; +} + +.election__vote { + margin-bottom: 5px; +} + .election__vote-form { width: auto; } @@ -135,10 +146,10 @@ th { color: dimgray; text-align: center; font-weight: bolder; - cursor: pointer; } -.candidate__vote-choice:hover, .candidate__vote-choice:focus { +.candidate__vote-input:not(:disabled:checked) + .candidate__vote-choice:hover, +.candidate__vote-input:not(:disabled:checked) + .candidate__vote-choice:focus { background: lightgrey; } @@ -149,8 +160,12 @@ th { color: darkgreen; } -.candidate__vote-input:checked + .candidate__vote-choice:hover, -.candidate__vote-input:checked + .candidate__vote-choice:focus { +.candidate__vote-input:not(:disabled) + .candidate__vote-choice { + cursor: pointer; +} + +.candidate__vote-input:checked:not(:disabled) + .candidate__vote-choice:hover, +.candidate__vote-input:checked:not(:disabled) + .candidate__vote-choice:focus { background: palegreen; } @@ -159,8 +174,8 @@ th { color: darkred; } -.role_error .candidate__vote-input:checked + .candidate__vote-choice:hover, -.role_error .candidate__vote-input:checked + .candidate__vote-choice:focus { +.role_error .candidate__vote-input:checked:not(:disabled) + .candidate__vote-choice:hover, +.role_error .candidate__vote-input:checked:not(:disabled) + .candidate__vote-choice:focus { background: indianred; } @@ -184,6 +199,18 @@ th { .election__sumbit-button:focus { background-color: lightskyblue; } + +.election__add-elements a { + display: inline-block; + border: solid 1px darkgrey; + height: 20px; + line-height: 20px; + padding: 10px; +} + +.election__add-candidature { + margin-top: 5px; +} {%- endblock %} @@ -202,7 +229,7 @@ th {
{%- endif %} -