Commit
Description ----------- Fixes contao/contao#5390 Commits ------- f837fa9b Added image size edit popup 9bbae923 Correctly remove the button title if the button is disabled 02c43e8e Merge remote-tracking branch 'upstream/5.x' into feature/edit-image-s… deaa259d Update the scripts 93d8747f Merge remote-tracking branch 'upstream/5.x' into feature/edit-image-s… 1ee10611 Correctly enable the image size button 9aef364f Fixed the button title not using Contao tips 10ddcca1 Reset the cursor if a button is disabled Co-authored-by: leofeyer <1192057+leofeyer@users.noreply.github.com>
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import { Controller } from '@hotwired/stimulus'; | ||
|
||
export default class extends Controller { | ||
static values = { | ||
config: Object, | ||
} | ||
|
||
initialize () { | ||
this.updateWizard = this.updateWizard.bind(this); | ||
this.openModal = this.openModal.bind(this); | ||
} | ||
|
||
connect () { | ||
this.select = this.element.querySelector('select'); | ||
this.button = document.createElement('button'); | ||
this.button.type = 'button'; | ||
this.button.title = ''; | ||
this.buttonImage = document.createElement('img'); | ||
this.button.append(this.buttonImage); | ||
this.element.parentNode.classList.add('wizard'); | ||
this.element.after(this.button); | ||
|
||
this.select.addEventListener('change', this.updateWizard); | ||
this.button.addEventListener('click', this.openModal); | ||
|
||
this.updateWizard(); | ||
} | ||
|
||
disconnect () { | ||
this.element.parentNode.classList.remove('wizard'); | ||
this.select.removeEventListener('change', this.updateWizard); | ||
this.buttonImage.remove(); | ||
this.button.remove(); | ||
} | ||
|
||
updateWizard () { | ||
if (this.canEdit()) { | ||
this.button.title = this.configValue.title; | ||
this.button.disabled = false; | ||
this.buttonImage.src = this.configValue.icon; | ||
} else { | ||
this.button.title = ''; | ||
this.button.disabled = true; | ||
this.buttonImage.src = this.configValue.iconDisabled; | ||
} | ||
} | ||
|
||
openModal () { | ||
Backend.openModalIframe({ | ||
title: this.configValue.title, | ||
url: `${ this.configValue.href }&id=${ this.select.value }` | ||
}); | ||
} | ||
|
||
canEdit () { | ||
return this.configValue.ids.includes(Number(this.select.value)); | ||
} | ||
} |
Large diffs are not rendered by default.
Large diffs are not rendered by default.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
This file was deleted.
This file was deleted.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
This file was deleted.
This file was deleted.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,20 @@ | ||
{ | ||
"backend.css": "/system/themes/flexible/backend.6de2ed1d.css", | ||
"confirm.css": "/system/themes/flexible/confirm.db87f830.css", | ||
"conflict.css": "/system/themes/flexible/conflict.b505718e.css", | ||
"diff.css": "/system/themes/flexible/diff.8458d88d.css", | ||
"help.css": "/system/themes/flexible/help.51035033.css", | ||
"login.css": "/system/themes/flexible/login.074d5c37.css", | ||
"popup.css": "/system/themes/flexible/popup.915ea82c.css", | ||
"backend.css": "/system/themes/flexible/backend.0c374b6e.css", | ||
"confirm.css": "/system/themes/flexible/confirm.df2be012.css", | ||
"conflict.css": "/system/themes/flexible/conflict.bdd0ad73.css", | ||
"diff.css": "/system/themes/flexible/diff.71a07c96.css", | ||
"help.css": "/system/themes/flexible/help.9e70b126.css", | ||
"login.css": "/system/themes/flexible/login.54c4a33d.css", | ||
"popup.css": "/system/themes/flexible/popup.56518a36.css", | ||
"tinymce.css": "/system/themes/flexible/tinymce.e5009f94.css", | ||
"tinymce-dark.css": "/system/themes/flexible/tinymce-dark.596023db.css", | ||
"backend.6de2ed1d.css.map": "/system/themes/flexible/backend.6de2ed1d.css.map", | ||
"confirm.db87f830.css.map": "/system/themes/flexible/confirm.db87f830.css.map", | ||
"conflict.b505718e.css.map": "/system/themes/flexible/conflict.b505718e.css.map", | ||
"diff.8458d88d.css.map": "/system/themes/flexible/diff.8458d88d.css.map", | ||
"help.51035033.css.map": "/system/themes/flexible/help.51035033.css.map", | ||
"login.074d5c37.css.map": "/system/themes/flexible/login.074d5c37.css.map", | ||
"popup.915ea82c.css.map": "/system/themes/flexible/popup.915ea82c.css.map", | ||
"backend.0c374b6e.css.map": "/system/themes/flexible/backend.0c374b6e.css.map", | ||
"confirm.df2be012.css.map": "/system/themes/flexible/confirm.df2be012.css.map", | ||
"conflict.bdd0ad73.css.map": "/system/themes/flexible/conflict.bdd0ad73.css.map", | ||
"diff.71a07c96.css.map": "/system/themes/flexible/diff.71a07c96.css.map", | ||
"help.9e70b126.css.map": "/system/themes/flexible/help.9e70b126.css.map", | ||
"login.54c4a33d.css.map": "/system/themes/flexible/login.54c4a33d.css.map", | ||
"popup.56518a36.css.map": "/system/themes/flexible/popup.56518a36.css.map", | ||
"tinymce.e5009f94.css.map": "/system/themes/flexible/tinymce.e5009f94.css.map", | ||
"tinymce-dark.596023db.css.map": "/system/themes/flexible/tinymce-dark.596023db.css.map" | ||
} |
Large diffs are not rendered by default.
Large diffs are not rendered by default.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ | ||
"backend.js": "/bundles/contaocore/backend.53a22055.js", | ||
"backend.53a22055.js.map": "/bundles/contaocore/backend.53a22055.js.map" | ||
"backend.js": "/bundles/contaocore/backend.5859b9cf.js", | ||
"backend.5859b9cf.js.map": "/bundles/contaocore/backend.5859b9cf.js.map" | ||
} |