Merge pull request #1611 from emanuelschuetze/tags

Use tags in agenda. Fix motions.js.
This commit is contained in:
Oskar Hahn 2015-09-05 10:16:55 +02:00
commit 6acdb3c305
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) { types: function($http) {
// get all item types // get all item types
return $http({ 'method': 'OPTIONS', 'url': '/rest/agenda/item/' }); 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) { users: function(User) {
return User.findAll(); 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 $scope.types = types.data.actions.POST.type.choices; // get all item types
Tag.bindAll({}, $scope, 'tags');
$scope.save = function (item) { $scope.save = function (item) {
if (!item) if (!item)
return null; 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( Agenda.create(item).then(
function(success) { function(success) {
$state.go('agenda.item.list'); $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 $scope.types = types.data.actions.POST.type.choices; // get all item types
Tag.bindAll({}, $scope, 'tags');
$scope.item = item; $scope.item = item;
$scope.save = function (item) { $scope.save = function (item) {
Agenda.save(item).then( Agenda.save(item).then(
@ -242,8 +248,6 @@ angular.module('OpenSlidesApp.agenda.site', ['OpenSlidesApp.agenda'])
$scope.importcounter = 0; $scope.importcounter = 0;
$scope.items.forEach(function(title) { $scope.items.forEach(function(title) {
var item = {title: 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 // TODO: create all items in bulk mode
Agenda.create(item).then( Agenda.create(item).then(
function(success) { function(success) {
@ -270,8 +274,6 @@ angular.module('OpenSlidesApp.agenda.site', ['OpenSlidesApp.agenda'])
item.title = obj[i].title; item.title = obj[i].title;
item.text = obj[i].text; item.text = obj[i].text;
item.duration = obj[i].duration; 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( Agenda.create(item).then(
function(success) { function(success) {
$scope.csvimportcounter++; $scope.csvimportcounter++;
@ -306,6 +308,7 @@ angular.module('OpenSlidesApp.agenda.projector', ['OpenSlidesApp.agenda'])
var id = $scope.element.context.id; var id = $scope.element.context.id;
Agenda.find(id); Agenda.find(id);
Agenda.bindOne(id, $scope, 'item'); Agenda.bindOne(id, $scope, 'item');
}) })
.controller('SlideItemListCtrl', function($scope, $http, Agenda) { .controller('SlideItemListCtrl', function($scope, $http, Agenda) {

View File

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

View File

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

View File

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