Bugfixing, template improvements, translation updates.

- Fixed #649: Clean old motion fragments in template and pdf (about motion notes).
- Fixed motion pdf issues: missing submitters, voting result and make motion state translateable- Added post_save function also for UserUpdateView.
This commit is contained in:
Emanuel Schuetze 2013-05-28 20:31:01 +02:00
parent b80a526ddc
commit 9fb2052b3d
11 changed files with 301 additions and 251 deletions

View File

@ -137,7 +137,7 @@ class Item(MPTTModel, SlideMixin):
# TODO: Rename it to 'get_related_object' # TODO: Rename it to 'get_related_object'
object = get_slide_from_sid(self.related_sid, element=True) object = get_slide_from_sid(self.related_sid, element=True)
if object is None: if object is None:
self.title = _('Item for deleted slide %s') % self.related_sid self.title = _('< Item for deleted slide (%s) >') % self.related_sid
self.related_sid = None self.related_sid = None
self.save() self.save()
return self return self

View File

@ -20,7 +20,6 @@
<h1> <h1>
{{ item }} {{ item }}
<small class="pull-right"> <small class="pull-right">
<div class="btn-toolbar">
<a href="{% url 'item_overview' %}" class="btn btn-mini"><i class="icon-chevron-left"></i> {% trans "Back to overview" %}</a> <a href="{% url 'item_overview' %}" class="btn btn-mini"><i class="icon-chevron-left"></i> {% trans "Back to overview" %}</a>
{% if perms.projector.can_manage_projector %} {% if perms.projector.can_manage_projector %}
<a href="{% url 'projector_activate_slide' item.sid %}" <a href="{% url 'projector_activate_slide' item.sid %}"
@ -41,14 +40,13 @@
</ul> </ul>
{% endif %} {% endif %}
</div> </div>
</div>
</small> </small>
</h1> </h1>
<p> <p>
{% if item.get_related_slide == item %} {% if item.get_related_slide == item %}
{{ item.text|safe|linebreaks }} {{ item.text|safe|linebreaks }}
{% else %} {% else %}
<a href="{% model_url item.get_related_slide %}">{% trans 'Goto' %} {% trans item.get_related_type %} {{ item.get_related_slide }}</a> <a href="{% model_url item.get_related_slide %}" class="btn btn-small">{% trans 'View' %} "{{ item.get_related_slide }}" ({% trans item.get_related_type %})</a>
{% endif %} {% endif %}
</p> </p>
@ -146,7 +144,7 @@
{% endif %} {% endif %}
</p> </p>
{% if perms.can_manage_agenda %} {% if perms.agenda.can_manage_agenda %}
<form action="" method="post">{% csrf_token %} <form action="" method="post">{% csrf_token %}
{% for field in form %} {% for field in form %}
<label>{{ field.label }}:</label> <label>{{ field.label }}:</label>

File diff suppressed because it is too large Load Diff

View File

@ -734,7 +734,7 @@ class MotionPoll(CountInvalid, CountVotesCast, BasePoll):
def __unicode__(self): def __unicode__(self):
"""Return a string, representing the poll.""" """Return a string, representing the poll."""
return _('Ballot %d') % self.poll_number return _('Vote %d') % self.poll_number
def get_absolute_url(self, link='edit'): def get_absolute_url(self, link='edit'):
"""Return an URL for the poll. """Return an URL for the poll.

View File

@ -56,7 +56,8 @@ def motion_to_pdf(pdf, motion):
stylesheet['Heading4'])) stylesheet['Heading4']))
cell1b = [] cell1b = []
cell1b.append(Spacer(0, 0.2 * cm)) cell1b.append(Spacer(0, 0.2 * cm))
cell1b.append(Paragraph(unicode(motion.submitter), stylesheet['Normal'])) for submitter in motion.submitter.all():
cell1b.append(Paragraph(unicode(submitter), stylesheet['Normal']))
motion_data.append([cell1a, cell1b]) motion_data.append([cell1a, cell1b])
# TODO: choose this in workflow # TODO: choose this in workflow
@ -88,26 +89,12 @@ def motion_to_pdf(pdf, motion):
cell3b.append(Spacer(0, 0.2 * cm)) cell3b.append(Spacer(0, 0.2 * cm))
motion_data.append([cell3a, cell3b]) motion_data.append([cell3a, cell3b])
## # status
## cell4a = []
## cell4b = []
## note = " ".join(motion.notes)
## cell4a.append(Paragraph("<font name='Ubuntu-Bold'>%s:</font>" % _("Status"), stylesheet['Heading4']))
## if note != "":
## if motion.status == "pub":
## cell4b.append(Paragraph(note, stylesheet['Normal']))
## else:
## cell4b.append(Paragraph("%s | %s" % (motion.get_status_display(), note), stylesheet['Normal']))
## else:
## cell4b.append(Paragraph("%s" % motion.get_status_display(), stylesheet['Normal']))
## data.append([cell4a, cell4b])
# Motion state # Motion state
cell4a = [] cell4a = []
cell4b = [] cell4b = []
cell4a.append(Paragraph("<font name='Ubuntu-Bold'>%s:</font>" % _("State"), cell4a.append(Paragraph("<font name='Ubuntu-Bold'>%s:</font>" % _("State"),
stylesheet['Heading4'])) stylesheet['Heading4']))
cell4b.append(Paragraph(motion.state.name, stylesheet['Normal'])) cell4b.append(Paragraph(_(motion.state.name), stylesheet['Normal']))
motion_data.append([cell4a, cell4b]) motion_data.append([cell4a, cell4b])
# Version number (aid) # Version number (aid)
@ -137,7 +124,7 @@ def motion_to_pdf(pdf, motion):
option = poll.get_options()[0] option = poll.get_options()[0]
yes, no, abstain, invalid, votecast = ( yes, no, abstain, invalid, votecast = (
option['Yes'], option['No'], option['Abstain'], option['Yes'], option['No'], option['Abstain'],
poll.print_voteinvalid(), poll.print_votecast()) poll.print_votesinvalid(), poll.print_votescast())
if len(polls) > 1: if len(polls) > 1:
cell6b.append(Paragraph("%s. %s" % (ballotcounter, _("Vote")), cell6b.append(Paragraph("%s. %s" % (ballotcounter, _("Vote")),

View File

@ -5,6 +5,11 @@
* :license: GNU GPL, see LICENSE for more details. * :license: GNU GPL, see LICENSE for more details.
*/ */
/* motion create/update form fields */
#id_submitter, #id_supporter {
height: 110px;
width: auto;
}
/* motion version diff table */ /* motion version diff table */
table.diff, .diff_row { table.diff, .diff_row {
font-size: 12px; font-size: 12px;

View File

@ -184,11 +184,8 @@
<!-- Status --> <!-- Status -->
<h5>{% trans "Status" %}:</h5> <h5>{% trans "Status" %}:</h5>
{% if motion.state_id != "pub" %}
{# TODO: trans motion.state #}
<span class="label label-info">{% trans motion.state.name %}</span> <span class="label label-info">{% trans motion.state.name %}</span>
<br> <br>
{% endif %}
<!-- Vote results --> <!-- Vote results -->
<h5>{% trans "Vote results" %}:</h5> <h5>{% trans "Vote results" %}:</h5>

View File

@ -6,6 +6,7 @@
{% load staticfiles %} {% load staticfiles %}
{% block header %} {% block header %}
<link type="text/css" rel="stylesheet" media="all" href="{% static 'styles/motion.css' %}" />
<link type="text/css" rel="stylesheet" media="all" href="{% static 'styles/ckeditor.css' %}" /> <link type="text/css" rel="stylesheet" media="all" href="{% static 'styles/ckeditor.css' %}" />
{% endblock %} {% endblock %}

View File

@ -132,6 +132,17 @@ class UserUpdateView(UpdateView):
form_kwargs.update({'request': self.request}) form_kwargs.update({'request': self.request})
return form_kwargs return form_kwargs
def post_save(self, form):
super(UserUpdateView, self).post_save(form)
# TODO: find a better solution that makes the following lines obsolete
# Background: motion.models.use_post_save adds already the registerd group
# to new user but super(..).post_save(form) removes it and sets only the
# groups selected in the form (without 'registered')
# workaround: add registered group again manually
from openslides.participant.api import get_registered_group # TODO: Test, if global import is possible
registered = get_registered_group()
self.object.groups.add(registered)
class UserDeleteView(DeleteView): class UserDeleteView(DeleteView):
""" """

View File

@ -167,17 +167,17 @@ legend + .control-group {
height: 310px; height: 310px;
width: auto; width: auto;
} }
#id_submitter, #id_supporter, #id_users { #id_users {
height: 110px; height: 110px;
width: auto; width: auto;
} }
#dataTableParticipants_filter input { #dataTable_filter input {
width: auto; width: auto;
} }
#dataTableParticipants { #dataTable {
clear: none; clear: none;
} }
#dataTableParticipants_wrapper .row-fluid:after { #dataTable_wrapper .row-fluid:after {
clear: none; clear: none;
} }