Added motion origin field.

This commit is contained in:
Norman Jäckel 2016-07-13 14:45:40 +02:00
parent 2627724c55
commit 0b9a64f968
6 changed files with 54 additions and 10 deletions

View File

@ -12,6 +12,9 @@ Core:
- Used Django Channels instead of Tornado.
- Added support for big assemblies with lots of users.
Motions:
- Added origin field.
Other:
- Removed config cache to support multiple threads or processes.
- Fixed bug, that the last change of a config value was not send via autoupdate.

View File

@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-07-13 14:25
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('motions', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='motion',
name='origin',
field=models.CharField(blank=True, max_length=255),
),
]

View File

@ -81,6 +81,12 @@ class Motion(RESTModelMixin, models.Model):
ForeignKey to one category of motions.
"""
origin = models.CharField(max_length=255, blank=True)
"""
A string to describe the origin of this motion e. g. that it was
discussed at another assembly/conference.
"""
attachments = models.ManyToManyField(Mediafile, blank=True)
"""
Many to many relation to mediafile objects.

View File

@ -233,6 +233,7 @@ class MotionSerializer(ModelSerializer):
'active_version',
'parent',
'category',
'origin',
'submitters',
'supporters',
'state',
@ -255,6 +256,7 @@ class MotionSerializer(ModelSerializer):
motion.reason = validated_data.get('reason', '')
motion.identifier = validated_data.get('identifier')
motion.category = validated_data.get('category')
motion.origin = validated_data.get('origin', '')
motion.reset_state(validated_data.get('workflow_id'))
motion.save()
if validated_data.get('submitters'):
@ -271,8 +273,8 @@ class MotionSerializer(ModelSerializer):
"""
Customized method to update a motion.
"""
# Identifier and category.
for key in ('identifier', 'category'):
# Identifier, category and origin.
for key in ('identifier', 'category', 'origin'):
if key in validated_data.keys():
setattr(motion, key, validated_data[key])

View File

@ -296,6 +296,14 @@ angular.module('OpenSlidesApp.motions.site', ['OpenSlidesApp.motions'])
},
hideExpression: '!model.more'
},
{
key: 'origin',
type: 'input',
templateOptions: {
label: gettextCatalog.getString('Origin'),
},
hideExpression: '!model.more'
},
{
key: 'tags_id',
type: 'select-multiple',
@ -917,6 +925,10 @@ angular.module('OpenSlidesApp.motions.site', ['OpenSlidesApp.motions'])
if (motion.category && motion.category !== '' && !motion.category_id) {
motion.category_create = gettext('New category will be created.');
}
// origin
if (motion.origin) {
motion.origin = motion.origin.replace(quotionRe, '$1');
}
$scope.motions.push(motion);
});
});
@ -971,12 +983,11 @@ angular.module('OpenSlidesApp.motions.site', ['OpenSlidesApp.motions'])
var element = document.getElementById('downloadLink');
var csvRows = [
// column header line
['identifier', 'title', 'text', 'reason', 'submitter', 'category'],
['identifier', 'title', 'text', 'reason', 'submitter', 'category', 'origin'],
// example entries
['A1', 'title 1', 'text 1', 'reason 1', 'Submitter A', 'Category A'],
['B1', 'title 2', 'text 2', 'reason 2', 'Submitter B', 'Category B'],
['' , 'title 3', 'text 3', '', '', '']
['A1', 'Title 1', 'Text 1', 'Reason 1', 'Submitter A', 'Category A', 'Last Year Conference A'],
['B1', 'Title 2', 'Text 2', 'Reason 2', 'Submitter B', 'Category B', '' ],
['' , 'Title 3', 'Text 3', '' , '' , '' , '' ],
];
var csvString = csvRows.join("%0A");
element.href = 'data:text/csv;charset=utf-8,' + csvString;

View File

@ -39,8 +39,8 @@
<h4 translate>Please note:</h4>
<ul>
<li><translate>Required comma or semicolon separated values with these column header names in the first row</translate>:<br>
<code>identifier, title, text, reason, submitter, category</code>
<li translate>Identifier, reason, submitter and category are optional and may be empty.
<code>identifier, title, text, reason, submitter, category, origin</code>
<li translate>Identifier, reason, submitter, category and origin are optional and may be empty.
<li translate>Only double quotes are accepted as text delimiter (no single quotes).
<li><a id="downloadLink" href="" ng-click="downloadCSVExample()" translate>Download CSV example file</a>
</ul>
@ -57,7 +57,8 @@
<th translate>Text
<th translate>Reason
<th translate>Submitter
<th translate>Category</th>
<th translate>Category
<th translate>Origin</th>
<tbody ng-repeat="motion in motions">
<tr>
<td class="minimum"
@ -99,6 +100,7 @@
<i class="fa fa-plus-circle"></i>
</span>
{{ motion.category }}
<td>{{ motion.origin | limitTo:30 }}{{ motion.origin.length > 30 ? '...' : '' }}
</table>
<div class="text-danger">