Merge pull request #1583 from emanuelschuetze/agenda-slides

Use item-detail and item-list slides for agenda app.
This commit is contained in:
Norman Jäckel 2015-06-29 18:05:45 +02:00
commit 87cce491a0
5 changed files with 17 additions and 12 deletions

View File

@ -35,7 +35,7 @@ class ItemListSlide(ProjectorElement):
def get_requirements(self, config_entry): def get_requirements(self, config_entry):
pk = config_entry.get('id', 'tree') pk = config_entry.get('id', 'tree')
if pk is None or self.config_entry.get('tree', False): if pk is None or config_entry.get('tree', False):
# Root list slide or slide with tree. # Root list slide or slide with tree.
yield ProjectorRequirement( yield ProjectorRequirement(
view_class=ItemViewSet, view_class=ItemViewSet,
@ -57,7 +57,7 @@ class ItemDetailSlide(ProjectorElement):
To activate a detail slide as list of speakers slide, set 'id' and set To activate a detail slide as list of speakers slide, set 'id' and set
'list_of_speakers' true. 'list_of_speakers' true.
""" """
name = 'agenda/item-detail' name = 'agenda/item'
def get_context(self): def get_context(self):
pk = self.config_entry.get('id') pk = self.config_entry.get('id')

View File

@ -124,7 +124,7 @@ angular.module('OpenSlidesApp.agenda.site', ['OpenSlidesApp.agenda'])
// project agenda // project agenda
$scope.projectAgenda = function () { $scope.projectAgenda = function () {
$http.post('/rest/core/projector/1/prune_elements/', $http.post('/rest/core/projector/1/prune_elements/',
[{name: 'agenda/agenda'}]); [{name: 'agenda/item-list'}]);
}; };
// check if agenda is projected // check if agenda is projected
$scope.isAgendaProjected = function () { $scope.isAgendaProjected = function () {
@ -134,7 +134,7 @@ angular.module('OpenSlidesApp.agenda.site', ['OpenSlidesApp.agenda'])
if (typeof projector === 'undefined') return false; if (typeof projector === 'undefined') return false;
var self = this; var self = this;
return _.findIndex(projector.elements, function(element) { return _.findIndex(projector.elements, function(element) {
return element.name == 'agenda/agenda' return element.name == 'agenda/item-list'
}) > -1; }) > -1;
}; };
@ -265,14 +265,14 @@ angular.module('OpenSlidesApp.agenda.projector', ['OpenSlidesApp.agenda'])
.config(function(slidesProvider) { .config(function(slidesProvider) {
slidesProvider.registerSlide('agenda/item', { slidesProvider.registerSlide('agenda/item', {
template: 'static/templates/agenda/slide_item.html', template: 'static/templates/agenda/slide-item-detail.html',
}); });
slidesProvider.registerSlide('agenda/agenda', { slidesProvider.registerSlide('agenda/item-list', {
template: 'static/templates/agenda/slide_agenda.html', template: 'static/templates/agenda/slide-item-list.html',
}); });
}) })
.controller('SlideItemCtrl', function($scope, Agenda) { .controller('SlideItemDetailCtrl', function($scope, Agenda) {
// Attention! Each object that is used here has to be dealt on server side. // Attention! Each object that is used here has to be dealt on server side.
// Add it to the coresponding get_requirements method of the ProjectorElement // Add it to the coresponding get_requirements method of the ProjectorElement
// class. // class.
@ -281,7 +281,7 @@ angular.module('OpenSlidesApp.agenda.projector', ['OpenSlidesApp.agenda'])
Agenda.bindOne(id, $scope, 'item'); Agenda.bindOne(id, $scope, 'item');
}) })
.controller('SlideAgendaCtrl', function($scope, $http, Agenda) { .controller('SlideItemListCtrl', function($scope, $http, Agenda) {
// Attention! Each object that is used here has to be dealt on server side. // Attention! Each object that is used here has to be dealt on server side.
// Add it to the coresponding get_requirements method of the ProjectorElement // Add it to the coresponding get_requirements method of the ProjectorElement
// class. // class.

View File

@ -1,4 +1,4 @@
<div ng-controller="SlideItemCtrl" class="content"> <div ng-controller="SlideItemDetailCtrl" class="content">
<h1>{{ item.title }}</h1> <h1>{{ item.title }}</h1>
<div class="white-space-pre-line">{{ item.text }}</div> <div class="white-space-pre-line">{{ item.text }}</div>
</div> </div>

View File

@ -1,4 +1,4 @@
<div ng-controller="SlideAgendaCtrl" class="content"> <div ng-controller="SlideItemListCtrl" class="content">
<h1 translate>Agenda</h1> <h1 translate>Agenda</h1>
<table class="tablelist"> <table class="tablelist">

View File

@ -98,6 +98,7 @@ angular.module('OpenSlidesApp.core', [])
var self = this; var self = this;
return _.findIndex(projector.elements, function(element) { return _.findIndex(projector.elements, function(element) {
return element.name == self.getResourceName() && return element.name == self.getResourceName() &&
typeof(element.context) !== 'undefined' &&
typeof(element.context.id) !== 'undefined' && typeof(element.context.id) !== 'undefined' &&
element.context.id == self.id; element.context.id == self.id;
}) > -1; }) > -1;
@ -615,7 +616,11 @@ angular.module('OpenSlidesApp.core.projector', ['OpenSlidesApp.core'])
}, function () { }, function () {
$scope.elements = []; $scope.elements = [];
_.forEach(slides.getElements(Projector.get(1)), function(element) { _.forEach(slides.getElements(Projector.get(1)), function(element) {
if (!element.error) {
$scope.elements.push(element); $scope.elements.push(element);
} else {
console.error("Error for slide " + element.name + ": " + element.error)
}
}); });
}); });
}); });