some minor bug fixes
This commit is contained in:
parent
1e7d420485
commit
4e16c6639b
@ -19,30 +19,30 @@ urlpatterns = patterns('agenda.views',
|
||||
name='item_overview',
|
||||
),
|
||||
|
||||
url(r'^(?P<item_id>\d+)/$',
|
||||
url(r'^(?P<pk>\d+)/$',
|
||||
View.as_view(),
|
||||
name='item_view',
|
||||
),
|
||||
|
||||
url(r'^(?P<item_id>\d+)/activate/$',
|
||||
url(r'^(?P<pk>\d+)/activate/$',
|
||||
SetActive.as_view(),
|
||||
{'summary': False},
|
||||
name='item_activate',
|
||||
),
|
||||
|
||||
url(r'^(?P<item_id>\d+)/activate/summary/$',
|
||||
url(r'^(?P<pk>\d+)/activate/summary/$',
|
||||
SetActive.as_view(),
|
||||
{'summary': True},
|
||||
name='item_activate_summary',
|
||||
),
|
||||
|
||||
url(r'^(?P<item_id>\d+)/close/$',
|
||||
url(r'^(?P<pk>\d+)/close/$',
|
||||
SetClosed.as_view(),
|
||||
{'closed': True},
|
||||
name='item_close',
|
||||
),
|
||||
|
||||
url(r'^(?P<item_id>\d+)/open/$',
|
||||
url(r'^(?P<pk>\d+)/open/$',
|
||||
SetClosed.as_view(),
|
||||
{'closed': False},
|
||||
name='item_open',
|
||||
|
@ -13,6 +13,7 @@ from django.core.urlresolvers import reverse
|
||||
from django.contrib import messages
|
||||
from django.utils.translation import ugettext as _
|
||||
from django.core.context_processors import csrf
|
||||
from django.views.generic.detail import SingleObjectMixin
|
||||
|
||||
from utils.pdf import print_agenda
|
||||
from utils.views import TemplateView, RedirectView, UpdateView, CreateView, DeleteView
|
||||
@ -70,53 +71,51 @@ class Overview(TemplateView):
|
||||
return self.render_to_response(context)
|
||||
|
||||
|
||||
class SetActive(RedirectView):
|
||||
class SetActive(RedirectView, SingleObjectMixin):
|
||||
"""
|
||||
Set an Item as the active one.
|
||||
"""
|
||||
url = 'item_overview'
|
||||
allow_ajax = True
|
||||
permission_required = 'agenda.can_manage_agenda'
|
||||
model = Item
|
||||
|
||||
def get_ajax_context(self, **kwargs):
|
||||
context = super(SetActive, self).get_ajax_context(**kwargs)
|
||||
context.update({
|
||||
'active': kwargs['item_id'],
|
||||
'active': kwargs['pk'],
|
||||
'summary': is_summary(),
|
||||
})
|
||||
return context
|
||||
|
||||
def pre_redirect(self, request, *args, **kwargs):
|
||||
item_id = kwargs['item_id']
|
||||
summary = kwargs['summary']
|
||||
if item_id == "0":
|
||||
if kwargs['pk'] == "0":
|
||||
set_active_slide("agenda_show")
|
||||
else:
|
||||
try:
|
||||
item = Item.objects.get(pk=item_id)
|
||||
item.set_active(summary)
|
||||
except Item.DoesNotExist:
|
||||
messages.error(request, _('Item ID %d does not exist.') % int(item_id))
|
||||
self.object = self.get_object()
|
||||
self.object.set_active(summary)
|
||||
config["bigger"] = 100
|
||||
config["up"] = 0
|
||||
return super(SetActive, self).pre_redirect(request, *args, **kwargs)
|
||||
|
||||
|
||||
class SetClosed(RedirectView):
|
||||
class SetClosed(RedirectView, SingleObjectMixin):
|
||||
"""
|
||||
Close or open an Item.
|
||||
"""
|
||||
permission_required = 'agenda.can_manage_agenda'
|
||||
allow_ajax = True
|
||||
url = 'item_overview'
|
||||
model = Item
|
||||
|
||||
def get_ajax_context(self, **kwargs):
|
||||
context = super(SetClosed, self).get_ajax_context(**kwargs)
|
||||
closed = kwargs['closed']
|
||||
if closed:
|
||||
link = reverse('item_open', args=[self.item.id])
|
||||
link = reverse('item_open', args=[self.object.id])
|
||||
else:
|
||||
link = reverse('item_close', args=[self.item.id])
|
||||
link = reverse('item_close', args=[self.object.id])
|
||||
context.update({
|
||||
'closed': kwargs['closed'],
|
||||
'link': link,
|
||||
@ -124,14 +123,9 @@ class SetClosed(RedirectView):
|
||||
return context
|
||||
|
||||
def pre_redirect(self, request, *args, **kwargs):
|
||||
item_id = kwargs['item_id']
|
||||
self.object = self.get_object()
|
||||
closed = kwargs['closed']
|
||||
try:
|
||||
item = Item.objects.get(pk=item_id)
|
||||
item.set_closed(closed)
|
||||
except Item.DoesNotExist:
|
||||
messages.error(request, _('Item ID %d does not exist.') % int(item_id))
|
||||
self.item = item
|
||||
self.object.set_closed(closed)
|
||||
return super(SetClosed, self).pre_redirect(request, *args, **kwargs)
|
||||
|
||||
|
||||
|
@ -34,6 +34,7 @@ class EventConfigForm(Form, CssClassMixin):
|
||||
class AgendaConfigForm(Form, CssClassMixin):
|
||||
agenda_countdown_time = IntegerField(widget=TextInput(attrs={'class':'small-input'}),label=_("Countdown (in seconds)"),initial=60, min_value=0)
|
||||
|
||||
|
||||
class ApplicationConfigForm(Form, CssClassMixin):
|
||||
application_min_supporters = IntegerField(widget=TextInput(attrs={'class':'small-input'}),label=_("Number of (minimum) required supporters for a application"),initial=4, min_value=0, max_value=8)
|
||||
application_preamble = CharField(widget=TextInput(), required=False, label=_("Application preamble"))
|
||||
@ -42,6 +43,7 @@ class ApplicationConfigForm(Form, CssClassMixin):
|
||||
application_pdf_title = CharField(widget=TextInput(), required=False, label=_("Title for PDF document (all applications)"))
|
||||
application_pdf_preamble = CharField(widget=Textarea(), required=False, label=_("Preamble text for PDF document (all applications)"))
|
||||
|
||||
|
||||
class AssignmentConfigForm(Form, CssClassMixin):
|
||||
assignment_publish_winner_results_only = BooleanField(required=False, label=_("Only publish voting results for selected winners (Projector view only)"))
|
||||
assignment_pdf_ballot_papers_selection = ChoiceField(widget=Select(), required=False, label=_("Number of ballot papers (selection)"), choices=[("1", _("Number of all delegates")),("2", _("Number of all participants")),("0", _("Use the following custum number"))])
|
||||
|
Loading…
Reference in New Issue
Block a user