Merge pull request #1809 from emanuelschuetze/CustomSlideAttachment
Custom slide attachment
This commit is contained in:
commit
aa6a099840
@ -13,6 +13,7 @@ Agenda:
|
||||
- Changed API of related objects. All assignments, motions and custom slides
|
||||
are now agenda items and can be hidden.
|
||||
- Removed mptt.
|
||||
- Added attachments to custom slides.
|
||||
Assignments:
|
||||
- Renamed app from assignment to assignments.
|
||||
- Removed possibility to block candidates.
|
||||
|
20
openslides/core/migrations/0002_customslide_attachments.py
Normal file
20
openslides/core/migrations/0002_customslide_attachments.py
Normal file
@ -0,0 +1,20 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('mediafiles', '0002_auto_20160110_0103'),
|
||||
('core', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='customslide',
|
||||
name='attachments',
|
||||
field=models.ManyToManyField(to='mediafiles.Mediafile', blank=True),
|
||||
),
|
||||
]
|
@ -5,6 +5,7 @@ from django.db import models
|
||||
from django.utils.translation import ugettext_noop
|
||||
from jsonfield import JSONField
|
||||
|
||||
from openslides.mediafiles.models import Mediafile
|
||||
from openslides.utils.models import RESTModelMixin
|
||||
from openslides.utils.projector import ProjectorElement
|
||||
|
||||
@ -127,6 +128,9 @@ class CustomSlide(RESTModelMixin, models.Model):
|
||||
blank=True)
|
||||
weight = models.IntegerField(
|
||||
default=0)
|
||||
attachments = models.ManyToManyField(
|
||||
Mediafile,
|
||||
blank=True)
|
||||
|
||||
class Meta:
|
||||
default_permissions = ()
|
||||
|
@ -39,7 +39,7 @@ class CustomSlideSerializer(ModelSerializer):
|
||||
"""
|
||||
class Meta:
|
||||
model = CustomSlide
|
||||
fields = ('id', 'title', 'text', 'weight', 'agenda_item_id')
|
||||
fields = ('id', 'title', 'text', 'weight', 'attachments', 'agenda_item_id')
|
||||
|
||||
|
||||
class TagSerializer(ModelSerializer):
|
||||
|
@ -188,6 +188,12 @@ angular.module('OpenSlidesApp.core', [
|
||||
localKey: 'agenda_item_id',
|
||||
localField: 'agenda_item',
|
||||
}
|
||||
},
|
||||
hasMany: {
|
||||
'mediafiles/mediafile': {
|
||||
localField: 'attachments',
|
||||
localKeys: 'attachments_id',
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -466,7 +466,8 @@ angular.module('OpenSlidesApp.core.site', [
|
||||
.factory('CustomslideFormFieldFactory', [
|
||||
'gettextCatalog',
|
||||
'CKEditorOptions',
|
||||
function (gettextCatalog, CKEditorOptions) {
|
||||
'Mediafile',
|
||||
function (gettextCatalog, CKEditorOptions, Mediafile) {
|
||||
return {
|
||||
getFormFields: function () {
|
||||
return [
|
||||
@ -485,7 +486,21 @@ angular.module('OpenSlidesApp.core.site', [
|
||||
label: gettextCatalog.getString('Text')
|
||||
},
|
||||
ngModelElAttrs: {'ckeditor': 'CKEditorOptions'}
|
||||
}];
|
||||
},
|
||||
{
|
||||
key: 'attachments_id',
|
||||
type: 'ui-select-multiple',
|
||||
templateOptions: {
|
||||
label: gettextCatalog.getString('Attachment'),
|
||||
optionsAttr: 'bs-options',
|
||||
options: Mediafile.getAll(),
|
||||
ngOptions: 'option[to.valueProp] as option in to.options | filter: $select.search',
|
||||
valueProp: 'id',
|
||||
labelProp: 'title_or_filename',
|
||||
placeholder: gettextCatalog.getString('Select or search an attachment ...')
|
||||
}
|
||||
},
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -25,4 +25,11 @@
|
||||
|
||||
<div class="details">
|
||||
<div ng-bind-html="customslide.text"></div>
|
||||
<h3 ng-if="customslide.attachments.length > 0" translate>Attachments</h3>
|
||||
<ul>
|
||||
<li ng-repeat="attachment in customslide.attachments">
|
||||
<a href="{{ attachment.mediafileUrl }}" target="_blank">
|
||||
{{ attachment.title_or_filename }}
|
||||
</a>
|
||||
</ul>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user