Added attachments for customslide views. (Fixes #1681)
This commit is contained in:
parent
8a6ca904dc
commit
f2375008d8
@ -7,14 +7,14 @@ from django.db import migrations, models
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('mediafiles', '0004_auto_20151210_0016'),
|
||||
('core', '0008_auto_20151210_0016'),
|
||||
('mediafiles', '0002_auto_20160110_0103'),
|
||||
('core', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='customslide',
|
||||
name='attachments',
|
||||
field=models.ManyToManyField(to='mediafiles.Mediafile', verbose_name='Attachments', blank=True),
|
||||
field=models.ManyToManyField(to='mediafiles.Mediafile', blank=True),
|
||||
),
|
||||
]
|
@ -130,7 +130,6 @@ class CustomSlide(RESTModelMixin, models.Model):
|
||||
default=0)
|
||||
attachments = models.ManyToManyField(
|
||||
Mediafile,
|
||||
verbose_name=ugettext_lazy('Attachments'),
|
||||
blank=True)
|
||||
|
||||
class Meta:
|
||||
|
@ -186,6 +186,12 @@ angular.module('OpenSlidesApp.core', [
|
||||
localKey: 'agenda_item_id',
|
||||
localField: 'agenda_item',
|
||||
}
|
||||
},
|
||||
hasMany: {
|
||||
'mediafiles/mediafile': {
|
||||
localField: 'attachments',
|
||||
localKeys: 'attachments_id',
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -459,7 +459,8 @@ angular.module('OpenSlidesApp.core.site', [
|
||||
.factory('CustomslideFormFieldFactory', [
|
||||
'gettextCatalog',
|
||||
'CKEditorOptions',
|
||||
function (gettextCatalog, CKEditorOptions) {
|
||||
'Mediafile',
|
||||
function (gettextCatalog, CKEditorOptions, Mediafile) {
|
||||
return {
|
||||
getFormFields: function () {
|
||||
return [
|
||||
@ -478,7 +479,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