Several template and bug fixes, some minor view behavior changes

This commit is contained in:
Norman Jäckel 2013-05-22 23:53:01 +02:00
parent 9b5850a12b
commit 894f16ec53
10 changed files with 45 additions and 27 deletions

View File

@ -17,7 +17,7 @@
<li>
<a href="{% model_url motion %}">
{% if motion.identifier %}
[#{{ motion.identifier }}]
[# {{ motion.identifier }}]
{% else %}
[---]
{% endif %}
@ -37,7 +37,7 @@
<li>
<a href="{% model_url motion %}">
{% if motion.identifier %}
[#{{ motion.identifier }}]
[# {{ motion.identifier }}]
{% else %}
[---]
{% endif %}

View File

@ -22,6 +22,13 @@
<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>
{% if perms.projector.can_manage_projector %}
<a href="{% url 'projector_activate_slide' item.sid %}"
class="activate_link btn btn-mini {% if item.active and not show_list %}btn-primary{% endif %}"
rel="tooltip" data-original-title="{% trans 'Show' %}">
<i class="icon icon-facetime-video {% if item.active and not show_list %}icon-white{% endif %}"></i>
</a>
{% endif %}
{% if perms.agenda.can_manage_agenda %}
<div class="btn-group">
<a data-toggle="dropdown" href="#" class="btn btn-mini dropdown-toggle">
@ -34,13 +41,6 @@
</ul>
{% endif %}
</div>
{% if perms.projector.can_manage_projector %}
<a href="{% url 'projector_activate_slide' item.sid %}"
class="activate_link btn btn-mini {% if item.active and not show_list %}btn-primary{% endif %}"
rel="tooltip" data-original-title="{% trans 'Show' %}">
<i class="icon icon-facetime-video {% if item.active and not show_list %}icon-white{% endif %}"></i>
</a>
{% endif %}
</div>
</small>
</h1>

View File

@ -157,7 +157,7 @@ class MotionImportForm(CssClassMixin, forms.Form):
csvfile = forms.FileField(
widget=forms.FileInput(attrs={'size': '50'}),
label=ugettext_lazy('CSV File'),
help_text=ugettext_lazy('The file should be encoded in UTF-8.'))
help_text=ugettext_lazy('The file has to be encoded in UTF-8.'))
"""
CSV filt with import data.
"""

View File

@ -349,6 +349,12 @@ class Motion(SlideMixin, models.Model):
except IndexError:
return self.new_version
def get_last_not_rejected_version(self):
"""
Returns the newest version of the motion, which is not rejected.
"""
return self.versions.filter(rejected=False).order_by('-version_number')[0]
@property
def submitters(self):
return sorted([object.person for object in self.submitter.all()],

View File

@ -16,7 +16,7 @@
{% else %}
<i>[{% trans "no number" %}]</i>,
{% endif %}
{# TODO: show only for complex workflow #}
{# TODO: show only for workflow with versioning #}
{% trans "Version" %} {{ motion.version.version_number }}
</small>
<small class="pull-right">
@ -57,19 +57,19 @@
<div class="row-fluid">
<div class="span8">
{# TODO: show only for workflow with versioning #}
{% if motion.version.version_number < motion.last_version.version_number %}
{% if motion.version.version_number != motion.get_last_not_rejected_version.version_number %}
<span class="label label-warning">
<i class="icon-warning-sign icon-white"></i> {% trans "This is not the newest version." %}
<i class="icon-warning-sign icon-white"></i> {% trans "This is not the last not rejected version." %}
</span>
<a href="{% model_url motion.last_version %}" class="btn btn-small">{% trans "Go to last version" %}
(#{{ motion.last_version.version_number }})</a>
<a href="{% model_url motion.get_last_not_rejected_version %}" class="btn btn-small">{% trans "Go to last not rejected version" %}
(# {{ motion.get_last_not_rejected_version.version_number }})</a>
{% endif %}
{% if motion.version.version_number > motion.active_version.version_number %}
{% if motion.version.version_number != motion.active_version.version_number %}
<span class="label label-warning">
<i class="icon-warning-sign icon-white"></i> {% trans "This version is not yet authorized." %}
<i class="icon-warning-sign icon-white"></i> {% trans "This version is not authorized." %}
</span>
<a href="{% model_url motion.active_version %}" class="btn btn-small">{% trans "Go to last authorized version" %}
(#{{ motion.active_version.version_number }})</a>
(# {{ motion.active_version.version_number }})</a>
{% endif %}
<!-- Text -->
@ -198,7 +198,7 @@
{% if perms.motion.can_manage_motion or poll.has_votes %}
<li>{% trans "Vote" %}
{% if perms.motion.can_manage_motion %}
<a class="btn btn-mini" href="{% url 'motion_poll_edit' motion.id poll.id %}" title="{% trans 'Edit Vote' %}"><i class="icon-edit"></i></a>
<a class="btn btn-mini" href="{% url 'motion_poll_edit' motion.id poll.id %}" title="{% trans 'Edit Vote' %}"><i class="icon-pencil"></i></a>
<a class="btn btn-mini" href="{% url 'motion_poll_delete' motion.id poll.id %}" title="{% trans 'Delete Vote' %}"><i class="icon-remove"></i></a>
{% endif %}
<br>
@ -220,7 +220,7 @@
</li>
{% endif %}
{% empty %}
<span style="margin-left:-25px;">-</span>
<span style="margin-left:-25px;"></span>
{% endfor %}
</ol>
{% if allowed_actions.create_poll %}
@ -235,7 +235,7 @@
{% if motion.category %}
{{ motion.category }}
{% else %}
-
{% endif %}
<!-- Creation Time -->

View File

@ -23,8 +23,9 @@
<li>
{% trans 'Identifier, reason, submitter and category are optional and may be empty' %}.
</li>
<li>{% trans 'The first line (header) is ignored' %}.</li>
<li>
{% trans 'Required CSV file encoding: UTF-8.' %}
{% trans 'Required CSV file encoding is UTF-8' %}.
</li>
<li>
<a href="https://github.com/OpenSlides/OpenSlides/wiki/CSV-Import">{% trans 'Use the CSV example file from OpenSlides Wiki.' %}</a>

View File

@ -51,7 +51,7 @@
<tr class="{% if motion.active %}activeline{% endif %}">
<td class="nobr">{{ motion.identifier|default:'' }}</td>
<td><a href="{% model_url motion %}">{{ motion.title }}</a></td>
<td class="optional">{% if motion.category %}{{ motion.category }}{% else %}-{% endif %}</td>
<td class="optional">{% if motion.category %}{{ motion.category }}{% else %}{% endif %}</td>
<td><span class="label label-info">{% trans motion.state.name %}</span></td>
<td class="optional">
{% for submitter in motion.submitter.all %}

View File

@ -15,7 +15,7 @@
</a>
<a href="{% model_url motion %}">
{% if motion.identifier %}
[#{{ motion.identifier }}]
[# {{ motion.identifier }}]
{% else %}
[---]
{% endif %}

View File

@ -14,7 +14,7 @@
</p>
<!-- poll results -->
{% with motion.polls as polls %}
{% with motion.polls.all as polls %}
{% if polls.exists and polls.0.has_votes %}
<p><b>{% trans "Poll result" %}:</b>
{% for poll in polls %}

View File

@ -64,6 +64,8 @@ class GetVersionMixin(object):
object.version = int(version_number)
except MotionVersion.DoesNotExist:
raise Http404('Version %s not found' % version_number)
else:
object.version = object.get_last_not_rejected_version()
return object
@ -227,6 +229,9 @@ class MotionDeleteView(DeleteView):
"""Check if the request.user has the permission to delete the motion."""
return self.get_object().get_allowed_actions(request.user)['delete']
def get_success_message(self):
return _('%s was successfully deleted.') % _('Motion')
motion_delete = MotionDeleteView.as_view()
@ -279,7 +284,7 @@ class VersionRejectView(GetVersionMixin, SingleObjectMixin, QuestionMixin, Redir
model = Motion
question_url_name = 'motion_version_detail'
success_url_name = 'motion_version_detail'
success_url_name = 'motion_detail'
def get(self, *args, **kwargs):
"""
@ -307,6 +312,12 @@ class VersionRejectView(GetVersionMixin, SingleObjectMixin, QuestionMixin, Redir
message_list=[ugettext_noop('Version %d rejected') % self.object.version.version_number],
person=self.request.user)
def get_success_url_name_args(self):
"""
Returns the motion pk as argument for the success url name.
"""
return [self.object.pk]
version_reject = VersionRejectView.as_view()
@ -505,7 +516,7 @@ class PollDeleteView(PollMixin, DeleteView):
Write a log message, if the form is valid.
"""
super(PollDeleteView, self).case_yes()
self.object.write_log([ugettext_noop('Poll deleted')], self.request.user)
self.object.motion.write_log([ugettext_noop('Poll deleted')], self.request.user)
def get_redirect_url(self, **kwargs):
"""