diff --git a/openslides/agenda/static/js/agenda/site.js b/openslides/agenda/static/js/agenda/site.js index 7f0bc7e96..09f9f0a11 100644 --- a/openslides/agenda/static/js/agenda/site.js +++ b/openslides/agenda/static/js/agenda/site.js @@ -37,17 +37,6 @@ angular.module('OpenSlidesApp.agenda.site', ['OpenSlidesApp.agenda']) } } }) - .state('agenda.item.create', { - resolve: { - types: function($http) { - // get all item types - return $http({ 'method': 'OPTIONS', 'url': '/rest/agenda/item/' }); - }, - tags: function(Tag) { - return Tag.findAll(); - } - } - }) .state('agenda.item.detail', { resolve: { item: function(Agenda, $stateParams) { @@ -61,17 +50,6 @@ angular.module('OpenSlidesApp.agenda.site', ['OpenSlidesApp.agenda']) } } }) - .state('agenda.item.detail.update', { - views: { - '@agenda.item': {} - }, - resolve: { - types: function($http) { - // get all item types - return $http({ 'method': 'OPTIONS', 'url': '/rest/agenda/item/' }); - } - } - }) .state('agenda.item.sort', { resolve: { items: function(Agenda) { @@ -115,7 +93,7 @@ angular.module('OpenSlidesApp.agenda.site', ['OpenSlidesApp.agenda']) ); }; - // open new customslide dialog + // open new dialog $scope.newDialog = function () { ngDialog.open({ template: 'static/templates/core/customslide-form.html', @@ -123,32 +101,18 @@ angular.module('OpenSlidesApp.agenda.site', ['OpenSlidesApp.agenda']) className: 'ngdialog-theme-default wide-form' }); }; + // open edit dialog + $scope.editDialog = function (item) { + $state.go(item.content_object.collection.replace('/','.')+'.detail.update', + {id: item.content_object.id}); + }; // detail view of related item (content object) $scope.open = function (item) { $state.go(item.content_object.collection.replace('/','.')+'.detail', {id: item.content_object.id}); }; - // edit view of related item (content object) - $scope.edit = function (item) { - if (item.content_object.collection == "core/customslide") { - ngDialog.open({ - template: 'static/templates/core/customslide-form.html', - controller: 'CustomslideUpdateCtrl', - className: 'ngdialog-theme-default wide-form', - resolve: { - customslide: function(Customslide) { - return Customslide.find(item.content_object.id); - } - } - }); - } - else { - $state.go(item.content_object.collection.replace('/','.')+'.detail.update', - {id: item.content_object.id}); - } - }; - // update changed item - $scope.update = function (item) { + // save changed item + $scope.save = function (item) { Agenda.save(item).then( function(success) { item.quickEdit = false; @@ -286,48 +250,6 @@ angular.module('OpenSlidesApp.agenda.site', ['OpenSlidesApp.agenda']) } ]) -.controller('ItemCreateCtrl', [ - '$scope', - '$state', - 'Agenda', - 'Tag', - 'types', - 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; - Agenda.create(item).then( - function(success) { - $state.go('agenda.item.list'); - } - ); - }; - } -]) - -.controller('ItemUpdateCtrl', [ - '$scope', - '$state', - 'Agenda', - 'Tag', - 'types', - 'item', - 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( - function(success) { - $state.go('agenda.item.list'); - } - ); - }; - } -]) - .controller('AgendaSortCtrl', [ '$scope', '$http', diff --git a/openslides/agenda/static/templates/agenda/item-list.html b/openslides/agenda/static/templates/agenda/item-list.html index e7bb4de2c..4889f377f 100644 --- a/openslides/agenda/static/templates/agenda/item-list.html +++ b/openslides/agenda/static/templates/agenda/item-list.html @@ -131,7 +131,7 @@