Merge pull request #557 from ostcar/motion_template

Motion template
This commit is contained in:
Oskar Hahn 2013-03-11 10:38:44 -07:00
commit 73723feb74
13 changed files with 492 additions and 133 deletions

View File

@ -31,7 +31,7 @@
{% if perms.agenda.can_see_orga_items %} {% if perms.agenda.can_see_orga_items %}
<td> <td>
{% if item.duration %} {% if item.duration %}
{{ item.duration }}h <a {% if item.tooltip %}rel="tooltip" data-original-title="{% trans 'End' %}: {{ item.tooltip|date:"DATETIME_FORMAT" }}"{% endif %}><i class="icon-clock"></i></a> {{ item.duration }}h {% if start and end %}<a {% if item.tooltip %}rel="tooltip" data-original-title="{% trans 'End' %}: {{ item.tooltip|date:"DATETIME_FORMAT" }}"{% endif %}><i class="icon-clock"></i></a>{% endif %}
{% endif %} {% endif %}
</td> </td>
{% endif %} {% endif %}

View File

@ -55,7 +55,7 @@
<h1>{% trans "Agenda" %} <h1>{% trans "Agenda" %}
<small class="pull-right"> <small class="pull-right">
{% if perms.agenda.can_manage_agenda %} {% if perms.agenda.can_manage_agenda %}
<a href="{% url 'item_new' %}" class="btn btn-mini" rel="tooltip" data-original-title="{% trans 'New item' %}"><i class="icon-plus"></i> {% trans "New" %}</a> <a href="{% url 'item_new' %}" class="btn btn-mini btn-primary" rel="tooltip" data-original-title="{% trans 'New item' %}"><i class="icon-plus icon-white"></i> {% trans "New" %}</a>
{% endif %} {% endif %}
<a href="{% url 'print_agenda' %}" class="btn btn-mini" rel="tooltip" data-original-title="{% trans 'Print agenda as PDF' %}"><i class="icon-print"></i> PDF</a> <a href="{% url 'print_agenda' %}" class="btn btn-mini" rel="tooltip" data-original-title="{% trans 'Print agenda as PDF' %}"><i class="icon-print"></i> PDF</a>
</small> </small>

View File

@ -9,7 +9,7 @@
<h1>{% trans "Elections" %} <h1>{% trans "Elections" %}
<small class="pull-right"> <small class="pull-right">
{% if perms.assignment.can_manage_assignment %} {% if perms.assignment.can_manage_assignment %}
<a href="{% url 'assignment_new' %}" class="btn btn-mini" rel="tooltip" data-original-title="{% trans 'New election' %}"><i class="icon-plus"></i> {% trans "New" %}</a> <a href="{% url 'assignment_new' %}" class="btn btn-mini btn-primary" rel="tooltip" data-original-title="{% trans 'New election' %}"><i class="icon-plus icon-white"></i> {% trans "New" %}</a>
{% endif %} {% endif %}
{% if perms.assignment.can_see_assignment %} {% if perms.assignment.can_see_assignment %}
<a href="{% url 'print_assignment' %}" class="btn btn-mini" rel="tooltip" data-original-title="{% trans 'Print all elections as PDF' %}"><i class="icon-print"></i> PDF</a> <a href="{% url 'print_assignment' %}" class="btn btn-mini" rel="tooltip" data-original-title="{% trans 'Print all elections as PDF' %}"><i class="icon-print"></i> PDF</a>

View File

@ -19,6 +19,7 @@ from django.core.urlresolvers import reverse
from django.db import models from django.db import models
from django.db.models import Max from django.db.models import Max
from django.dispatch import receiver from django.dispatch import receiver
from django.utils import formats
from django.utils.translation import pgettext from django.utils.translation import pgettext
from django.utils.translation import ugettext_lazy, ugettext_noop, ugettext as _ from django.utils.translation import ugettext_lazy, ugettext_noop, ugettext as _
@ -101,7 +102,7 @@ class Motion(SlideMixin, models.Model):
and and
the config 'motion_create_new_version' is set to the config 'motion_create_new_version' is set to
'ALLWASY_CREATE_NEW_VERSION'. 'ALWAYS_CREATE_NEW_VERSION'.
""" """
if not self.state: if not self.state:
self.reset_state() self.reset_state()
@ -296,10 +297,20 @@ class Motion(SlideMixin, models.Model):
except IndexError: except IndexError:
return self.new_version return self.new_version
@property
def submitters(self):
return sorted([object.person for object in self.submitter.all()],
key=lambda person: person.sort_name)
def is_submitter(self, person): def is_submitter(self, person):
"""Return True, if person is a submitter of this motion. Else: False.""" """Return True, if person is a submitter of this motion. Else: False."""
self.submitter.filter(person=person).exists() self.submitter.filter(person=person).exists()
@property
def supporters(self):
return sorted([object.person for object in self.supporter.all()],
key=lambda person: person.sort_name)
def is_supporter(self, person): def is_supporter(self, person):
"""Return True, if person is a supporter of this motion. Else: False.""" """Return True, if person is a supporter of this motion. Else: False."""
return self.supporter.filter(person=person).exists() return self.supporter.filter(person=person).exists()
@ -379,13 +390,17 @@ class Motion(SlideMixin, models.Model):
'support': (self.state.allow_support and 'support': (self.state.allow_support and
config['motion_min_supporters'] > 0 and config['motion_min_supporters'] > 0 and
not self.is_submitter(person)), not self.is_submitter(person) and
not self.is_supporter(person)),
'unsupport': (self.state.allow_support and
not self.is_submitter(person) and
self.is_supporter(person)),
'change_state': person.has_perm('motion.can_manage_motion'), 'change_state': person.has_perm('motion.can_manage_motion'),
} }
actions['delete'] = actions['edit'] # TODO: Only if the motion has no number actions['delete'] = actions['edit'] # TODO: Only if the motion has no number
actions['unsupport'] = actions['support']
actions['reset_state'] = actions['change_state'] actions['reset_state'] = actions['change_state']
return actions return actions
@ -394,7 +409,7 @@ class Motion(SlideMixin, models.Model):
Message should be in english and translatable. Message should be in english and translatable.
e.G: motion.write_log(ugettext_noob('Message Text')) e.g.: motion.write_log(ugettext_noob('Message Text'))
""" """
MotionLog.objects.create(motion=self, message=message, person=person) MotionLog.objects.create(motion=self, message=message, person=person)
@ -546,11 +561,11 @@ class MotionLog(models.Model):
def __unicode__(self): def __unicode__(self):
"""Return a string, representing the log message.""" """Return a string, representing the log message."""
# TODO: write time in the local time format. time = formats.date_format(self.time, 'DATETIME_FORMAT')
if self.person is None: if self.person is None:
return "%s %s" % (self.time, _(self.message)) return "%s %s" % (time, _(self.message))
else: else:
return "%s %s by %s" % (self.time, _(self.message), self.person) return "%s %s by %s" % (time, _(self.message), self.person)
class MotionVote(BaseVote): class MotionVote(BaseVote):

View File

@ -4,26 +4,141 @@
{% load i18n %} {% load i18n %}
{% load staticfiles %} {% load staticfiles %}
{% block title %}{{ block.super }} {% trans "Motion" %} "{{ motion.title }}"{% endblock %} {% block title %}{{ block.super }} {% trans "Motion" %} {{ motion.number }}{% endblock %}
{% block content %} {% block content %}
<p>Titel: {{ motion.title }} </p> <h1>
<p>Text: {{ motion.text }}</p> {{ motion.title }}
<p>Reason: {{ motion.reason }}</p> <br>
<p>Submitter: {% for submitter in motion.submitter.all %}{{ submitter.person }} {% endfor %}</p> <small>
<p>Supporter: {% for supporter in motion.supporter.all %}{{ supporter.person }} {% endfor %}</p> {% if motion.number != None %}
<p>Active Version: {{ motion.active_version }}</p> {% trans "Motion" %} {{ motion.number }},
<p>State: {{ motion.state }}</p> {% else %}
<h4>possible stats:</h4> <i>[{% trans "no number" %}]</i>,
<ul> {% endif %}
{% for state in motion.state.next_states.all %} {% trans "Version" %} {{ motion.version.version_number }}
<li><a href="{% url 'motion_set_state' motion.pk state.pk %}">{{ state }}</a></li> </small>
{% endfor %} <small class="pull-right">
<li><a href="{% url 'motion_reset_state' motion.pk %}">Reset State</a></li> <div class="btn-toolbar">
<a href="{% url 'motion_list' %}" class="btn btn-mini"><i class="icon-chevron-left"></i> {% trans "Back to overview" %}</a>
<a href="{% url 'motion_detail_pdf' motion.id %}" class="btn btn-mini" rel="tooltip" data-original-title="{% trans 'Print this motion as PDF' %}"><i class="icon-print"></i> PDF</a>
<!-- activate projector -->
{% if perms.projector.can_manage_projector %}
<a href="{% url 'projector_activate_slide' motion.sid %}" class="activate_link btn {% if motion.active %}btn-primary{% endif %} btn-mini" rel="tooltip" data-original-title="{% trans 'Show motion' %}">
<i class="icon-facetime-video {% if motion.active %}icon-white{% endif %}"></i>
</a>
{% endif %}
<div class="btn-group">
<a data-toggle="dropdown" href="#" class="btn btn-mini dropdown-toggle">
{% trans 'More actions' %}
<span class="caret"></span>
</a>
<ul class="dropdown-menu pull-right">
<!-- edit -->
{% if allowed_actions.edit %}
<li><a href="{% model_url motion 'edit' %}"><i class="icon-pencil"></i> {% trans 'Edit motion' %}</a></li>
{% endif %}
<!-- delete -->
{% if allowed_actions.delete %}
<li><a href="{% model_url motion 'delete' %}"><i class="icon-remove"></i> {% trans 'Delete motion' %}</a></li>
{% endif %}
<!-- create agenda item -->
{% if perms.agenda.can_manage_agenda %}
<li>
<a href="{% url 'motion_create_agenda' motion.id %}"><i class="icon-plus"></i> {% trans 'New agenda item' %}</a>
</li>
{% endif %}
</ul> </ul>
</div>
</div>
</small>
</h1>
<div class="row-fluid">
<div class="span8">
{% if motion.active_version.id != motion.version.id %}
<span class="label label-warning"><i class="icon-warning-sign icon-white"></i>
{% if motion.version == motion.public_version %}
{% trans "This is not the newest version." %}</span> <a href="{% url 'motion_version_detail' motion.id motion.last_version.id %}">{% trans "Go to version" %} {{ motion.last_version.version_number }}.</a>
{% else %}
{% trans "This is not the authorized version." %}</span> <a href="{% url 'motion_view' motion.id %}">{% trans "Go to version" %} {{ motion.public_version.aid }}.</a>
{% endif %}
{% endif %}
<h4>Versions</h4> <!-- Text -->
<h4>{% trans "Motion text" %}:</h4>
{{ motion.version.text|linebreaks }}
<br>
<!-- Reason -->
<h4>{% trans "Reason" %}:</h4>
{% if motion.version.reason %}
{{ motion.version.reason|linebreaks }}
{% else %}
{% endif %}
<br>
<!-- Version history -->
{% for version in motion.versions.all %}
{% if forloop.first %}
<h4>{% trans "Version history" %}:</h4>
<table class="table table-striped table-bordered">
<tr>
<th></th>
<th>{% trans "Version" %}</th>
<th>{% trans "Time" %}</th>
<th>{% trans "Title" %}</th>
<th>{% trans "Text" %}</th>
<th>{% trans "Reason" %}</th>
</tr>
{% endif %}
<tr>
<td class="nobr">
{% if version == motion.active_version %}
<span class="badge badge-success" title="{% trans 'This version is authorized' %}"><i class="icon-ok icon-white"></i></span>
{% else %}
{% if perms.motion.can_manage_motion %}
<a class="btn btn-mini" href="{% url 'motion_version_permit' motion.id version.id %}" title="{% trans 'Permit this version' %}"><i class="icon-ok"></i></a>
{% endif %}
{% if not version.rejected and version.id > motion.active_version.id and perms.motion.can_manage_motion %}
<a class="btn btn-mini" href="{% url 'motion_version_reject' version.id %}" title="{% trans 'Reject this version' %}"><i class="icon-ban-circle"></i></a>
{% endif %}
{% endif %}
{% if version.rejected %}
<span class="badge badge-important" title="{% trans 'This version is rejected' %}"><i class="icon-ban-circle icon-white"></i></span>
{% endif %}
</td>
<td><a href="{% model_url version %}">{{ version.version_number }}</a></td>
<td><i>{{ version.creation_time }}</i></td>
<td>
{% ifchanged %}
<b>{{ version.title }}</b>
{% else %}
<i>[{% trans "unchanged" %}]</i>
{% endifchanged %}
</td>
<td>
{% ifchanged %}
{{ version.text|linebreaks }}
{% else %}
<i>[{% trans "unchanged" %}]</i>
{% endifchanged %}
</td>
<td>
{% ifchanged %}
{{ version.reason|linebreaks }}
{% else %}
<i>[{% trans "unchanged" %}]</i>
{% endifchanged %}
</td>
</tr>
{% if forloop.last %}
</table>
{% endif %}
{% endfor %}
<!-- TODO: For testing -->
<ol> <ol>
{% for motion_version in motion.versions.all %} {% for motion_version in motion.versions.all %}
<li> <li>
@ -41,60 +156,152 @@
</li> </li>
{% endfor %} {% endfor %}
</ol> </ol>
<!-- End TODO -->
<h4>{% trans "Vote results" %}:</h4> <!-- Log -->
{% if perms.motion.can_manage_motion %}
<button type="button" class="btn" data-toggle="collapse" data-target="#log">
{% trans "Show log" %}
</button>
<div id="log" class="collapse out">
<ul class="unstyled">
{% for message in motion.log_messages.all %}
<li><small>{{ message }}</small></li>
{% endfor %}
</ul>
</div>
{% endif %}
</div> <!--/span-->
<!-- Box with meta information -->
<div class="span4">
<div class="well">
<!-- Submitter -->
<h5>{% trans "Submitter" %}:</h5>
{% for submitter in motion.submitter.all %}
{{ submitter.person }}{% if not forloop.last %}, {% endif %}
{% endfor %}
<!-- Supporters -->
{% if min_supporters > 0 %}
<h5>{% trans "Supporters" %}: *</h5>
{% if not motion.supporters %}
-
{% else %}
<ol>
{% for supporter in motion.supporter.all %}
<li>{{ supporter }}</li>
{% endfor %}
</ol>
{% endif %}
{% endif %}
<!-- Status -->
<h5>{% trans "Status" %}:</h5>
{% if motion.state_id != "pub" %}
{# TODO: trans motion.state #}
<span class="label label-info">{{ motion.state }}</span>
<br>
{% endif %}
{% for note in motion.notes %}
{{ note }}
{% if not forloop.last %}<br>{% endif %}
{% endfor %}
<!-- Vote results -->
<h5>{% trans "Vote results" %}:</h5>
{% with motion.polls.all as polls %} {% with motion.polls.all as polls %}
<ul class="results"> <ol>
{% for poll in polls %} {% for poll in polls %}
{% if perms.motion.can_manage_motion or poll.has_votes %} {% if perms.motion.can_manage_motion or poll.has_votes %}
<li> <li>{% trans "Vote" %}
{% if perms.motion.can_manage_motion %} {% if perms.motion.can_manage_motion %}
<strong>{{ forloop.counter }}. {% trans "Vote" %} </strong> <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="icon edit" href="{% model_url poll 'edit' %}" title="{% trans 'Edit Vote' %}"> <a class="btn btn-mini" href="{% url 'motion_poll_delete' motion.id poll.id %}" title="{% trans 'Delete Vote' %}"><i class="icon-remove"></i></a>
<span></span>
</a>
<a class="icon delete" href="{% model_url poll 'delete' %}" title="{% trans 'Delete Vote' %}">
<span></span>
</a>
{% elif poll.has_votes %}
<strong>{{ forloop.counter }}. {% trans "Vote" %}:</strong>
{% endif %} {% endif %}
<br> <br>
{% if poll.has_votes %} {% if poll.has_votes %}
{% with poll.get_options.0 as option %} {% with poll.get_options.0 as option %}
<img src="{% static 'images/icons/voting-yes.png' %}" title="{% trans 'Yes' %}"> {{ option.Yes }}<br> <img src="{% static 'img/voting-yes.png' %}" title="{% trans 'Yes' %}"> {{ option.Yes }}<br>
<img src="{% static 'images/icons/voting-no.png' %}" title="{% trans 'No' %}"> {{ option.No }}<br> <img src="{% static 'img/voting-no.png' %}" title="{% trans 'No' %}"> {{ option.No }}<br>
<img src="{% static 'images/icons/voting-abstention.png' %}" title="{% trans 'Abstention' %}"> {{ option.Abstain }}<br> <img src="{% static 'img/voting-abstention.png' %}" title="{% trans 'Abstention' %}"> {{ option.Abstain }}<br>
<img src="{% static 'images/icons/voting-invalid.png' %}" title="{% trans 'Invalid' %}"> {{ poll.print_votesinvalid }}<br> <img src="{% static 'img/voting-invalid.png' %}" title="{% trans 'Invalid' %}"> {{ poll.print_votesinvalid }}<br>
<div style="border-top: 1px solid; padding-top: 5px; margin: 5px 0; width: 10em;"> <div style="border-top: 1px solid; padding-top: 5px; margin: 5px 0; width: 10em;">
<img src="{% static 'images/icons/voting-total.png' %}" title="{% trans 'Votes cast' %}"> {{ poll.print_votescast }} <img src="{% static 'img/voting-total.png' %}" title="{% trans 'Votes cast' %}"> {{ poll.print_votescast }}
</div> </div>
{% endwith %} {% endwith %}
{% else %} {% else %}
{% if perms.motion.can_manage_motion %} {% if perms.motion.can_manage_motion %}
<a href="{% model_url poll %}"> <span class="label label-info">{% trans 'No results' %}</span>
<span class="button"><span class="icon statistics">{% trans 'Enter result' %}</span></span>
</a>
{% endif %} {% endif %}
{% endif %} {% endif %}
</li> </li>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
</ul> </ol>
{% if allowed_actions.create_poll %} {% if allowed_actions.create_poll %}
<a href="{% url 'motion_poll_create' motion.pk %}"> <a href="{% url 'motion_poll_create' motion.id %}" class="btn btn-mini">
<span class="button"><span class="icon statistics">{% trans 'New vote' %}</span></span> <i class="icon-assignment"></i> {% trans 'New vote' %}
</a> </a>
{% endif %} {% endif %}
{% endwith %} {% endwith %}
<!-- Creation Time -->
<h5>{% trans "Creation Time" %}:</h5>
{# TODO: use creation time of _first_ version #}
{{ motion.version.creation_time }}
<h4>log</h4> <!-- Widthdraw button -->
<ul> {% if allowed_actions.wit and user in motion.submitters %}
{% for message in motion.log_messages.all %} <br><br>
<li>{{ message }}</li> <a href="{% url 'motion_set_state' motion.id 'wit' %}" class="btn">
<span class="icon revert">{% trans 'Withdraw motion' %}</span>
</a>
{% endif %}
<!-- Support/Unsupport button -->
{% if perms.motion.can_support_motion and min_supporters > 0 %}
{% if allowed_actions.unsupport %}
<br><br>
<a href="{% url 'motion_unsupport' motion.id %}" class="btn">
{% trans 'Unsupport' %}
</a>
{% endif %}
{% if allowed_actions.support %}
<br><br>
<a href="{% url 'motion_support' motion.id %}" class="btn">
{% trans 'Support' %}
</a>
{% endif %}
{% endif %}
<!-- Footnote: requried supporters -->
{% if min_supporters > 0 %}
<br><br>
<small>* {% trans "minimum required supporters" %}: {{ min_supporters }}</small>
{% endif %}
</div> <!--/well-->
{% if perms.motion.can_manage_motion %}
<!-- Manage motion box -->
<div class="well">
<h4>{% trans "Manage motion" %}</h4>
<div class="btn-group">
{% for state in motion.state.next_states.all %}
<a href="{% url 'motion_set_state' motion.pk state.pk %}" class="btn btn-small">{{ state }}</a>
{% endfor %} {% endfor %}
</ul> </div>
<p></p>
<hr>
<h5>{% trans "For administration only:" %}</h5>
<a href="{% url 'motion_reset_state' motion.id %}" class="btn btn-danger">
<i class="icon-exclamation-sign icon-white"></i> {% trans 'Reset state' %}
</a>
</div> <!--/well-->
{% endif %}
</div> <!--/span-->
</div> <!--/row-->
{% endblock %} {% endblock %}

View File

@ -2,25 +2,35 @@
{% load tags %} {% load tags %}
{% load i18n %} {% load i18n %}
{% load staticfiles %}
{% block title %}{{ block.super }} {% trans "Motion Form" %}{% endblock %} {% block title %}
{{ block.super }}
{% if motion %}
{% trans "Edit motion" %}
{% else %}
{% trans "New motion" %}
{% endif %}
{% endblock %}
{% block content %} {% block content %}
<h1>{% trans "Motions Forms" %}</h1> <h1>
{% if motion %}
{% trans "Edit motion" %}
{% else %}
{% trans "New motion" %}
{% endif %}
<small class="pull-right">
<a href="{% url 'motion_list' %}" class="btn btn-mini"><i class="icon-chevron-left"></i> {% trans "Back to overview" %}</a>
</small>
</h1>
<form action="" method="post">{% csrf_token %} <form action="" method="post">{% csrf_token %}
{{ form.as_p }} {% include "form.html" %}
<button class="button" type="submit"> <p>
<span class="icon ok">{% trans 'Save' %}</span> {% include "formbuttons_saveapply.html" %}
</button> <a href='{% url 'motion_list' %}' class="btn">
<button class="button" type="submit" name="apply"> {% trans 'Cancel' %}
<span class="icon apply">{% trans 'Apply' %}</span>
</button>
<a href="{% url 'motion_list' %}">
<button class="button" type="button" onclick="window.location='{% url 'motion_list' %}'">
<span class="icon cancel">{% trans 'Cancel' %}</span>
</button>
</a> </a>
</p>
<small>* {% trans "required" %}</small> <small>* {% trans "required" %}</small>
</form> </form>
{% endblock %} {% endblock %}

View File

@ -2,15 +2,104 @@
{% load tags %} {% load tags %}
{% load i18n %} {% load i18n %}
{% load staticfiles %}
{% block title %}{{ block.super }} {% trans "Motions" %}{% endblock %} {% block title %}{{ block.super }} {% trans "Motions" %}{% endblock %}
{% block content %} {% block content %}
<h1>{% trans "Motions" %}</h1> <h1>
<ol> {% trans "Motions" %}
<small class="pull-right">
{% if perms.motion.can_create_motion %}
<a href="{% url 'motion_new' %}" class="btn btn-mini btn-primary" rel="tooltip" data-original-title="{% trans 'New motion' %}"><i class="icon-plus icon-white"></i> {% trans "New" %}</a>
{% endif %}
{% if perms.motion.can_manage_motion %}
{# <a href="{% url 'motion_import' %}" class="btn btn-mini" rel="tooltip" data-original-title="{% trans 'Import motions' %}"><i class="icon-import"></i> {% trans 'Import' %}</a>#}
{% endif %}
<a href="{% url 'motion_list_pdf' %}" class="btn btn-mini" rel="tooltip" data-original-title="{% trans 'Print all motions as PDF' %}"><i class="icon-print"></i> PDF</a>
</small>
</h1>
<form action="{{ request.url }}" name="filter" method="get" class="form-inline">
{% if min_supporters > 0 %}
<label class="checkbox">
<input type="checkbox" name="needsup" onchange="document.forms['filter'].submit()"
{% if 'on' in request.GET.needsup %}checked{% endif %}> {% trans "Need supporters" %} &nbsp;
</label>
{% endif %}
<label class="checkbox">
<input type="checkbox" name="number" onchange="document.forms['filter'].submit()"
{% if 'on' in request.GET.number %}checked{% endif %}> {% trans "Without number" %} &nbsp;
</label>
<label class="checkbox">
<input type="checkbox" name="status" onchange="document.forms['filter'].submit()"
{% if 'on' in request.GET.status %}checked{% endif %}> {% trans "Status" %}:
</label>
<select class="default-input" name="statusvalue" onchange="{% if 'on' in request.GET.status %}document.forms['filter'].submit(){% endif %}">
<option value="pub" {% if 'pub' in request.GET.statusvalue %}selected{% endif %}>{% trans "Not yet authorized" %}</option>
<option value="per" {% if 'on' in request.GET.status and 'per' in request.GET.statusvalue %}selected{% endif %}>{% trans "Authorized" %}</option>
<option value="acc" {% if 'on' in request.GET.status and 'acc' in request.GET.statusvalue %}selected{% endif %}>{% trans "Accepted" %}</option>
<option value="rej" {% if 'on' in request.GET.status and 'rej' in request.GET.statusvalue %}selected{% endif %}>{% trans "Rejected" %}</option>
<option value="wit" {% if 'on' in request.GET.status and 'wit' in request.GET.statusvalue %}selected{% endif %}>{% trans "Withdrawen (by submitter)" %}</option>
<option value="rev" {% if 'rev' in request.GET.statusvalue %}selected{% endif %}>{% trans "Needs Review" %}</option>
</select>
</form>
<small><i>{{ motion_list|length }}
{% blocktrans count counter=motion_list|length context "number of motions"%}motion{% plural %}motions{% endblocktrans %}
</i></small>
<table class="table table-striped table-bordered">
<tr>
<th><a href="?sort=number{% if 'number' in request.GET.sort and 'reverse' not in request.GET %}&reverse{%endif%}">{% trans "#" %}</a></th>
<th><a href="?sort=title{% if 'title' in request.GET.sort and 'reverse' not in request.GET %}&reverse{%endif%}">{% trans "Motion title" %}</a></th>
{% if min_supporters > 0 %}
<th class="optional"><a href="?sort=supporter{% if 'supporter' in request.GET.sort and 'reverse' not in request.GET %}&reverse{%endif%}">{% trans "Number of supporters" %}</a></th>
{% endif %}
<th><a href="?sort=status{% if 'status' in request.GET.sort and 'reverse' not in request.GET %}&reverse{%endif%}">{% trans "Status" %}</a></th>
<th class="optional"><a href="?sort=submitter{% if 'submitter' in request.GET.sort and 'reverse' not in request.GET %}&reverse{%endif%}">{% trans "Submitter" %}</a></th>
<th class="optional"><a href="?sort=time{% if 'time' in request.GET.sort and 'reverse' not in request.GET %}&reverse{%endif%}">{% trans "Creation Time" %}<a></th>
<th class="mini_width">{% trans "Actions" %}</th>
</tr>
{% for motion in motion_list %} {% for motion in motion_list %}
<li><a href="{% model_url motion %}">{{ motion }}</a></li> <tr class="{% if motion.active %}activeline{% endif %}">
<td>{{ motion.number }}</td>
<td><a href="{% model_url motion %}">{{ motion.title }}</a></td>
{% if min_supporters > 0 %}
<td class="optional">{# motion.count_supporters #}</td>
{% endif %}
<td><span class="label label-info">{{ motion.state }}</span></td>
<td class="optional">
{% for submitter in motion.submitter.all %}
{{ submitter.person }}{% if not forloop.last %}, {% endif %}
{% endfor %} {% endfor %}
</ol> </td>
{# TODO: user creation_time of _first_ version #}
<td class="optional">{{ motion.version.creation_time }}</td>
<td>
<span style="width: 1px; white-space: nowrap;">
{% if perms.projector.can_manage_projector %}
<a href="{% url 'projector_activate_slide' motion.sid %}" class="activate_link btn {% if motion.active %}btn-primary{% endif %} btn-mini" title="{% trans 'Show' %}">
<i class="icon-facetime-video {% if motion.active %}icon-white{% endif %}"></i>
</a>
{% endif %}
{% if perms.motion.can_manage_motion %}
<a href="{% model_url motion 'edit' %}" title="{% trans 'Edit' %}" class="btn btn-mini">
<i class="icon-pencil"></i>
</a>
{% if "delete" in useractions %}
<a href="{% model_url motion 'delete' %}" title="{% trans 'Delete' %}" class="btn btn-mini">
<i class="icon-remove"></i>
</a>
{% endif %}
{% endif %}
<a href="{% url 'motion_detail_pdf' motion.id %}" class="btn btn-mini" title="{% trans 'Print motion as PDF' %}">
<i class="icon-print"></i> PDF
</a>
</span>
</td>
</tr>
{% empty %}
<tr>
<td colspan="7"><i>{% trans "No motions available." %}</i></td>
</tr>
{% endfor %}
</table>
{% endblock %} {% endblock %}

View File

@ -1,16 +1,38 @@
{% extends 'base.html' %} {% extends 'base.html' %}
{% load i18n %} {% load i18n %}
{% load staticfiles %}
{% load tags %} {% block title %}
{{ block.super }} - {% trans "Motion" %} {{ motion.number }}, {{ ballot }}. {% trans "Vote" %}
{% endblock %}
{% block content %} {% block content %}
<h1>{{ motion }}</h1> <h1>
<i class="helptext">{% trans "Special values" %}: -1 = {% trans 'majority' %}; -2 = {% trans 'undocumented' %}</i> {{ motion }}
<br>
<small>
{% trans "Motion" %} {{ motion.number }}, {{ ballot }}. {% trans "Vote" %}
</small>
<small class="pull-right">
<div class="btn-toolbar">
<a href="{% url 'motion_detail' motion.id %}" class="btn btn-mini"><i class="icon-chevron-left"></i> {% trans "Back to motion" %}</a>
<!-- activate projector -->
{% if perms.projector.can_manage_projector %}
<a href="{% url 'projector_activate_slide' motion.sid %}" class="activate_link btn {% if motion.active %}btn-primary{% endif %} btn-mini" rel="tooltip" data-original-title="{% trans 'Show motion' %}">
<i class="icon-facetime-video {% if motion.active %}icon-white{% endif %}"></i>
</a>
{% endif %}
</div>
</small>
</h1>
<p>
{% trans "Special values" %}: <span class="badge badge-success">-1</span> = {% trans 'majority' %} | <span class="badge">-2</span> = {% trans 'undocumented' %}
</p>
<form action="" method="post" class="small-form">{% csrf_token %} <form action="" method="post" class="small-form">{% csrf_token %}
{{ pre_form }} {{ pre_form }}
<span id="poll_id" style="display:none">{{ object.pk }}</span> <span id="poll_id" style="display:none">{{ object.pk }}</span>
<table class="table" style="width: auto;"> <table class="table table-striped table-bordered" style="width: auto;">
<tr> <tr>
<th>{% trans "Option" %}</th> <th>{% trans "Option" %}</th>
<th>{% trans "Votes" %}</th> <th>{% trans "Votes" %}</th>
@ -33,16 +55,24 @@
{{ post_form }} {{ post_form }}
<!-- ballot paper button -->
<p> <p>
<button class="button" type="submit"> {# TODO: create ballot paper instead of motion_detail_pdf ! #}
<span class="icon ok">{% trans 'Save' %}</span> <a href="{% url 'motion_detail_pdf' motion.id %}" class="btn">
</button> <i class="icon-print"></i> {% trans 'Ballot paper as PDF' %}
<button class="button" type="submit" name="apply">
<span class="icon apply">{% trans 'Apply' %}</span>
</button>
<a href="{% model_url motion %}">
<span class="icon cancel">{% trans 'Cancel' %}</span>
</a> </a>
</p> </p>
<!-- Control buttons -->
<div class="control-group">
<button type="submit" class="btn btn-primary">
{% trans 'Save' %}
</button>
<button type="submit" name="apply" class="btn">
{% trans 'Apply' %}
</button>
<a href="{% url 'motion_detail' motion.id %}" class="btn">
{% trans 'Cancel' %}
</a>
</div>
</form> </form>
{% endblock %} {% endblock %}

View File

@ -74,6 +74,7 @@ class MotionDetailView(GetVersionMixin, DetailView):
""" """
context = super(MotionDetailView, self).get_context_data(**kwargs) context = super(MotionDetailView, self).get_context_data(**kwargs)
context['allowed_actions'] = self.object.get_allowed_actions(self.request.user) context['allowed_actions'] = self.object.get_allowed_actions(self.request.user)
context['min_supporters'] = int(config['motion_min_supporters'])
return context return context
motion_detail = MotionDetailView.as_view() motion_detail = MotionDetailView.as_view()
@ -246,7 +247,6 @@ class SupportView(SingleObjectMixin, QuestionMixin, RedirectView):
def check_permission(self, request): def check_permission(self, request):
"""Return True if the user can support or unsupport the motion. Else: False.""" """Return True if the user can support or unsupport the motion. Else: False."""
allowed_actions = self.object.get_allowed_actions(request.user) allowed_actions = self.object.get_allowed_actions(request.user)
if self.support and not allowed_actions['support']: if self.support and not allowed_actions['support']:
messages.error(request, _('You can not support this motion.')) messages.error(request, _('You can not support this motion.'))
@ -373,6 +373,10 @@ class PollDeleteView(PollMixin, DeleteView):
super(PollDeleteView, self).case_yes() super(PollDeleteView, self).case_yes()
self.object.write_log(ugettext_noop('Poll deleted'), self.request.user) self.object.write_log(ugettext_noop('Poll deleted'), self.request.user)
def get_redirect_url(self, **kwargs):
"""Return the URL to the DetailView of the motion."""
return reverse('motion_detail', args=[self.object.motion.pk])
poll_delete = PollDeleteView.as_view() poll_delete = PollDeleteView.as_view()

View File

@ -8,7 +8,7 @@
{% block content %} {% block content %}
<h1>{% trans "Groups" %} <h1>{% trans "Groups" %}
<small class="pull-right"> <small class="pull-right">
<a href="{% url 'user_group_new' %}" class="btn btn-mini" rel="tooltip" data-original-title="{% trans 'New group' %}"><i class="icon-plus"></i> {% trans "New" %}</a> <a href="{% url 'user_group_new' %}" class="btn btn-mini btn-primary" rel="tooltip" data-original-title="{% trans 'New group' %}"><i class="icon-plus icon-white"></i> {% trans "New" %}</a>
<a href="{% url 'user_overview' %}" class="btn btn-mini"><i class="icon-chevron-left"></i> {% trans "Back to participants overview" %}</a> <a href="{% url 'user_overview' %}" class="btn btn-mini"><i class="icon-chevron-left"></i> {% trans "Back to participants overview" %}</a>
</small> </small>
</h1> </h1>

View File

@ -20,7 +20,7 @@
{% trans 'Required CSV file encoding: UTF-8 (Unicode).' %} {% trans 'Required CSV file encoding: UTF-8 (Unicode).' %}
</p> </p>
<p><a href="http://dev.openslides.org/wiki/CSVImport" target="_blank">{% trans 'A CSV example file is available in OpenSlides Wiki.' %}</a> <p><a href="https://github.com/OpenSlides/OpenSlides/wiki/CSV-Import" target="_blank">{% trans 'A CSV example file is available in OpenSlides Wiki.' %}</a>
</p> </p>
<form enctype="multipart/form-data" action="" method="post">{% csrf_token %} <form enctype="multipart/form-data" action="" method="post">{% csrf_token %}

View File

@ -17,7 +17,7 @@
<small class="pull-right"> <small class="pull-right">
<div class="btn-toolbar"> <div class="btn-toolbar">
{% if perms.participant.can_manage_participant %} {% if perms.participant.can_manage_participant %}
<a href="{% url 'user_new' %}" class="btn btn-mini" rel="tooltip" data-original-title="{% trans 'New participant' %}"><i class="icon-plus"></i> {% trans "New" %}</a> <a href="{% url 'user_new' %}" class="btn btn-mini btn-primary" rel="tooltip" data-original-title="{% trans 'New participant' %}"><i class="icon-plus icon-white"></i> {% trans "New" %}</a>
<a href="{% url 'user_group_overview' %}" class="btn btn-mini" rel="tooltip" data-original-title="{% trans 'All groups' %}"><i class="icon-group"></i> {% trans "Groups" %}</a> <a href="{% url 'user_group_overview' %}" class="btn btn-mini" rel="tooltip" data-original-title="{% trans 'All groups' %}"><i class="icon-group"></i> {% trans "Groups" %}</a>
<a href="{% url 'user_import' %}" class="btn btn-mini" rel="tooltip" data-original-title="{% trans 'Import participants' %}"><i class="icon-import"></i> {% trans 'Import' %}</a> <a href="{% url 'user_import' %}" class="btn btn-mini" rel="tooltip" data-original-title="{% trans 'Import participants' %}"><i class="icon-import"></i> {% trans 'Import' %}</a>
{% endif %} {% endif %}

View File

@ -80,6 +80,10 @@ a:hover {
padding: 8px 5px 4px 5px; padding: 8px 5px 4px 5px;
} }
/* Log */
#log {
padding-left: 14px;
}
/** Utils **/ /** Utils **/
tr.offline td, li.offline { tr.offline td, li.offline {