Automated merge with ssh://oshahn.de/openslides

This commit is contained in:
Oskar Hahn 2011-09-06 09:27:11 +02:00
commit 3c42b26d6f
12 changed files with 99 additions and 52 deletions

View File

@ -5,9 +5,12 @@
{% load tags %}
<head>
<link type="text/css" rel="stylesheet" href="/static/styles/beamer.css">
<link rel="shortcut icon" href="/static/images/favicon.png" type="image/png" />
<script type="text/javascript" src="/static/javascript/jquery.js"></script>
<script type="text/javascript" src="/static/javascript/beamer.js"></script>
<title>{% block title %} {% get_config 'event_name' %} {% endblock %}</title>
{% block header %}
{% endblock %}
</head>
<body>
<div id="config" style="display:none;">

View File

@ -1,19 +1,24 @@
{% extends "beamer.html" %}
{% block title %}{{ block.super }} - {{ item.title }}{% endblock %}
{% block title %}{{ block.super }} - #{{ item.title }}{% endblock %}
{% block header %}
<link type="text/css" rel="stylesheet" media="all" href="/static/styles/assignment.css" />
<script type="text/javascript" src="/static/javascript/assignment.js"></script>
{% endblock %}
{% block content %}
{% trans "Election" %}:
<h1>{{ item.assignment }}</h1>
{% if item.assignment.status == "sea" or item.assignment.status == "vot" %}
<div id="sidebar">
<div class="box">
<h4>{% trans "Status" %}:</h4>
{% trans item.assignment.get_status_display %}
{% if item.assignment.status == "sea" or item.assignment.status == "vot" %}
<h4>{% trans "Number of available posts" %}:</h4>
{{ item.assignment.posts }}
</div>
</div>
{% endif %}
</div>
</div>
<p>
<div class="text">{{ item.assignment.description|linebreaks }}</div>
@ -44,13 +49,22 @@
</tr>
{% for vote in votes %}
<tr class="{% cycle 'odd' '' %}">
{% for v in vote %}
<td>{% if v %}
<td class="candidate">
{% with vote|first as candidate %}
{% if candidate.1 %}
<a class="elected"><img src="/static/images/icons/games-highscores.png" title="{% trans 'Candidate is elected' %}"></a>
{% endif %}
{{ candidate.0 }}
{% endwith %}
</td>
{% for v in vote|last %}
<td style="white-space:nowrap;">{% if v %}
{% if v|length == 3 %}
<img src="/static/images/icons/voting-yes.png" title="{% trans 'Yes' %}"> {% if v.0 %}{{ v.0 }}{% else %}&empty;{% endif %}<br>
<img src="/static/images/icons/voting-no.png" title="{% trans 'No' %}"> {% if v.1 %}{{ v.1 }}{% else %}&empty;{% endif %}<br>
<img src="/static/images/icons/voting-abstention.png" title="{% trans 'Abstention' %}"> {% if v.2 %}{{ v.2 }}{% else %}&empty;{% endif %}<br>
{% else %}
{% if v != "-" %}<img src="/static/images/icons/voting-yes.png" title="{% trans 'Yes' %}">{% endif %}
{{ v }}
{% endif %}
{% else %}&empty;{% endif %}

View File

@ -107,24 +107,19 @@ def assignment_votes(item):
votes = []
if item.type == "ItemAssignment":
assignment = item.cast().assignment
# list of candidates
candidates = set()
for option in Option.objects.filter(poll__assignment=assignment):
candidates.add(option.value)
# list of votes
votes = []
for candidate in candidates:
tmplist = []
tmplist.append(candidate)
for candidate in assignment.candidates:
tmplist = [[candidate, assignment.is_elected(candidate)], []]
for poll in assignment.poll_set.all():
if candidate in poll.options_values:
option = Option.objects.filter(poll=poll).filter(user=candidate)[0]
if poll.optiondecision:
tmplist.append([option.yes, option.no, option.undesided])
tmplist[1].append([option.yes, option.no, option.undesided])
else:
tmplist.append(option.yes)
tmplist[1].append(option.yes)
else:
tmplist.append("-")
tmplist[1].append("-")
votes.append(tmplist)
return votes

View File

@ -14,7 +14,7 @@
<a href="{% url print_application application.id %}"><img src="/static/images/icons/application-pdf.png" title="{% trans 'Print Application' %}"></a>
</h4>
<span clear="all"></span>
{{ application.submitter }}
{{ application.submitter.profile }}
{% if user == application.submitter %}
<img src="/static/images/icons/user-information.png" title="{% trans 'You!' %}">
{% endif %}
@ -24,10 +24,11 @@
{% if application.supporter.count == 0 %}
-
{% else %}
<ol>
{% for supporter in application.supporter.all %}
{{ forloop.counter }}. {{supporter }}
{% if not forloop.last %}<br>{% endif %}
<li> {{ supporter.profile }}</li>
{% endfor %}
</ol>
{% endif %}
{% endif %}

View File

@ -71,9 +71,10 @@ class Assignment(models.Model):
def candidates(self):
# list of candidates
from poll.models import Option
candidates = set()
for option in Option.objects.filter(poll__assignment=self):
candidates.add(option.value)
candidates = []
#for option in Option.objects.values('user__user__profile').filter(poll__assignment=self).order_by('user__user__first_name').distinct():
for option in Option.objects.filter(poll__assignment=self).order_by('user__user__first_name'):
candidates.append(option.value)
return candidates
def set_elected(self, profile, value=True):

View File

@ -145,12 +145,18 @@
<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 %}
<a class="election_link" href='{% url assignment_user_elected assignment.id candidate.0.id %}'>{% trans 'elected' %}</a>
<a class="elected"><img src="/static/images/icons/games-highscores.png" title="{% trans 'Candidate is elected' %}"></a>
{% endif %}
{% else %}
{% 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 %}
@ -160,6 +166,7 @@
<img src="/static/images/icons/voting-no.png" title="{% trans 'No' %}"> {% if v.1 %}{{ v.1 }}{% else %}&empty;{% endif %}<br>
<img src="/static/images/icons/voting-abstention.png" title="{% trans 'Abstention' %}"> {% if v.2 %}{{ v.2 }}{% else %}&empty;{% endif %}<br>
{% else %}
{% if v != "-" %}<img src="/static/images/icons/voting-yes.png" title="{% trans 'Yes' %}">{% endif %}
{{ v }}
{% endif %}
{% else %}&empty;{% endif %}

View File

@ -55,8 +55,11 @@ class Profile(models.Model):
)
def set_first_user_passwords():
count = 0
for user in Profile.objects.filter(Q(firstpassword='') | Q(firstpassword__isnull=True)):
count = count + 1
user.firstpassword = gen_password()
user.user.set_password(user.firstpassword)
user.user.save()
user.save()
return count

View File

@ -16,7 +16,7 @@
<button type="submit" name="apply">
<span class="icon apply">{%trans 'Apply' %}</span>
</button>
<a href='{% url user_overview %}'>
<a href='{% url user_group_overview %}'>
<button type="button">
<span class="icon cancel">{%trans 'Cancel' %}</span>
</button>

View File

@ -19,7 +19,7 @@ from django.contrib.auth.decorators import login_required
from django.contrib.auth.forms import SetPasswordForm
from django.contrib import messages
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext as _
from django.utils.translation import ugettext as _, ungettext
from participant.models import Profile, set_first_user_passwords
from participant.api import gen_username
@ -174,7 +174,7 @@ def group_edit(request, group_id=None):
try:
group = Group.objects.get(id=group_id)
except Group.DoesNotExist:
raise NameError("There is no Group %d" % group_id)
raise NameError("There is no group %d" % group_id)
else:
group = None
@ -287,7 +287,11 @@ def user_import(request):
@permission_required('participant.can_manage_participant')
def gen_passwords(request):
set_first_user_passwords()
count = set_first_user_passwords()
if count:
messages.success(request, ungettext('%s Password was successfully generated.', '%s Passwords were successfully generated.', count ) % count)
else:
messages.info(request, _('There are no participants which need a first time password. No passwords generated.') )
return redirect(reverse('user_overview'))

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;
}