From 0e124dbbae52d5b6d6200145f377e672e1f39e05 Mon Sep 17 00:00:00 2001 From: Emanuel Schuetze Date: Sat, 5 Sep 2015 10:06:02 +0200 Subject: [PATCH] Use tags in agenda. Fix motions.js. --- openslides/agenda/static/js/agenda/agenda.js | 19 +++++++++++-------- .../static/templates/agenda/item-form.html | 4 ++-- .../static/js/assignments/assignments.js | 1 - .../motions/static/js/motions/motions.js | 2 +- 4 files changed, 14 insertions(+), 12 deletions(-) diff --git a/openslides/agenda/static/js/agenda/agenda.js b/openslides/agenda/static/js/agenda/agenda.js index c9f710a65..a6ab2867f 100644 --- a/openslides/agenda/static/js/agenda/agenda.js +++ b/openslides/agenda/static/js/agenda/agenda.js @@ -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) { diff --git a/openslides/agenda/static/templates/agenda/item-form.html b/openslides/agenda/static/templates/agenda/item-form.html index 39ebfafd2..c988ae79b 100644 --- a/openslides/agenda/static/templates/agenda/item-form.html +++ b/openslides/agenda/static/templates/agenda/item-form.html @@ -37,8 +37,8 @@
- -
diff --git a/openslides/assignments/static/js/assignments/assignments.js b/openslides/assignments/static/js/assignments/assignments.js index 818320adf..7eaef749c 100644 --- a/openslides/assignments/static/js/assignments/assignments.js +++ b/openslides/assignments/static/js/assignments/assignments.js @@ -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'); diff --git a/openslides/motions/static/js/motions/motions.js b/openslides/motions/static/js/motions/motions.js index 7a29df7e8..abc108517 100644 --- a/openslides/motions/static/js/motions/motions.js +++ b/openslides/motions/static/js/motions/motions.js @@ -50,7 +50,7 @@ angular.module('OpenSlidesApp.motions', []) localField: 'submitters', localKeys: 'submitters_id', }, - 'supporters': { + { localField: 'supporters', localKeys: 'supporters_id', }