From 768ee9236afa01b8bcad6093d742c89fba4588e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emanuel=20Sch=C3=BCtze?= Date: Fri, 17 Feb 2017 15:05:51 +0100 Subject: [PATCH] Added new config for default change recommendation view. Use this default view for motion catalog pdf and motion detail view. --- openslides/motions/config_variables.py | 14 +++++++++++ openslides/motions/static/js/motions/pdf.js | 2 +- openslides/motions/static/js/motions/site.js | 23 ++++++++++++++----- .../templates/motions/motion-detail.html | 2 +- .../motions/motion-detail/toolbar.html | 2 +- 5 files changed, 34 insertions(+), 9 deletions(-) diff --git a/openslides/motions/config_variables.py b/openslides/motions/config_variables.py index c6a3b13e6..3f79d243b 100644 --- a/openslides/motions/config_variables.py +++ b/openslides/motions/config_variables.py @@ -108,6 +108,20 @@ def get_config_variables(): subgroup='General', translatable=True) + yield ConfigVariable( + name='motions_recommendation_text_mode', + default_value='original', + input_type='choice', + label='Default text version for change recommendations', + choices=( + {'value': 'original', 'display_name': 'Original version'}, + {'value': 'changed', 'display_name': 'Changed version'}, + {'value': 'diff', 'display_name': 'Diff version'}, + {'value': 'agreed', 'display_name': 'Final version'}), + weight=333, + group='Motions', + subgroup='General') + # Amendments yield ConfigVariable( name='motions_amendments_enabled', diff --git a/openslides/motions/static/js/motions/pdf.js b/openslides/motions/static/js/motions/pdf.js index b99ff30c1..218a9d7fd 100644 --- a/openslides/motions/static/js/motions/pdf.js +++ b/openslides/motions/static/js/motions/pdf.js @@ -532,7 +532,7 @@ angular.module('OpenSlidesApp.motions.pdf', ['OpenSlidesApp.core.pdf']) } }; - // returns the pure content of the motion, parseable by makepdf + // returns the pure content of the motion, parseable by pdfmake var getContent = function() { var motionContent = []; angular.forEach(allMotions, function(motion, key) { diff --git a/openslides/motions/static/js/motions/site.js b/openslides/motions/static/js/motions/site.js index a37b5fd80..ceef47d68 100644 --- a/openslides/motions/static/js/motions/site.js +++ b/openslides/motions/static/js/motions/site.js @@ -640,11 +640,13 @@ angular.module('OpenSlidesApp.motions.site', [ 'MotionForm', 'Motion', 'Category', + 'Config', 'Tag', 'Workflow', 'User', 'Agenda', 'MotionBlock', + 'MotionChangeRecommendation', 'MotionCsvExport', 'MotionDocxExport', 'MotionContentProvider', @@ -658,9 +660,10 @@ angular.module('OpenSlidesApp.motions.site', [ 'osTableSort', 'PdfCreate', function($scope, $state, $http, gettext, gettextCatalog, ngDialog, MotionForm, Motion, - Category, Tag, Workflow, User, Agenda, MotionBlock, MotionCsvExport, MotionDocxExport, - MotionContentProvider, MotionCatalogContentProvider, PdfMakeConverter, PdfMakeDocumentProvider, - HTMLValidizer, Projector, ProjectionDefault, osTableFilter, osTableSort, PdfCreate) { + Category, Config, Tag, Workflow, User, Agenda, MotionBlock, MotionChangeRecommendation, + MotionCsvExport, MotionDocxExport, MotionContentProvider, MotionCatalogContentProvider, + PdfMakeConverter, PdfMakeDocumentProvider, HTMLValidizer, Projector, ProjectionDefault, + osTableFilter, osTableSort, PdfCreate) { Motion.bindAll({}, $scope, 'motions'); Category.bindAll({}, $scope, 'categories'); MotionBlock.bindAll({}, $scope, 'motionBlocks'); @@ -864,10 +867,17 @@ angular.module('OpenSlidesApp.motions.site', [ $scope.pdfExport = function() { var filename = gettextCatalog.getString("Motions") + ".pdf"; var image_sources = []; + $scope.viewChangeRecommendations = {}; + $scope.viewChangeRecommendations.mode = Config.get('motions_recommendation_text_mode').value; + $scope.lineNumberMode = Config.get('motions_default_line_numbering').value; //save the arrays of the filtered motions to an array angular.forEach($scope.motionsFiltered, function (motion) { - var content = HTMLValidizer.validize(motion.getText($scope.version)) + HTMLValidizer.validize(motion.getReason($scope.version)); + $scope.change_recommendations = MotionChangeRecommendation.filter({ + 'where': {'motion_version_id': {'==': motion.active_version}} + }); + var text = motion.getTextByMode($scope.viewChangeRecommendations.mode, null); + var content = HTMLValidizer.validize(text) + HTMLValidizer.validize(motion.getReason()); var map = Function.prototype.call.bind([].map); var tmp_image_sources = map($(content).find("img"), function(element) { return element.getAttribute("src"); @@ -1022,7 +1032,7 @@ angular.module('OpenSlidesApp.motions.site', [ {mode: 'diff', label: 'Diff version'}, {mode: 'agreed', - label: 'Resolution'}, + label: 'Final version'}, ]; $scope.projectionMode = $scope.projectionModes[0]; if (motion.isProjected().length) { @@ -1245,7 +1255,7 @@ angular.module('OpenSlidesApp.motions.site', [ // Change recommendation viewing $scope.viewChangeRecommendations = ChangeRecommmendationView; - $scope.viewChangeRecommendations.init($scope, 'original'); + $scope.viewChangeRecommendations.init($scope, Config.get('motions_recommendation_text_mode').value); // PDF creating functions $scope.pdfExport = MotionPDFExport; @@ -1903,6 +1913,7 @@ angular.module('OpenSlidesApp.motions.site', [ gettext('Stop submitting new motions by non-staff users'); gettext('Allow to disable versioning'); gettext('Name of recommender'); + gettext('Default text version for change recommendations'); gettext('Will be displayed as label before selected recommendation. Use an empty value to disable the recommendation system.'); // subgroup Amendments diff --git a/openslides/motions/static/templates/motions/motion-detail.html b/openslides/motions/static/templates/motions/motion-detail.html index 55dc4c4fe..ef553b160 100644 --- a/openslides/motions/static/templates/motions/motion-detail.html +++ b/openslides/motions/static/templates/motions/motion-detail.html @@ -33,7 +33,7 @@ {{ mode.label | translate }} - Resolution + Final version
  • diff --git a/openslides/motions/static/templates/motions/motion-detail/toolbar.html b/openslides/motions/static/templates/motions/motion-detail/toolbar.html index c23242540..73222219c 100644 --- a/openslides/motions/static/templates/motions/motion-detail/toolbar.html +++ b/openslides/motions/static/templates/motions/motion-detail/toolbar.html @@ -108,7 +108,7 @@ - Resolution + Final version