But back icon preview

This commit is contained in:
Yohan Boniface 2023-09-05 10:29:44 +02:00
parent c5084c4332
commit ce7575c5eb
2 changed files with 9 additions and 4 deletions

View file

@ -399,6 +399,7 @@ input.switch:checked ~ label:after {
padding-top: 5px; padding-top: 5px;
margin-top: 5px; margin-top: 5px;
} }
.umap-field-iconUrl .action-button,
.inheritable .define, .inheritable .define,
.inheritable .undefine { .inheritable .undefine {
float: right; float: right;

View file

@ -513,6 +513,10 @@ L.FormBuilder.BlurInput.include({
}) })
L.FormBuilder.IconUrl = L.FormBuilder.BlurInput.extend({ L.FormBuilder.IconUrl = L.FormBuilder.BlurInput.extend({
type: function () {
return 'hidden'
},
build: function () { build: function () {
L.FormBuilder.BlurInput.prototype.build.call(this) L.FormBuilder.BlurInput.prototype.build.call(this)
// Try to guess if the icon content has been customized, and if yes // Try to guess if the icon content has been customized, and if yes
@ -532,7 +536,7 @@ L.FormBuilder.IconUrl = L.FormBuilder.BlurInput.extend({
}, },
udpatePreview: function () { udpatePreview: function () {
if (L.Util.hasVar(this.value())) { if (!L.Util.hasVar(this.value())) {
// Do not try to render URL with variables // Do not try to render URL with variables
if (this.isUrl()) { if (this.isUrl()) {
const img = L.DomUtil.create( const img = L.DomUtil.create(
@ -552,8 +556,8 @@ L.FormBuilder.IconUrl = L.FormBuilder.BlurInput.extend({
L.DomEvent.on(el, 'click', this.fetchIconList, this) L.DomEvent.on(el, 'click', this.fetchIconList, this)
} }
} }
this.button = L.DomUtil.create('a', 'button', this.buttonsContainer) this.button = L.DomUtil.create('a', 'button action-button', this.buttonsContainer)
this.button.textContent = this.value() ? L._('Change symbol') : L._('Add symbol') this.button.textContent = this.value() ? L._('Change') : L._('Add')
this.button.href = '#' this.button.href = '#'
L.DomEvent.on(this.button, 'click', L.DomEvent.stop).on( L.DomEvent.on(this.button, 'click', L.DomEvent.stop).on(
this.button, this.button,
@ -600,7 +604,7 @@ L.FormBuilder.IconUrl = L.FormBuilder.BlurInput.extend({
for (const idx in data.pictogram_list) { for (const idx in data.pictogram_list) {
this.addIconPreview(data.pictogram_list[idx]) this.addIconPreview(data.pictogram_list[idx])
} }
const closeButton = L.DomUtil.create('a', 'button', this.pictogramsContainer) const closeButton = L.DomUtil.create('a', 'button action-button', this.pictogramsContainer)
closeButton.textContent = L._('Close') closeButton.textContent = L._('Close')
closeButton.href = '#' closeButton.href = '#'
closeButton.style.display = 'block' closeButton.style.display = 'block'