From 372ed16c1f733caa4ef1d982ed841867dce34680 Mon Sep 17 00:00:00 2001 From: thex Date: Thu, 28 May 2020 16:30:36 +0200 Subject: [PATCH] improved breakpoint handling, fixed issue with link exchange --- src/default/owlcarousel-neo.html.twig | 17 ++++++++++++++--- src/default/owlcarousel-neo.yaml | 6 +++--- src/default/translation/de/owlcarousel-neo.yaml | 6 +++--- src/legacy/owlcarousel-neo.yaml | 6 +++--- src/legacy/translation/de/owlcarousel-neo.yaml | 6 +++--- 5 files changed, 26 insertions(+), 15 deletions(-) diff --git a/src/default/owlcarousel-neo.html.twig b/src/default/owlcarousel-neo.html.twig index 4947dd6..6186e54 100644 --- a/src/default/owlcarousel-neo.html.twig +++ b/src/default/owlcarousel-neo.html.twig @@ -201,6 +201,7 @@ {% else %} {% set slideLinkBreakpointPx = slideLinkBreakpointPx|slice(0, slideLinkBreakpointPx.length - 2) %} {% endif %} + {% set slideLinkBreakpointPx = slideLinkBreakpointPx - 1 %} {% endif %} {% set slideItemStyle = (particle.delaySlideElements) ? 'display: none;' : '' %} @@ -454,8 +455,12 @@ var link = jQuery(this).find('> a'); link.parent().html(link.html()); jQuery(this).find('[data-html]').each(function() { - jQuery(this).html(jQuery(this).attr('data-html')); - jQuery(this).removeAttr('data-html'); + if(jQuery(this).is('h1')) { + jQuery(this).replaceWith(jQuery(this).attr('data-html')); + } else { + jQuery(this).html(jQuery(this).attr('data-html')); + jQuery(this).removeAttr('data-html'); + } }); } } @@ -535,7 +540,13 @@ {% if image.breakpoint and image.breakpoint != 'disable' %} {% set imgWidth = (image.breakpoint == 'custom') ? image.customBreakpoint : gantry.config.styles.breakpoints[image.breakpoint] %} {% if imgWidth and imgWidth != '' and image.img %} - + {% if imgWidth ends with 'rem' %} + {% set imgWidth = (imgWidth|slice(0, imgWidth.length - 3)) * 16 %} + {% else %} + {% set imgWidth = imgWidth|slice(0, imgWidth.length - 2) %} + {% endif %} + {% set imgWidth = (image.breakpoint == 'custom') ? imgWidth : imgWidth - 1 %} + {% endif %} {% endif %} {% endfor %} diff --git a/src/default/owlcarousel-neo.yaml b/src/default/owlcarousel-neo.yaml index 5ba7411..7c014b3 100644 --- a/src/default/owlcarousel-neo.yaml +++ b/src/default/owlcarousel-neo.yaml @@ -489,7 +489,7 @@ form: type: input.text label: Breakpoint description: Define at what width (in pixel) the here defined options should be applied. The basic settings are overriden so you might need to define at least two breakpoints for your desired behavior. - placeholder: e.g. 768 (in pixel) + placeholder: e.g. 768 in pixel default: '' ._info_responsive_settings: type: separator.note @@ -864,13 +864,13 @@ form: label: Manual Width description: The manual width applied to the style attribute of the slide item. This option should be used together with Manual Dimension located at the general slide settings. default: '' - placeholder: e.g. 250 (in pixel) + placeholder: e.g. 250 in pixel .manual_height: type: input.text label: Manual Height description: The manual height applied to the style attribute of the slide item. This option should be used together with Manual Dimension located at the general slide settings. default: '' - placeholder: e.g. 250 (in pixel) + placeholder: e.g. 250 in pixel .link: type: input.text label: Link diff --git a/src/default/translation/de/owlcarousel-neo.yaml b/src/default/translation/de/owlcarousel-neo.yaml index beadb6f..bae13f3 100644 --- a/src/default/translation/de/owlcarousel-neo.yaml +++ b/src/default/translation/de/owlcarousel-neo.yaml @@ -489,7 +489,7 @@ form: type: input.text label: Breakpoint description: Legen Sie fest, bei welcher Breite (in Pixel) die hier definierten Optionen angewendet werde sollen. Die übergeordneten Einstellungen werden überschrieben, deshalb brauchen Sie wahrscheinlich zwei Breakpoints, um das erwartete Resultat zu erhalten. - placeholder: z.B.: 768 (in pixel) + placeholder: z.B.: 768 in pixel default: '' ._info_responsive_settings: type: separator.note @@ -864,13 +864,13 @@ form: label: Manuelle Breite description: Die manuelle Breite die auf das style Attribut des Slideelements angewendet wird. Diese Option sollte zusammen mit der Einstellung Manuelle Größe in den allgemeinen Slide Einstellungen verwendet werden. default: '' - placeholder: z.B.: 250 (in pixel) + placeholder: z.B.: 250 in pixel .manual_height: type: input.text label: Manuelle Höhe description: Die manuelle Höhe die auf das style Attribut des Slideelements angewendet wird. Diese Option sollte zusammen mit der Einstellung Manuelle Größe in den allgemeinen Slide Einstellungen verwendet werden. default: '' - placeholder: z.B.: 250 (in pixel) + placeholder: z.B.: 250 in pixel .link: type: input.text label: Link diff --git a/src/legacy/owlcarousel-neo.yaml b/src/legacy/owlcarousel-neo.yaml index 6e436e1..5b61a53 100644 --- a/src/legacy/owlcarousel-neo.yaml +++ b/src/legacy/owlcarousel-neo.yaml @@ -489,7 +489,7 @@ form: type: input.text label: Breakpoint description: Define at what width (in pixel) the here defined options should be applied. The basic settings are overriden so you might need to define at least two breakpoints for your desired behavior. - placeholder: e.g. 768 (in pixel) + placeholder: e.g. 768 in pixel default: '' ._info_responsive_settings: type: separator.note @@ -867,13 +867,13 @@ form: label: Manual Width description: The manual width applied to the style attribute of the slide item. This option should be used together with Manual Dimension located at the general slide settings. default: '' - placeholder: e.g. 250 (in pixel) + placeholder: e.g. 250 in pixel .manual_height: type: input.text label: Manual Height description: The manual height applied to the style attribute of the slide item. This option should be used together with Manual Dimension located at the general slide settings. default: '' - placeholder: e.g. 250 (in pixel) + placeholder: e.g. 250 in pixel .link: type: input.text label: Link diff --git a/src/legacy/translation/de/owlcarousel-neo.yaml b/src/legacy/translation/de/owlcarousel-neo.yaml index f3e84e6..2a949be 100644 --- a/src/legacy/translation/de/owlcarousel-neo.yaml +++ b/src/legacy/translation/de/owlcarousel-neo.yaml @@ -489,7 +489,7 @@ form: type: input.text label: Breakpoint description: Legen Sie fest, bei welcher Breite (in Pixel) die hier definierten Optionen angewendet werde sollen. Die übergeordneten Einstellungen werden überschrieben, deshalb brauchen Sie wahrscheinlich zwei Breakpoints, um das erwartete Resultat zu erhalten. - placeholder: z.B.: 768 (in pixel) + placeholder: z.B.: 768 in pixel default: '' ._info_responsive_settings: type: separator.note @@ -867,13 +867,13 @@ form: label: Manuelle Breite description: Die manuelle Breite die auf das style Attribut des Slideelements angewendet wird. Diese Option sollte zusammen mit der Einstellung Manuelle Größe in den allgemeinen Slide Einstellungen verwendet werden. default: '' - placeholder: z.B.: 250 (in pixel) + placeholder: z.B.: 250 in pixel .manual_height: type: input.text label: Manuelle Höhe description: Die manuelle Höhe die auf das style Attribut des Slideelements angewendet wird. Diese Option sollte zusammen mit der Einstellung Manuelle Größe in den allgemeinen Slide Einstellungen verwendet werden. default: '' - placeholder: z.B.: 250 (in pixel) + placeholder: z.B.: 250 in pixel .link: type: input.text label: Link