diff --git a/openslides/agenda/static/js/agenda/base.js b/openslides/agenda/static/js/agenda/base.js index ac60aeb0e..8650742bc 100644 --- a/openslides/agenda/static/js/agenda/base.js +++ b/openslides/agenda/static/js/agenda/base.js @@ -55,7 +55,9 @@ angular.module('OpenSlidesApp.agenda', ['OpenSlidesApp.users']) 'Projector', 'gettextCatalog', 'gettext', - function($http, DS, Speaker, jsDataModel, Projector, gettextCatalog, gettext) { + 'CamelCase', + 'EditForm', + function($http, DS, Speaker, jsDataModel, Projector, gettextCatalog, gettext, CamelCase, EditForm) { var name = 'agenda/item'; return DS.defineResource({ name: name, @@ -68,6 +70,13 @@ angular.module('OpenSlidesApp.agenda', ['OpenSlidesApp.users']) getContentObject: function () { return DS.get(this.content_object.collection, this.content_object.id); }, + getContentObjectDetailState: function () { + return CamelCase(this.content_object.collection).replace('/', '.') + + '.detail({id: ' + this.content_object.id + '})'; + }, + getContentObjectForm: function () { + return EditForm.fromCollectionString(this.content_object.collection); + }, getContentResource: function () { return DS.definitions[this.content_object.collection]; }, diff --git a/openslides/agenda/static/js/agenda/site.js b/openslides/agenda/static/js/agenda/site.js index b99ddf073..9913c4baa 100644 --- a/openslides/agenda/static/js/agenda/site.js +++ b/openslides/agenda/static/js/agenda/site.js @@ -81,7 +81,6 @@ angular.module('OpenSlidesApp.agenda.site', [ '$filter', '$http', '$state', - '$injector', 'DS', 'operator', 'ngDialog', @@ -97,7 +96,7 @@ angular.module('OpenSlidesApp.agenda.site', [ 'osTableFilter', 'AgendaCsvExport', 'PdfCreate', - function($scope, $filter, $http, $state, $injector, DS, operator, ngDialog, Agenda, TopicForm, + function($scope, $filter, $http, $state, DS, operator, ngDialog, Agenda, TopicForm, AgendaTree, Projector, ProjectionDefault, AgendaContentProvider, PdfMakeDocumentProvider, gettextCatalog, gettext, osTableFilter, AgendaCsvExport, PdfCreate) { // Bind agenda tree to the scope @@ -269,21 +268,8 @@ angular.module('OpenSlidesApp.agenda.site', [ return false; } }; - $scope.getDetailStatePrefix = function (item) { - var prefix = item.content_object.collection.replace('/','.'); - // Hotfix for Issue 2566. - // The changes could be reverted if Issue 2480 is closed. - prefix = prefix.replace('motion-block', 'motionBlock'); - return prefix; - }; $scope.edit = function (item) { - var formName = item.content_object.collection.split('/')[1]; - // Hotfix for Issue 2566. - // The changes could be reverted if Issue 2480 is closed. - formName = formName.replace('motion-block', 'motionBlock'); - formName = formName.charAt(0).toUpperCase() + formName.slice(1) + 'Form'; - var form = $injector.get(formName); - ngDialog.open(form.getDialog({id: item.content_object.id})); + ngDialog.open(item.getContentObjectForm().getDialog({id: item.content_object.id})); }; // export $scope.pdfExport = function () { diff --git a/openslides/agenda/static/templates/agenda/item-list.html b/openslides/agenda/static/templates/agenda/item-list.html index 0ca7023d3..f2fc8f3f1 100644 --- a/openslides/agenda/static/templates/agenda/item-list.html +++ b/openslides/agenda/static/templates/agenda/item-list.html @@ -271,7 +271,7 @@