Added icon and style information for elected/not elected candidates.

This commit is contained in:
Emanuel Schuetze 2011-09-05 23:13:18 +02:00
parent 4fb4691f14
commit 8cd0ac8778
4 changed files with 39 additions and 13 deletions

View File

@ -145,12 +145,19 @@
<tr class="{% cycle 'odd' '' %}">
<td class="candidate">
{% with vote|first as candidate %}
{{ candidate.0 }}
{% if candidate.1 %}
<a class="election_link iselected" href='{% url assignment_user_not_elected assignment.id candidate.0.id %}'>{% trans 'not elected' %}</a>
{% if perms.assignment.can_manage_assignment %}
<a class="election_link elected" href='{% url assignment_user_not_elected assignment.id candidate.0.id %}'></a>
{% else %}
<img src="/static/images/icons/games-highscores.png" title="{% trans 'Participant is elected' %}">
{% endif %}
{% else %}
<a class="election_link" href='{% url assignment_user_elected assignment.id candidate.0.id %}'>{% trans 'elected' %}</a>
{% if perms.assignment.can_manage_assignment %}
<a class="election_link" href='{% url assignment_user_elected assignment.id candidate.0.id %}'></a>
{% endif %}
{% endif %}
{{ candidate.0 }}
{% endwith %}
</td>
{% for v in vote|last %}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

View File

@ -1,5 +1,5 @@
$(function() {
$('a.iselected').parent().parent().children('td').addClass('iselected');
$('a.elected').parent().parent().children('td').addClass('elected');
@ -11,15 +11,14 @@ $(function() {
url: line.attr('href'),
dataType: 'json',
success: function(data) {
if (line.hasClass('iselected') && !data.elected) {
line.removeClass('iselected')
line.parent().parent().children('td').removeClass('iselected')
} else if (!line.hasClass('iselected') && data.elected) {
line.addClass('iselected')
line.parent().parent().children('td').addClass('iselected')
if (line.hasClass('elected') && !data.elected) {
line.removeClass('elected')
line.parent().parent().children('td').removeClass('elected')
} else if (!line.hasClass('elected') && data.elected) {
line.addClass('elected')
line.parent().parent().children('td').addClass('elected')
}
line.attr('href', data.link);
line.text(data.text);
},
error: function () {
alert("Ajax Error");

View File

@ -1,5 +1,25 @@
td.iselected {
background-color: green !important;
td.elected {
background-color: #BED4DE !important;
}
td.elected a.election_link {
background-image: url(/static/images/icons/games-highscores.png);
background-repeat: no-repeat;
background-position: center;
width: 16px;
height: 16px;
display: block;
margin-right: 5px;
float: left;
}
td a.election_link {
background-image: url(/static/images/icons/games-highscores-grey.png);
background-repeat: no-repeat;
background-position: center;
width: 16px;
height: 16px;
display: block;
margin-right: 5px;
float: left;
}