Merge pull request #2632 from CatoTH/explicitly-enter-change-recommendation-type
Allow to explicitly set the type of a change recommendation
This commit is contained in:
commit
a30085f756
@ -470,6 +470,14 @@ angular.module('OpenSlidesApp.core.site', [
|
|||||||
extends: 'select',
|
extends: 'select',
|
||||||
templateUrl: 'static/templates/core/select-multiple.html'
|
templateUrl: 'static/templates/core/select-multiple.html'
|
||||||
});
|
});
|
||||||
|
formlyConfig.setType({
|
||||||
|
name: 'radio-buttons',
|
||||||
|
templateUrl: 'static/templates/core/radio-buttons.html',
|
||||||
|
wrapper: ['bootstrapHasError'],
|
||||||
|
defaultOptions: {
|
||||||
|
noFormControl: false
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
|
|
||||||
|
6
openslides/core/static/templates/core/radio-buttons.html
Normal file
6
openslides/core/static/templates/core/radio-buttons.html
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<div class="btn-group" data-toggle="buttons">
|
||||||
|
<label ng-repeat="(key, option) in to.options" ng-click="model[options.key] = option.value;"
|
||||||
|
class="btn btn-default btn-sm" ng-class="{active: (model[options.key] == option.value)}">
|
||||||
|
<input type="radio" tabindex="0" ng-value="option.value" ng-model="model[options.key]">{{option.name}}
|
||||||
|
</label>
|
||||||
|
</div>
|
@ -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),
|
||||||
|
),
|
||||||
|
]
|
@ -760,6 +760,9 @@ class MotionChangeRecommendation(RESTModelMixin, models.Model):
|
|||||||
rejected = models.BooleanField(default=False)
|
rejected = models.BooleanField(default=False)
|
||||||
"""If true, this change recommendation has been rejected"""
|
"""If true, this change recommendation has been rejected"""
|
||||||
|
|
||||||
|
type = models.PositiveIntegerField(default=0)
|
||||||
|
"""Replacement (0), Insertion (1), Deletion (2)"""
|
||||||
|
|
||||||
line_from = models.PositiveIntegerField()
|
line_from = models.PositiveIntegerField()
|
||||||
"""The number or the first affected line"""
|
"""The number or the first affected line"""
|
||||||
|
|
||||||
|
@ -251,6 +251,7 @@ class MotionChangeRecommendationSerializer(ModelSerializer):
|
|||||||
'id',
|
'id',
|
||||||
'motion_version',
|
'motion_version',
|
||||||
'rejected',
|
'rejected',
|
||||||
|
'type',
|
||||||
'line_from',
|
'line_from',
|
||||||
'line_to',
|
'line_to',
|
||||||
'text',
|
'text',
|
||||||
|
@ -617,14 +617,7 @@ angular.module('OpenSlidesApp.motions', [
|
|||||||
return diffService._serializeDom(mergedFragment);
|
return diffService._serializeDom(mergedFragment);
|
||||||
},
|
},
|
||||||
getType: function(original_full_html) {
|
getType: function(original_full_html) {
|
||||||
var lineLength = Config.get('motions_line_length').value,
|
return this.type;
|
||||||
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);
|
|
||||||
},
|
},
|
||||||
getTitle: function(original_full_html) {
|
getTitle: function(original_full_html) {
|
||||||
var title;
|
var title;
|
||||||
|
@ -346,6 +346,18 @@ angular.module('OpenSlidesApp.motions.site', [
|
|||||||
},
|
},
|
||||||
hide: true
|
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',
|
key: 'text',
|
||||||
type: 'editor',
|
type: 'editor',
|
||||||
|
Loading…
Reference in New Issue
Block a user