Merge pull request #1797 from emanuelschuetze/agendaNumbering
Show agenda titles with correct numbering
This commit is contained in:
commit
890383006b
@ -139,7 +139,11 @@ class ItemManager(models.Manager):
|
|||||||
item_number = str(index + 1)
|
item_number = str(index + 1)
|
||||||
if number is not None:
|
if number is not None:
|
||||||
item_number = '.'.join((number, item_number))
|
item_number = '.'.join((number, item_number))
|
||||||
tree_element['item'].item_number = item_number
|
if config['agenda_number_prefix']:
|
||||||
|
item_number_tmp = "%s %s" % (config['agenda_number_prefix'], item_number)
|
||||||
|
else:
|
||||||
|
item_number_tmp = item_number
|
||||||
|
tree_element['item'].item_number = item_number_tmp
|
||||||
tree_element['item'].save()
|
tree_element['item'].save()
|
||||||
walk_tree(tree_element['children'], item_number)
|
walk_tree(tree_element['children'], item_number)
|
||||||
|
|
||||||
@ -261,11 +265,10 @@ class Item(RESTModelMixin, models.Model):
|
|||||||
Return get_agenda_title() from the content_object.
|
Return get_agenda_title() from the content_object.
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
title = self.content_object.get_agenda_title()
|
return self.content_object.get_agenda_title()
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
raise NotImplementedError('You have to provide a get_agenda_title '
|
raise NotImplementedError('You have to provide a get_agenda_title '
|
||||||
'method on your related model.')
|
'method on your related model.')
|
||||||
return '%s %s' % (self.item_no, title) if self.item_no else title
|
|
||||||
|
|
||||||
def is_hidden(self):
|
def is_hidden(self):
|
||||||
"""
|
"""
|
||||||
@ -287,16 +290,6 @@ class Item(RESTModelMixin, models.Model):
|
|||||||
# The list of speakers is empty.
|
# The list of speakers is empty.
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@property
|
|
||||||
def item_no(self):
|
|
||||||
item_no = None
|
|
||||||
if self.item_number:
|
|
||||||
if config['agenda_number_prefix']:
|
|
||||||
item_no = '%s %s' % (config['agenda_number_prefix'], self.item_number)
|
|
||||||
else:
|
|
||||||
item_no = str(self.item_number)
|
|
||||||
return item_no
|
|
||||||
|
|
||||||
|
|
||||||
class SpeakerManager(models.Manager):
|
class SpeakerManager(models.Manager):
|
||||||
"""
|
"""
|
||||||
|
@ -56,6 +56,7 @@ def setup_agenda_config(sender, **kwargs):
|
|||||||
name='agenda_number_prefix',
|
name='agenda_number_prefix',
|
||||||
default_value='',
|
default_value='',
|
||||||
label=ugettext_lazy('Numbering prefix for agenda items'),
|
label=ugettext_lazy('Numbering prefix for agenda items'),
|
||||||
|
help_text=ugettext_lazy('This prefix will be set if you run the automatic agenda numbering.'),
|
||||||
weight=240,
|
weight=240,
|
||||||
group=ugettext_lazy('Agenda'),
|
group=ugettext_lazy('Agenda'),
|
||||||
validators=(MaxLengthValidator(20),))
|
validators=(MaxLengthValidator(20),))
|
||||||
|
@ -53,7 +53,10 @@ angular.module('OpenSlidesApp.agenda', ['OpenSlidesApp.users'])
|
|||||||
title = this.title;
|
title = this.title;
|
||||||
}
|
}
|
||||||
if (this.getContentResource().agendaSupplement) {
|
if (this.getContentResource().agendaSupplement) {
|
||||||
title = title + ' (' + gettextCatalog.getString(this.getContentResource().agendaSupplement) + ')';
|
title = gettextCatalog.getString(this.getContentResource().agendaSupplement) + ' ' + title;
|
||||||
|
}
|
||||||
|
if (this.item_number) {
|
||||||
|
title = this.item_number + ' ' + title;
|
||||||
}
|
}
|
||||||
return title;
|
return title;
|
||||||
},
|
},
|
||||||
|
@ -133,9 +133,9 @@
|
|||||||
<!-- agenda data columns -->
|
<!-- agenda data columns -->
|
||||||
<td ng-if="!item.quickEdit" ng-mouseover="item.hover=true" ng-mouseleave="item.hover=false">
|
<td ng-if="!item.quickEdit" ng-mouseover="item.hover=true" ng-mouseleave="item.hover=false">
|
||||||
<span ng-if="item.type == 2" title="'Hidden item'|translate"><i class="fa fa-ban"></i></span>
|
<span ng-if="item.type == 2" title="'Hidden item'|translate"><i class="fa fa-ban"></i></span>
|
||||||
|
<span ng-repeat="n in [].constructor(item.parentCount) track by $index">–</span>
|
||||||
<strong>
|
<strong>
|
||||||
<a href="" ng-click="open(item)">
|
<a href="" ng-click="open(item)">
|
||||||
<span ng-repeat="n in [].constructor(item.parentCount) track by $index">–</span>
|
|
||||||
{{ item.getTitle() }}
|
{{ item.getTitle() }}
|
||||||
</a>
|
</a>
|
||||||
</strong>
|
</strong>
|
||||||
|
@ -292,10 +292,13 @@ class AgendaPDF(PDFView):
|
|||||||
yield from walk_tree(element['children'], ancestors + 1)
|
yield from walk_tree(element['children'], ancestors + 1)
|
||||||
|
|
||||||
for item, ancestors in walk_tree(tree):
|
for item, ancestors in walk_tree(tree):
|
||||||
|
item_number = "{} ".format(item.item_number) if item.item_number else ''
|
||||||
if ancestors:
|
if ancestors:
|
||||||
space = " " * 6 * ancestors
|
space = " " * 6 * ancestors
|
||||||
story.append(Paragraph(
|
story.append(Paragraph(
|
||||||
"%s%s" % (space, escape(item.title)),
|
"%s%s%s" % (space, item_number, escape(item.title)),
|
||||||
stylesheet['Subitem']))
|
stylesheet['Subitem']))
|
||||||
else:
|
else:
|
||||||
story.append(Paragraph(escape(item.title), stylesheet['Item']))
|
story.append(Paragraph(
|
||||||
|
"%s%s" % (item_number, escape(item.title)),
|
||||||
|
stylesheet['Item']))
|
||||||
|
@ -29,7 +29,10 @@
|
|||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<h1>{{ assignment.title }}</h1>
|
<h1>{{ assignment.title }}</h1>
|
||||||
<h2 translate>Election</h2>
|
<h2>
|
||||||
|
<translate>Election</translate> –
|
||||||
|
<translate>Agenda</translate>: {{ assignment.agenda_item.item_number }}
|
||||||
|
</h2>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
<i class="fa fa-video-camera"></i>
|
<i class="fa fa-video-camera"></i>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<h1>{{ customslide.title }}</h1>
|
<h1>{{ customslide.agenda_item.getTitle() }}</h1>
|
||||||
<h2 translate>Agenda item</h2>
|
<h2 translate>Agenda item</h2>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -128,7 +128,7 @@ class Motion(RESTModelMixin, models.Model):
|
|||||||
Return a human readable name of this motion.
|
Return a human readable name of this motion.
|
||||||
"""
|
"""
|
||||||
if self.identifier:
|
if self.identifier:
|
||||||
string = '%s | %s' % (self.identifier, self.title)
|
string = '%s: %s' % (self.identifier, self.title)
|
||||||
else:
|
else:
|
||||||
string = self.title
|
string = self.title
|
||||||
return string
|
return string
|
||||||
|
@ -197,9 +197,9 @@ angular.module('OpenSlidesApp.motions', ['OpenSlidesApp.users'])
|
|||||||
getAgendaTitle: function () {
|
getAgendaTitle: function () {
|
||||||
var value = '';
|
var value = '';
|
||||||
if (this.identifier) {
|
if (this.identifier) {
|
||||||
value = this.identifier + ' | ';
|
value = ' ' + this.identifier;
|
||||||
}
|
}
|
||||||
return value + this.getTitle();
|
return value + ': ' + this.getTitle();
|
||||||
},
|
},
|
||||||
isAllowed: function (action) {
|
isAllowed: function (action) {
|
||||||
/*
|
/*
|
||||||
|
@ -33,6 +33,8 @@
|
|||||||
<h2>
|
<h2>
|
||||||
<translate>Motion</translate> {{ motion.identifier }}
|
<translate>Motion</translate> {{ motion.identifier }}
|
||||||
<span ng-if="motion.versions.length > 1" >| Version {{ motion.active_version }}</span>
|
<span ng-if="motion.versions.length > 1" >| Version {{ motion.active_version }}</span>
|
||||||
|
–
|
||||||
|
<translate>Agenda</translate>: {{ motion.agenda_item.item_number }}
|
||||||
</h2>
|
</h2>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -128,7 +128,7 @@ class ModelTest(TestCase):
|
|||||||
motion.active_version = None
|
motion.active_version = None
|
||||||
motion.save(update_fields=['active_version'])
|
motion.save(update_fields=['active_version'])
|
||||||
# motion.__unicode__() raised an AttributeError
|
# motion.__unicode__() raised an AttributeError
|
||||||
self.assertEqual(str(motion), 'test_identifier_VohT1hu9uhiSh6ooVBFS | test_title_Koowoh1ISheemeey1air')
|
self.assertEqual(str(motion), 'test_identifier_VohT1hu9uhiSh6ooVBFS: test_title_Koowoh1ISheemeey1air')
|
||||||
|
|
||||||
def test_is_amendment(self):
|
def test_is_amendment(self):
|
||||||
config['motions_amendments_enabled'] = True
|
config['motions_amendments_enabled'] = True
|
||||||
|
@ -14,16 +14,6 @@ class TestItemTitle(TestCase):
|
|||||||
item.title,
|
item.title,
|
||||||
'related_title')
|
'related_title')
|
||||||
|
|
||||||
@patch('openslides.agenda.models.Item.item_no', '5')
|
|
||||||
@patch('openslides.agenda.models.Item.content_object')
|
|
||||||
def test_title_with_item_no(self, content_object):
|
|
||||||
item = Item()
|
|
||||||
content_object.get_agenda_title.return_value = 'related_title'
|
|
||||||
|
|
||||||
self.assertEqual(
|
|
||||||
item.title,
|
|
||||||
'5 related_title')
|
|
||||||
|
|
||||||
@patch('openslides.agenda.models.Item.content_object')
|
@patch('openslides.agenda.models.Item.content_object')
|
||||||
def test_title_invalid_related(self, content_object):
|
def test_title_invalid_related(self, content_object):
|
||||||
item = Item()
|
item = Item()
|
||||||
|
Loading…
Reference in New Issue
Block a user