Added new button in application view template to show agenda item of selected appliation (for manager only).

This commit is contained in:
Emanuel Schuetze 2011-11-01 14:35:58 +01:00
parent e64e91c52d
commit 6d7736d10d
6 changed files with 32 additions and 3 deletions

View File

@ -49,7 +49,7 @@ class ApplicationManagerForm(ModelForm):
users = User.objects.all().exclude(profile=None).order_by("first_name")
submitter = UserModelChoiceField(queryset=users, label=_("Submitter"))
supporter = UserModelMultipleChoiceField(queryset=users, label=_("Supporters"))
supporter = UserModelMultipleChoiceField(queryset=users, required=False, label=_("Supporters"))
class Meta:
model = Application

View File

@ -39,6 +39,7 @@ class Application(models.Model):
# support
# unsupport
# createitem
# activateitem
# genpoll
)
@ -355,8 +356,11 @@ class Application(models.Model):
actions.append("permitversion")
actions.append("rejectversion")
if self.number and not self.itemapplication_set.all():
actions.append("createitem")
if self.number:
if self.itemapplication_set.all():
actions.append("activateitem")
else:
actions.append("createitem")
return actions

View File

@ -161,6 +161,13 @@
</a>
{% endif %}
{% if "activateitem" in actions %}
<h4></h4>
<a href='{% url application_activate_item application.id %}'>
<button><span class="icon projector">{%trans 'Show agenda item' %}</span></button>
</a>
{% endif %}
{% if "acc" in actions or "rej" in actions %}
<h4>{% trans "Result after vote" %}:</h4>
{% if "acc" in actions %}

View File

@ -59,6 +59,9 @@ urlpatterns = patterns('application.views',
url(r'^application/(?P<application_id>\d+)/unsupport$', 'unsupport', \
name='application_unsupport'),
url(r'^application/(?P<application_id>\d+)/set_active/$', 'set_active',
name='application_activate_item'),
url(r'^application/(?P<application_id>\d+)/gen_poll$', 'gen_poll', \
name='application_gen_poll'),

View File

@ -16,6 +16,7 @@ from django.contrib.auth.decorators import login_required
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext as _
from openslides.agenda.models import Item
from openslides.application.models import Application, AVersion
from openslides.application.forms import ApplicationForm, \
ApplicationManagerForm
@ -318,6 +319,17 @@ def unsupport(request, application_id):
return redirect(reverse('application_view', args=[application_id]))
@permission_required('application.can_manage_application')
@template('application/view.html')
def set_active(request, application_id):
print application_id
item = Item.objects.get(itemapplication__application__id=application_id)
print item.id
item.set_active(False)
# if request.is_ajax():
# return ajax_request({'active': item.id})
return redirect(reverse('application_view', args=[application_id]))
@permission_required('application.can_manage_application')
@template('application/view.html')
def gen_poll(request, application_id):

View File

@ -368,6 +368,9 @@ button .undo{
button .item{
background:url(../images/icons/view-list-details.png) no-repeat 0px 0px;
}
button .projector{
background:url(../images/icons/video-projector.png) no-repeat 0px 0px;
}
button .accept{
background:url(../images/icons/task-complete.png) no-repeat 0px 0px;
}