diff --git a/CHANGELOG b/CHANGELOG index 746a1770a..f1d9cd3eb 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -56,6 +56,7 @@ Motions: - New csv import layout and using Papa Parse for parsing the csv. - Number of ballots printed can now be set in config. - Add new personal settings to remove all whitespaces from motion identifier. +- Add new personal settings to allow amendments of amendments. Elections: - Added options to calculate percentages on different bases. diff --git a/openslides/core/views.py b/openslides/core/views.py index c0541ce08..1621fb8d5 100644 --- a/openslides/core/views.py +++ b/openslides/core/views.py @@ -140,7 +140,7 @@ class WebclientJavaScriptView(utils_views.View): js_files.extend(app_js_files) client_settings_keys = [ - # Add new settings to personal settings.py, utils/settings.py.tpl and to this list. Remove this comment later. + 'MOTIONS_ALLOW_AMENDMENTS_OF_AMENDMENTS' ] client_settings = {} for key in client_settings_keys: @@ -184,7 +184,7 @@ class WebclientJavaScriptView(utils_views.View): $.when.apply(this,deferres).done( function() {{ angular.bootstrap(document,['OpenSlidesApp.{realm}']); }} ); - """.format(realm=realm, angular_modules=angular_modules, settings=client_settings, js_files=js_files) + + """.format(realm=realm, angular_modules=angular_modules, settings=json.dumps(client_settings), js_files=js_files) + """ }()); """) diff --git a/openslides/motions/static/js/motions/base.js b/openslides/motions/static/js/motions/base.js index bbe689246..69930331e 100644 --- a/openslides/motions/static/js/motions/base.js +++ b/openslides/motions/static/js/motions/base.js @@ -202,9 +202,10 @@ angular.module('OpenSlidesApp.motions', [ 'Config', 'lineNumberingService', 'diffService', + 'OpenSlidesSettings', 'Projector', function(DS, $http, MotionPoll, MotionChangeRecommendation, MotionComment, jsDataModel, gettext, gettextCatalog, - operator, Config, lineNumberingService, diffService, Projector) { + operator, Config, lineNumberingService, diffService, OpenSlidesSettings, Projector) { var name = 'motions/motion'; return DS.defineResource({ name: name, @@ -406,6 +407,12 @@ angular.module('OpenSlidesApp.motions', [ ] }); }, + isAmendment: function () { + return this.parent_id !== null; + }, + hasAmendments: function () { + return DS.filter('motions/motion', {parent_id: this.id}).length > 0; + }, isAllowed: function (action) { /* * Return true if the requested user is allowed to do the specific action. @@ -468,6 +475,22 @@ angular.module('OpenSlidesApp.motions', [ return operator.hasPerms('motions.can_manage'); case 'can_manage': return operator.hasPerms('motions.can_manage'); + case 'can_see_amendments': + var result; + if (operator.hasPerms('motions.can_create')) { + result = Config.get('motions_amendments_enabled').value && + (this.hasAmendments() || this.isAllowed('can_create_amendment')); + } else if (operator.hasPerms('motions.can_see')) { + result = Config.get('motions_amendments_enabled').value && this.hasAmendments(); + } + return result; + case 'can_create_amendment': + return ( + operator.hasPerms('motions.can_create') && + Config.get('motions_amendments_enabled').value && + ( !this.isAmendment() || + (this.isAmendment() && OpenSlidesSettings.MOTIONS_ALLOW_AMENDMENTS_OF_AMENDMENTS)) + ); default: return false; } diff --git a/openslides/motions/static/templates/motions/motion-detail.html b/openslides/motions/static/templates/motions/motion-detail.html index 9ca53c518..53394260f 100644 --- a/openslides/motions/static/templates/motions/motion-detail.html +++ b/openslides/motions/static/templates/motions/motion-detail.html @@ -113,14 +113,15 @@ -