コード例 #1
0
 def render(self, context, instance, placeholder):
     # image shall be rendered in a responsive context using the ``<picture>`` element
     try:
         elements = get_picture_elements(instance)
     except Exception as exc:
         logger.warning(
             "Unable generate picture elements. Reason: {}".format(exc))
     else:
         try:
             if instance.child_plugin_instances and instance.child_plugin_instances[
                     0].plugin_type == 'BootstrapRowPlugin':
                 padding = 'padding: {0}px {0}px;'.format(
                     int(app_settings.CMSPLUGIN_CASCADE['bootstrap4']
                         ['gutter'] / 2))
                 context.update({
                     'add_gutter_if_child_is_BootstrapRowPlugin':
                     padding,
                 })
             context.update({
                 'elements':
                 [e for e in elements if 'media' in e] if elements else [],
                 'CSS_PREFIXES':
                 app_settings.CSS_PREFIXES,
             })
         except Exception as exc:
             logger.warning(
                 "Unable generate picture elements. Reason: {}".format(exc))
     return self.super(BootstrapJumbotronPlugin,
                       self).render(context, instance, placeholder)
コード例 #2
0
 def render(self, context, instance, placeholder):
     # image shall be rendered in a responsive context using the ``<picture>`` element
     try:
         elements = get_picture_elements(instance)
     except Exception as exc:
         logger.warning("Unable generate picture elements. Reason: {}".format(exc))
     else:
         context.update({
             'elements': [e for e in elements if 'media' in e] if elements else [],
             'CSS_PREFIXES': app_settings.CSS_PREFIXES,
         })
     return self.super(BootstrapJumbotronPlugin, self).render(context, instance, placeholder)
コード例 #3
0
ファイル: jumbotron.py プロジェクト: jrief/djangocms-cascade
 def render(self, context, instance, placeholder):
     # image shall be rendered in a responsive context using the ``<picture>`` element
     try:
         elements = get_picture_elements(instance)
     except Exception as exc:
         logger.warning("Unable generate picture elements. Reason: {}".format(exc))
     else:
         if instance.child_plugin_instances and instance.child_plugin_instances[0].plugin_type == 'BootstrapRowPlugin':
             padding='padding: {0}px {0}px;'.format(int( app_settings.CMSPLUGIN_CASCADE['bootstrap4']['gutter']/2))
             context.update({'add_gutter_if_child_is_BootstrapRowPlugin': padding,})
         context.update({
             'elements': [e for e in elements if 'media' in e] if elements else [],
             'CSS_PREFIXES': app_settings.CSS_PREFIXES,
         })
     return self.super(BootstrapJumbotronPlugin, self).render(context, instance, placeholder)
コード例 #4
0
 def render(self, context, instance, placeholder):
     context = self.super(BootstrapCarouselSlidePlugin,
                          self).render(context, instance, placeholder)
     # slide image shall be rendered in a responsive context using the ``<picture>`` element
     try:
         parent_glossary = instance.parent.get_bound_plugin().glossary
         instance.glossary.update(
             responsive_heights=parent_glossary['container_max_heights'])
         elements = get_picture_elements(instance)
     except Exception as exc:
         logger.warning(
             "Unable generate picture elements. Reason: {}".format(exc))
     else:
         context.update({
             'is_fluid': False,
             'elements': elements,
         })
     return context