Numbering of agenda items, part 2.

Config item agenda_agenda_fixed removed'.
Config items agenda_agenda_fixed and agenda_enable_auto_numbering removed.
FixAgendaView and ResetAgendaView removed. AgendaNumberingView added.
Old two fix- and reset numbering buttons replaced by 'Number agenda items'.
This commit is contained in:
Stefan Frauenknecht 2014-05-03 19:38:12 +02:00 committed by Norman Jäckel
parent 5254cc83a6
commit f8bd4b0d86
5 changed files with 14 additions and 59 deletions

View File

@ -164,10 +164,8 @@ class Item(SlideMixin, AbsoluteUrlMixin, MPTTModel):
Return the title of this item.
"""
if not self.content_object:
if config['agenda_enable_auto_numbering']:
item_no = self.item_no
return '%s %s' % (item_no, self.title) if item_no else self.title
return self.title
try:
return self.content_object.get_agenda_title()
except AttributeError:
@ -306,12 +304,8 @@ class Item(SlideMixin, AbsoluteUrlMixin, MPTTModel):
@property
def item_no(self):
if config['agenda_agenda_fixed']:
item_number = self.item_number
else:
item_number = self.calc_item_no()
if item_number:
item_no = '%s %s' % (config['agenda_number_prefix'], item_number)
if self.item_number:
item_no = '%s %s' % (config['agenda_number_prefix'], self.item_number)
else:
item_no = None
return item_no

View File

@ -60,13 +60,6 @@ def setup_agenda_config(sender, **kwargs):
help_text=ugettext_lazy('[Begin speach] starts the countdown, [End speach] stops the countdown.'),
required=False))
agenda_enable_auto_numbering = ConfigVariable(
name='agenda_enable_auto_numbering',
default_value=False,
form_field=forms.BooleanField(
label=ugettext_lazy('Enable automatic numbering of agenda items'),
required=False))
agenda_number_prefix = ConfigVariable(
name='agenda_number_prefix',
default_value='',
@ -86,10 +79,6 @@ def setup_agenda_config(sender, **kwargs):
('roman', ugettext_lazy('Roman'))),
required=False))
agenda_agenda_fixed = ConfigVariable(
name='agenda_agenda_fixed',
default_value=False)
extra_stylefiles = ['css/jquery-ui-timepicker.css']
extra_javascript = ['js/jquery/jquery-ui-timepicker-addon.min.js',
'js/jquery/jquery-ui-sliderAccess.min.js',
@ -102,10 +91,8 @@ def setup_agenda_config(sender, **kwargs):
variables=(agenda_start_event_date_time,
agenda_show_last_speakers,
agenda_couple_countdown_and_speakers,
agenda_enable_auto_numbering,
agenda_number_prefix,
agenda_numeral_system,
agenda_agenda_fixed),
agenda_numeral_system),
extra_context={'extra_stylefiles': extra_stylefiles,
'extra_javascript': extra_javascript})

View File

@ -70,11 +70,9 @@
{% else %}
<a href="{% url 'config_agenda' %}" class="btn btn-mini pull-right">{% trans 'Set start time of event' %}</a>
{% endif %}
{% if perms.agenda.can_manage_agenda and agenda_enable_auto_numbering %}
<a href="{% url 'fix_agenda' %}"
class="btn btn-mini pull-left" {% if agenda_numbering_fixed %}disabled="disabled"{% endif %}>{% trans 'Fix numbering' %}</a>
<a href="{% url 'reset_agenda' %}"
class="btn btn-mini pull-left" {% if not agenda_numbering_fixed %}disabled="disabled"{% endif %}>{% trans 'Reset numbering' %}</a>
{% if perms.agenda.can_manage_agenda %}
<a href="{% url 'agenda_numbering' %}"
class="btn btn-mini pull-left">{% trans 'Number agenda items' %}</a>
{% endif %}
{% endif %}
</div>

View File

@ -40,13 +40,9 @@ urlpatterns = patterns(
views.AgendaPDF.as_view(),
name='print_agenda'),
url(r'^fix/$',
views.FixAgendaView.as_view(),
name='fix_agenda'),
url(r'^reset/$',
views.ResetAgendaView.as_view(),
name='reset_agenda'),
url(r'^numbering/$',
views.AgendaNumberingView.as_view(),
name='agenda_numbering'),
# List of speakers
url(r'^(?P<pk>\d+)/speaker/$',

View File

@ -112,8 +112,6 @@ class Overview(TemplateView):
context.update({
'items': items,
'agenda_is_active': agenda_is_active,
'agenda_enable_auto_numbering': config['agenda_enable_auto_numbering'],
'agenda_numbering_fixed': config['agenda_agenda_fixed'],
'duration': duration,
'start': start,
'end': end,
@ -345,38 +343,20 @@ class CreateRelatedAgendaItemView(SingleObjectMixin, RedirectView):
self.item = Item.objects.create(content_object=self.object)
class FixAgendaView(QuestionView):
class AgendaNumberingView(QuestionView):
permission_required = 'agenda.can_manage_agenda'
question_url_name = 'item_overview'
url_name = 'item_overview'
question_message = ugettext_lazy('Do you really want to fix the agenda numbering?')
question_message = ugettext_lazy('Do you really want to generate agenda numbering? Manually added item numbers will be overwritten!')
url_name_args = []
def on_clicked_yes(self):
config['agenda_agenda_fixed'] = True
for item in Item.objects.all():
item.item_number = item.calc_item_no()
item.save()
def get_final_message(self):
return ugettext_lazy('The agenda has been fixed.')
class ResetAgendaView(QuestionView):
permission_required = 'agenda.can_manage_agenda'
question_url_name = 'item_overview'
url_name = 'item_overview'
question_message = ugettext_lazy('Do you really want to reset the agenda numbering?')
url_name_args = []
def on_clicked_yes(self):
config['agenda_agenda_fixed'] = False
for item in Item.objects.all():
item.item_number = ''
item.save()
def get_final_message(self):
return ugettext_lazy('The agenda has been reset.')
return ugettext_lazy('The agenda has been numbered.')
class AgendaPDF(PDFView):