fix: provide lightbox content type to avoid iframes for images
This commit is contained in:
+5
-4
@@ -5,22 +5,23 @@ export default class extends Controller {
|
|||||||
|
|
||||||
static targets = [ 'thumb' ]
|
static targets = [ 'thumb' ]
|
||||||
|
|
||||||
static values = { url: String, height: String }
|
static values = { url: String, height: String, type: String }
|
||||||
|
|
||||||
connect() {
|
connect() {
|
||||||
let elements = []
|
let elements = []
|
||||||
|
let type = this.hasTypeValue ? this.typeValue : 'image'
|
||||||
if (this.hasUrlValue) {
|
if (this.hasUrlValue) {
|
||||||
let element = { href: this.urlValue }
|
let element = { href: this.urlValue, type }
|
||||||
if (this.hasHeightValue) {
|
if (this.hasHeightValue) {
|
||||||
element.height = this.heightValue
|
element.height = this.heightValue
|
||||||
}
|
}
|
||||||
elements.push(element)
|
elements.push(element)
|
||||||
} else if (this.element.hasAttribute('href')) {
|
} else if (this.element.hasAttribute('href')) {
|
||||||
let element = { href: this.element.href }
|
let element = { href: this.element.href, type }
|
||||||
elements.push(element)
|
elements.push(element)
|
||||||
} else {
|
} else {
|
||||||
this.thumbTargets.forEach(thumb => {
|
this.thumbTargets.forEach(thumb => {
|
||||||
let element = { href: thumb.href }
|
let element = { href: thumb.href, type }
|
||||||
let caption = this.element.hasAttribute('data-lightbox-caption') ? this.element.dataset.lightboxCaption : null
|
let caption = this.element.hasAttribute('data-lightbox-caption') ? this.element.dataset.lightboxCaption : null
|
||||||
if (null !== caption) {
|
if (null !== caption) {
|
||||||
element.title = caption
|
element.title = caption
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
data-controller="lightbox"
|
data-controller="lightbox"
|
||||||
data-lightbox-height-value="85vh"
|
data-lightbox-height-value="85vh"
|
||||||
data-lightbox-url-value="{f:uri.action(action: 'index', controller: 'GroupsPrice', arguments: '{hotel: hotel}', pageUid: settings.groupsPricePopupPageUid)}"
|
data-lightbox-url-value="{f:uri.action(action: 'index', controller: 'GroupsPrice', arguments: '{hotel: hotel}', pageUid: settings.groupsPricePopupPageUid)}"
|
||||||
|
data-lightbox-type-value="external"
|
||||||
data-action="lightbox#open">
|
data-action="lightbox#open">
|
||||||
Preisberechnung
|
Preisberechnung
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
Reference in New Issue
Block a user