Use tags in agenda. Fix motions.js.

This commit is contained in:
Emanuel Schuetze 2015-09-05 10:06:02 +02:00
parent 026f4d45cb
commit 0e124dbbae
4 changed files with 14 additions and 12 deletions

View File

@ -73,6 +73,9 @@ angular.module('OpenSlidesApp.agenda.site', ['OpenSlidesApp.agenda'])
types: function($http) {
// get all item types
return $http({ 'method': 'OPTIONS', 'url': '/rest/agenda/item/' });
},
tags: function(Tag) {
return Tag.findAll();
}
}
})
@ -83,6 +86,9 @@ angular.module('OpenSlidesApp.agenda.site', ['OpenSlidesApp.agenda'])
},
users: function(User) {
return User.findAll();
},
tags: function(Tag) {
return Tag.findAll();
}
}
})
@ -196,13 +202,12 @@ angular.module('OpenSlidesApp.agenda.site', ['OpenSlidesApp.agenda'])
};
})
.controller('ItemCreateCtrl', function($scope, $state, Agenda, types) {
.controller('ItemCreateCtrl', function($scope, $state, Agenda, Tag, types) {
$scope.types = types.data.actions.POST.type.choices; // get all item types
Tag.bindAll({}, $scope, 'tags');
$scope.save = function (item) {
if (!item)
return null;
item.weight = 0; // TODO: the rest_api should do this
item.tags = []; // TODO: the rest_api should do this
Agenda.create(item).then(
function(success) {
$state.go('agenda.item.list');
@ -211,8 +216,9 @@ angular.module('OpenSlidesApp.agenda.site', ['OpenSlidesApp.agenda'])
};
})
.controller('ItemUpdateCtrl', function($scope, $state, Agenda, types, item) {
.controller('ItemUpdateCtrl', function($scope, $state, Agenda, Tag, types, item) {
$scope.types = types.data.actions.POST.type.choices; // get all item types
Tag.bindAll({}, $scope, 'tags');
$scope.item = item;
$scope.save = function (item) {
Agenda.save(item).then(
@ -242,8 +248,6 @@ angular.module('OpenSlidesApp.agenda.site', ['OpenSlidesApp.agenda'])
$scope.importcounter = 0;
$scope.items.forEach(function(title) {
var item = {title: title};
item.weight = 0; // TODO: the rest_api should do this
item.tags = []; // TODO: the rest_api should do this
// TODO: create all items in bulk mode
Agenda.create(item).then(
function(success) {
@ -270,8 +274,6 @@ angular.module('OpenSlidesApp.agenda.site', ['OpenSlidesApp.agenda'])
item.title = obj[i].title;
item.text = obj[i].text;
item.duration = obj[i].duration;
item.weight = 0; // TODO: the rest_api should do this
item.tags = []; // TODO: the rest_api should do this
Agenda.create(item).then(
function(success) {
$scope.csvimportcounter++;
@ -306,6 +308,7 @@ angular.module('OpenSlidesApp.agenda.projector', ['OpenSlidesApp.agenda'])
var id = $scope.element.context.id;
Agenda.find(id);
Agenda.bindOne(id, $scope, 'item');
})
.controller('SlideItemListCtrl', function($scope, $http, Agenda) {

View File

@ -37,8 +37,8 @@
</div>
<div class="form-group">
<label for="selectTags" translate>Tags</label>
<!-- TODO: get types automatically, provide multiple select field -->
<select ng-options="" ng-model="item.tags" class="form-control" name="selectTags">
<select multiple ng-options="tag.id as tag.name for tag in tags"
ng-model="item.tags_id" class="form-control" name="selectTags">
</select>
</div>

View File

@ -87,7 +87,6 @@ angular.module('OpenSlidesApp.assignments.site', ['OpenSlidesApp.assignments'])
.controller('AssignmentCreateCtrl', function($scope, $state, Assignment) {
$scope.assignment = {};
$scope.save = function(assignment) {
assignment.tags = []; // TODO: the rest_api should do this
Assignment.create(assignment).then(
function(success) {
$state.go('assignments.assignment.list');

View File

@ -50,7 +50,7 @@ angular.module('OpenSlidesApp.motions', [])
localField: 'submitters',
localKeys: 'submitters_id',
},
'supporters': {
{
localField: 'supporters',
localKeys: 'supporters_id',
}