New change recommendation type other

This commit is contained in:
FinnStutzenstein 2017-11-17 12:10:46 +01:00
parent 3161bdaa05
commit 2a0a0049b0
11 changed files with 49 additions and 3 deletions

View File

@ -50,6 +50,7 @@ Motions:
- Added karma:watch command [#3466]. - Added karma:watch command [#3466].
- Show the number of next speakers in motion list view [#3470]. - Show the number of next speakers in motion list view [#3470].
- Reference to motions by id in state and recommendation special field [#3498]. - Reference to motions by id in state and recommendation special field [#3498].
- Added new change recommendation type "other" [#3495].
Elections: Elections:
- Added pagination for list view [#3393]. - Added pagination for list view [#3393].

View File

@ -639,6 +639,9 @@ img {
.motion-text-holder .change-recommendation-list > li.replace { .motion-text-holder .change-recommendation-list > li.replace {
background-color: #0333ff; background-color: #0333ff;
} }
.motion-text-holder .change-recommendation-list > li.other {
background-color: #777777;
}
.motion-text-holder .change-recommendation-list .tooltip { .motion-text-holder .change-recommendation-list .tooltip {
display: none; display: none;

View File

@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.10.8 on 2017-11-17 10:47
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('motions', '0003_motion_comments'),
]
operations = [
migrations.AddField(
model_name='motionchangerecommendation',
name='other_description',
field=models.TextField(blank=True),
),
]

View File

@ -778,7 +778,10 @@ class MotionChangeRecommendation(RESTModelMixin, models.Model):
"""If true, this change recommendation has been rejected""" """If true, this change recommendation has been rejected"""
type = models.PositiveIntegerField(default=0) type = models.PositiveIntegerField(default=0)
"""Replacement (0), Insertion (1), Deletion (2)""" """Replacement (0), Insertion (1), Deletion (2), Other (3)"""
other_description = models.TextField(blank=True)
"""The description text for type 'other'"""
line_from = models.PositiveIntegerField() line_from = models.PositiveIntegerField()
"""The number or the first affected line""" """The number or the first affected line"""

View File

@ -258,6 +258,7 @@ class MotionChangeRecommendationSerializer(ModelSerializer):
'motion_version', 'motion_version',
'rejected', 'rejected',
'type', 'type',
'other_description',
'line_from', 'line_from',
'line_to', 'line_to',
'text', 'text',

View File

@ -902,6 +902,9 @@ angular.module('OpenSlidesApp.motions', [
case diffService.TYPE_REPLACEMENT: case diffService.TYPE_REPLACEMENT:
title = title.replace('%TYPE%', gettextCatalog.getString('Replacement')); title = title.replace('%TYPE%', gettextCatalog.getString('Replacement'));
break; break;
case diffService.TYPE_OTHER:
title = title.replace('%TYPE%', this.other_description);
break;
} }
title = title.replace('%FROM%', this.line_from).replace('%TO%', (this.line_to - 1)); title = title.replace('%FROM%', this.line_from).replace('%TO%', (this.line_to - 1));
return title; return title;

View File

@ -17,6 +17,7 @@ angular.module('OpenSlidesApp.motions.diff', ['OpenSlidesApp.motions.lineNumberi
this.TYPE_REPLACEMENT = 0; this.TYPE_REPLACEMENT = 0;
this.TYPE_INSERTION = 1; this.TYPE_INSERTION = 1;
this.TYPE_DELETION = 2; this.TYPE_DELETION = 2;
this.TYPE_OTHER = 3;
this.getLineNumberNode = function(fragment, lineNumber) { this.getLineNumberNode = function(fragment, lineNumber) {
return fragment.querySelector('os-linebreak.os-line-number.line-number-' + lineNumber); return fragment.querySelector('os-linebreak.os-line-number.line-number-' + lineNumber);

View File

@ -270,6 +270,8 @@ angular.module('OpenSlidesApp.motions.pdf', ['OpenSlidesApp.core.pdf'])
columnChangeType.push(gettextCatalog.getString("Insertion")); columnChangeType.push(gettextCatalog.getString("Insertion"));
} else if (change.getType(motion.getVersion(motionVersion).text) === 2) { } else if (change.getType(motion.getVersion(motionVersion).text) === 2) {
columnChangeType.push(gettextCatalog.getString("Deletion")); columnChangeType.push(gettextCatalog.getString("Deletion"));
} else if (change.getType(motion.getVersion(motionVersion).text) === 3) {
columnChangeType.push(change.other_description);
} }
}); });
metaTableBody.push([ metaTableBody.push([

View File

@ -246,10 +246,19 @@ angular.module('OpenSlidesApp.motions.site', [
options: [ options: [
{name: gettextCatalog.getString('Replacement'), value: 0}, {name: gettextCatalog.getString('Replacement'), value: 0},
{name: gettextCatalog.getString('Insertion'), value: 1}, {name: gettextCatalog.getString('Insertion'), value: 1},
{name: gettextCatalog.getString('Deletion'), value: 2} {name: gettextCatalog.getString('Deletion'), value: 2},
{name: gettextCatalog.getString('Other'), value: 3},
] ]
} }
}, },
{
key: 'other_description',
type: 'input',
templateOptions: {
label: gettextCatalog.getString('Description'),
},
hideExpression: "model.type !== 3",
},
{ {
key: 'text', key: 'text',
type: 'editor', type: 'editor',

View File

@ -24,6 +24,9 @@
<translate ng-if="change.getType(motion.getVersion(version).text) == 0">Replacement</translate> <translate ng-if="change.getType(motion.getVersion(version).text) == 0">Replacement</translate>
<translate ng-if="change.getType(motion.getVersion(version).text) == 1">Insertion</translate> <translate ng-if="change.getType(motion.getVersion(version).text) == 1">Insertion</translate>
<translate ng-if="change.getType(motion.getVersion(version).text) == 2">Deletion</translate> <translate ng-if="change.getType(motion.getVersion(version).text) == 2">Deletion</translate>
<span ng-if="change.getType(motion.getVersion(version).text) == 3">
{{ change.other_description }}
</span>
</span> </span>
<span class="status"> <span class="status">
<translate ng-if="change.rejected">Rejected</translate> <translate ng-if="change.rejected">Rejected</translate>

View File

@ -22,7 +22,7 @@
<ul ng-if="viewChangeRecommendations.mode == 'original'" ng-show="lineNumberMode != 'none'" <ul ng-if="viewChangeRecommendations.mode == 'original'" ng-show="lineNumberMode != 'none'"
class="change-recommendation-list"> class="change-recommendation-list">
<li ng-repeat="change in change_recommendations | filter:{motion_version_id:version}:true" <li ng-repeat="change in change_recommendations | filter:{motion_version_id:version}:true"
ng-class="['replace', 'insert', 'delete'][change.getType(motion.getVersion(version).text)]" ng-class="['replace', 'insert', 'delete', 'other'][change.getType(motion.getVersion(version).text)]"
ng-click="viewChangeRecommendations.scrollToDiffBox(change.id)" ng-click="viewChangeRecommendations.scrollToDiffBox(change.id)"
data-line-from="{{ change.line_from }}" data-line-to="{{ change.line_to}}" data-line-from="{{ change.line_from }}" data-line-to="{{ change.line_to}}"
title="{{ change.getTitle(motion.getVersion(version).text) }}"> title="{{ change.getTitle(motion.getVersion(version).text) }}">