0b5f75339e
* Fixed agenda permissions * Renamed assignment to assignments, fixed assignments permission names * Renamed mediafile to mediafiles * Renamed motion to motions. Fixed motions permission names
32 lines
1.0 KiB
Python
32 lines
1.0 KiB
Python
from django.utils.translation import ugettext_lazy
|
|
|
|
from openslides.utils.widgets import Widget
|
|
from openslides.projector.api import get_active_slide
|
|
|
|
from .models import Mediafile
|
|
|
|
|
|
class PDFPresentationWidget(Widget):
|
|
"""
|
|
Widget for presentable PDF files.
|
|
"""
|
|
name = 'presentations'
|
|
verbose_name = ugettext_lazy('Presentations')
|
|
required_permission = 'core.can_manage_projector'
|
|
default_column = 1
|
|
default_weight = 75
|
|
template_name = 'mediafiles/widget_pdfpresentation.html'
|
|
icon_css_class = 'icon-align-left'
|
|
more_link_pattern_name = 'mediafile_list'
|
|
# javascript_files = None # TODO: Add pdf.js stuff here.
|
|
|
|
def get_context_data(self, **context):
|
|
pdfs = Mediafile.objects.filter(
|
|
filetype__in=Mediafile.PRESENTABLE_FILE_TYPES,
|
|
is_presentable=True)
|
|
current_page = get_active_slide().get('page_num', 1)
|
|
return super(PDFPresentationWidget, self).get_context_data(
|
|
pdfs=pdfs,
|
|
current_page=current_page,
|
|
**context)
|