diff --git a/openslides/core/static/js/core/site.js b/openslides/core/static/js/core/site.js index 4f9805ad1..a30c5e668 100644 --- a/openslides/core/static/js/core/site.js +++ b/openslides/core/static/js/core/site.js @@ -470,6 +470,14 @@ angular.module('OpenSlidesApp.core.site', [ extends: 'select', templateUrl: 'static/templates/core/select-multiple.html' }); + formlyConfig.setType({ + name: 'radio-buttons', + templateUrl: 'static/templates/core/radio-buttons.html', + wrapper: ['bootstrapHasError'], + defaultOptions: { + noFormControl: false + } + }); } ]) diff --git a/openslides/core/static/templates/core/radio-buttons.html b/openslides/core/static/templates/core/radio-buttons.html new file mode 100644 index 000000000..72df2be91 --- /dev/null +++ b/openslides/core/static/templates/core/radio-buttons.html @@ -0,0 +1,6 @@ +
+ +
diff --git a/openslides/motions/migrations/0009_motionchangerecommendation_type.py b/openslides/motions/migrations/0009_motionchangerecommendation_type.py new file mode 100644 index 000000000..b9dc7b5ea --- /dev/null +++ b/openslides/motions/migrations/0009_motionchangerecommendation_type.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.3 on 2016-11-19 10:29 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('motions', '0008_auto_20161116_2222'), + ] + + operations = [ + migrations.AddField( + model_name='motionchangerecommendation', + name='type', + field=models.PositiveIntegerField(default=0), + ), + ] diff --git a/openslides/motions/models.py b/openslides/motions/models.py index 3a027f02f..ea90dfa55 100644 --- a/openslides/motions/models.py +++ b/openslides/motions/models.py @@ -760,6 +760,9 @@ class MotionChangeRecommendation(RESTModelMixin, models.Model): rejected = models.BooleanField(default=False) """If true, this change recommendation has been rejected""" + type = models.PositiveIntegerField(default=0) + """Replacement (0), Insertion (1), Deletion (2)""" + line_from = models.PositiveIntegerField() """The number or the first affected line""" diff --git a/openslides/motions/serializers.py b/openslides/motions/serializers.py index 03761a257..61b081eac 100644 --- a/openslides/motions/serializers.py +++ b/openslides/motions/serializers.py @@ -251,6 +251,7 @@ class MotionChangeRecommendationSerializer(ModelSerializer): 'id', 'motion_version', 'rejected', + 'type', 'line_from', 'line_to', 'text', diff --git a/openslides/motions/static/js/motions/base.js b/openslides/motions/static/js/motions/base.js index 66ad23ae3..3457334a0 100644 --- a/openslides/motions/static/js/motions/base.js +++ b/openslides/motions/static/js/motions/base.js @@ -617,14 +617,7 @@ angular.module('OpenSlidesApp.motions', [ return diffService._serializeDom(mergedFragment); }, getType: function(original_full_html) { - var lineLength = Config.get('motions_line_length').value, - html = lineNumberingService.insertLineNumbers(original_full_html, lineLength); - - var data = diffService.extractRangeByLineNumbers(html, this.line_from, this.line_to), - oldText = data.outerContextStart + data.innerContextStart + - data.html + data.innerContextEnd + data.outerContextEnd; - - return diffService.detectReplacementType(oldText, this.text); + return this.type; }, getTitle: function(original_full_html) { var title; diff --git a/openslides/motions/static/js/motions/site.js b/openslides/motions/static/js/motions/site.js index 2c24ce4e2..a32a61ddc 100644 --- a/openslides/motions/static/js/motions/site.js +++ b/openslides/motions/static/js/motions/site.js @@ -346,6 +346,18 @@ angular.module('OpenSlidesApp.motions.site', [ }, hide: true }, + { + key: 'type', + type: 'radio-buttons', + templateOptions: { + name: 'type', + options: [ + {name: gettextCatalog.getString('Replacement'), value: 0}, + {name: gettextCatalog.getString('Insertion'), value: 1}, + {name: gettextCatalog.getString('Deletion'), value: 2} + ] + } + }, { key: 'text', type: 'editor',