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 values = { url: String, height: String }
|
||||
static values = { url: String, height: String, type: String }
|
||||
|
||||
connect() {
|
||||
let elements = []
|
||||
let type = this.hasTypeValue ? this.typeValue : 'image'
|
||||
if (this.hasUrlValue) {
|
||||
let element = { href: this.urlValue }
|
||||
let element = { href: this.urlValue, type }
|
||||
if (this.hasHeightValue) {
|
||||
element.height = this.heightValue
|
||||
}
|
||||
elements.push(element)
|
||||
} else if (this.element.hasAttribute('href')) {
|
||||
let element = { href: this.element.href }
|
||||
let element = { href: this.element.href, type }
|
||||
elements.push(element)
|
||||
} else {
|
||||
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
|
||||
if (null !== caption) {
|
||||
element.title = caption
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
data-controller="lightbox"
|
||||
data-lightbox-height-value="85vh"
|
||||
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">
|
||||
Preisberechnung
|
||||
</button>
|
||||
|
||||
Reference in New Issue
Block a user