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
|
- Changed API of related objects. All assignments, motions and custom slides
|
||||||
are now agenda items and can be hidden.
|
are now agenda items and can be hidden.
|
||||||
- Removed mptt.
|
- Removed mptt.
|
||||||
|
- Added attachments to custom slides.
|
||||||
Assignments:
|
Assignments:
|
||||||
- Renamed app from assignment to assignments.
|
- Renamed app from assignment to assignments.
|
||||||
- Removed possibility to block candidates.
|
- 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 django.utils.translation import ugettext_noop
|
||||||
from jsonfield import JSONField
|
from jsonfield import JSONField
|
||||||
|
|
||||||
|
from openslides.mediafiles.models import Mediafile
|
||||||
from openslides.utils.models import RESTModelMixin
|
from openslides.utils.models import RESTModelMixin
|
||||||
from openslides.utils.projector import ProjectorElement
|
from openslides.utils.projector import ProjectorElement
|
||||||
|
|
||||||
@ -127,6 +128,9 @@ class CustomSlide(RESTModelMixin, models.Model):
|
|||||||
blank=True)
|
blank=True)
|
||||||
weight = models.IntegerField(
|
weight = models.IntegerField(
|
||||||
default=0)
|
default=0)
|
||||||
|
attachments = models.ManyToManyField(
|
||||||
|
Mediafile,
|
||||||
|
blank=True)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
default_permissions = ()
|
default_permissions = ()
|
||||||
|
@ -39,7 +39,7 @@ class CustomSlideSerializer(ModelSerializer):
|
|||||||
"""
|
"""
|
||||||
class Meta:
|
class Meta:
|
||||||
model = CustomSlide
|
model = CustomSlide
|
||||||
fields = ('id', 'title', 'text', 'weight', 'agenda_item_id')
|
fields = ('id', 'title', 'text', 'weight', 'attachments', 'agenda_item_id')
|
||||||
|
|
||||||
|
|
||||||
class TagSerializer(ModelSerializer):
|
class TagSerializer(ModelSerializer):
|
||||||
|
@ -188,6 +188,12 @@ angular.module('OpenSlidesApp.core', [
|
|||||||
localKey: 'agenda_item_id',
|
localKey: 'agenda_item_id',
|
||||||
localField: 'agenda_item',
|
localField: 'agenda_item',
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
hasMany: {
|
||||||
|
'mediafiles/mediafile': {
|
||||||
|
localField: 'attachments',
|
||||||
|
localKeys: 'attachments_id',
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -466,7 +466,8 @@ angular.module('OpenSlidesApp.core.site', [
|
|||||||
.factory('CustomslideFormFieldFactory', [
|
.factory('CustomslideFormFieldFactory', [
|
||||||
'gettextCatalog',
|
'gettextCatalog',
|
||||||
'CKEditorOptions',
|
'CKEditorOptions',
|
||||||
function (gettextCatalog, CKEditorOptions) {
|
'Mediafile',
|
||||||
|
function (gettextCatalog, CKEditorOptions, Mediafile) {
|
||||||
return {
|
return {
|
||||||
getFormFields: function () {
|
getFormFields: function () {
|
||||||
return [
|
return [
|
||||||
@ -485,7 +486,21 @@ angular.module('OpenSlidesApp.core.site', [
|
|||||||
label: gettextCatalog.getString('Text')
|
label: gettextCatalog.getString('Text')
|
||||||
},
|
},
|
||||||
ngModelElAttrs: {'ckeditor': 'CKEditorOptions'}
|
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 class="details">
|
||||||
<div ng-bind-html="customslide.text"></div>
|
<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>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user