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