diff --git a/.gitignore b/.gitignore index ddf502c38..cfe1cb267 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ # General *.pyc *.swp +*.swo *~ # Virtual Environment diff --git a/openslides/agenda/models.py b/openslides/agenda/models.py index 02cc156b9..517716099 100644 --- a/openslides/agenda/models.py +++ b/openslides/agenda/models.py @@ -299,6 +299,17 @@ class Item(RESTModelMixin, models.Model): raise NotImplementedError('You have to provide a get_agenda_title ' 'method on your related model.') + @property + def list_view_title(self): + """ + Return get_agenda_list_view_title() from the content_object. + """ + try: + return self.content_object.get_agenda_list_view_title() + except AttributeError: + raise NotImplementedError('You have to provide a get_agenda_list_view_title ' + 'method on your related model.') + def is_hidden(self): """ Returns True if the type of this object itself is a hidden item or any diff --git a/openslides/agenda/serializers.py b/openslides/agenda/serializers.py index 0b0aeba38..0e975e33c 100644 --- a/openslides/agenda/serializers.py +++ b/openslides/agenda/serializers.py @@ -53,6 +53,7 @@ class ItemSerializer(ModelSerializer): 'id', 'item_number', 'title', + 'list_view_title', 'comment', 'closed', 'type', diff --git a/openslides/agenda/static/js/agenda/base.js b/openslides/agenda/static/js/agenda/base.js index 916764013..a45826445 100644 --- a/openslides/agenda/static/js/agenda/base.js +++ b/openslides/agenda/static/js/agenda/base.js @@ -48,12 +48,24 @@ angular.module('OpenSlidesApp.agenda', ['OpenSlidesApp.users']) try { title = this.getContentObject().getAgendaTitle(); } catch (e) { - // Only use this.title when the content object is not - // in the DS store. + // when the content object is not in the DS store. title = this.title; } - if (this.getContentResource().agendaSupplement) { - title = gettextCatalog.getString(this.getContentResource().agendaSupplement) + ' ' + title; + if (this.item_number) { + title = this.item_number + ' · ' + title; + } + return title; + }, + getAgendaTitle: function () { + return this.title; + }, + getListViewTitle: function () { + var title; + try { + title = this.getContentObject().getAgendaListViewTitle(); + } catch (e) { + // when the content object is not in the DS store + title = this.list_view_title; } if (this.item_number) { title = this.item_number + ' · ' + title; diff --git a/openslides/agenda/static/js/agenda/site.js b/openslides/agenda/static/js/agenda/site.js index 1f6639153..af6cad44a 100644 --- a/openslides/agenda/static/js/agenda/site.js +++ b/openslides/agenda/static/js/agenda/site.js @@ -280,6 +280,14 @@ angular.module('OpenSlidesApp.agenda.site', ['OpenSlidesApp.agenda']) $scope.alert = { type: 'danger', msg: data.detail, show: true }; }); }; + // gets speech duration of selected speaker in seconds + $scope.getDuration = function (speaker) { + var beginTimestamp = new Date(speaker.begin_time).getTime() + var endTimestamp = new Date(speaker.end_time).getTime() + // calculate duration in seconds + return Math.floor((endTimestamp - beginTimestamp) / 1000); + + } // save reordered list of speakers $scope.treeOptions = { dropped: function (event) { diff --git a/openslides/agenda/static/templates/agenda/item-detail.html b/openslides/agenda/static/templates/agenda/item-detail.html index 1ca45ef01..e19ca9bb7 100644 --- a/openslides/agenda/static/templates/agenda/item-detail.html +++ b/openslides/agenda/static/templates/agenda/item-detail.html @@ -7,7 +7,7 @@ - {{ item.getContentResource().verboseName }} + {{ item.getContentResource().verboseName | translate }} - {{ item.getContentResource().verboseName }} + {{ item.getContentResource().verboseName | translate }}