Merge pull request #3495 from FinnStutzenstein/ChangeRecoOther

New change recommendation type other
This commit is contained in:
Norman Jäckel 2017-11-30 21:52:17 +01:00 committed by GitHub
commit 3ac1c3c756
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 49 additions and 3 deletions

View File

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

View File

@ -639,6 +639,9 @@ img {
.motion-text-holder .change-recommendation-list > li.replace {
background-color: #0333ff;
}
.motion-text-holder .change-recommendation-list > li.other {
background-color: #777777;
}
.motion-text-holder .change-recommendation-list .tooltip {
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"""
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()
"""The number or the first affected line"""

View File

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

View File

@ -902,6 +902,9 @@ angular.module('OpenSlidesApp.motions', [
case diffService.TYPE_REPLACEMENT:
title = title.replace('%TYPE%', gettextCatalog.getString('Replacement'));
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));
return title;

View File

@ -17,6 +17,7 @@ angular.module('OpenSlidesApp.motions.diff', ['OpenSlidesApp.motions.lineNumberi
this.TYPE_REPLACEMENT = 0;
this.TYPE_INSERTION = 1;
this.TYPE_DELETION = 2;
this.TYPE_OTHER = 3;
this.getLineNumberNode = function(fragment, 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"));
} else if (change.getType(motion.getVersion(motionVersion).text) === 2) {
columnChangeType.push(gettextCatalog.getString("Deletion"));
} else if (change.getType(motion.getVersion(motionVersion).text) === 3) {
columnChangeType.push(change.other_description);
}
});
metaTableBody.push([

View File

@ -246,10 +246,19 @@ angular.module('OpenSlidesApp.motions.site', [
options: [
{name: gettextCatalog.getString('Replacement'), value: 0},
{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',
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) == 1">Insertion</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 class="status">
<translate ng-if="change.rejected">Rejected</translate>

View File

@ -22,7 +22,7 @@
<ul ng-if="viewChangeRecommendations.mode == 'original'" ng-show="lineNumberMode != 'none'"
class="change-recommendation-list">
<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)"
data-line-from="{{ change.line_from }}" data-line-to="{{ change.line_to}}"
title="{{ change.getTitle(motion.getVersion(version).text) }}">