This commit is contained in:
roberto 2024-12-20 18:08:51 +01:00
parent 582ff4ac91
commit f4a0a6121e
10 changed files with 101 additions and 2615 deletions

View File

@ -1,4 +1,4 @@
<div class="w3-row w3-section" id="FieldsValues-New-{{type_field_id}}-{{counter}}"> <div class="field" id="FieldsValues-New-{{type_field_id}}-{{counter}}">
<div class="w3-col s10 m11 l11" style="padding-right: 4px;"><label for="FieldsValues-{{type_field_id}}-{{counter}}"></label><input id="FieldsValues-{{type_field_id}}-{{counter}}" type="text" name="FieldsValues-{{type_field_id}}-{{counter}}" value="{{value}}" class="w3-input w3-border"></div> <div class="field-values"><label for="FieldsValues-{{type_field_id}}-{{counter}}"></label><input id="FieldsValues-{{type_field_id}}-{{counter}}" type="text" name="FieldsValues-{{type_field_id}}-{{counter}}" value="{{value}}"></div>
<div class="w3-col w3-right-align s2 m1 l1"><button onclick="document.getElementById('FieldsValues-New-{{type_field_id}}-{{counter}}').remove()" type="button" class="w3-button w3-small w3-delete w3-border w3-round-large"><i class="bi bi-dash-square-fill"></i></button></div> <div class="field-buttons"><button onclick="document.getElementById('FieldsValues-New-{{type_field_id}}-{{counter}}').remove()" type="button"><i class="bi bi-dash-square-fill"></i></button></div>
</div> </div>

View File

@ -1,4 +1,4 @@
<div class="w3-row w3-section" id="FieldsValues-New-{{type_field_id}}-{{counter}}"> <div class="field" id="FieldsValues-New-{{type_field_id}}-{{counter}}">
<div class="w3-col s10 m11 l11" style="padding-right: 4px;"><label for="FieldsValues-{{type_field_id}}-{{counter}}"></label><input id="FieldsValues-{{type_field_id}}-{{counter}}" type="url" name="FieldsValues-{{type_field_id}}-{{counter}}" value="{{value}}" class="w3-input w3-border"></div> <div class="field-value" style="padding-right: 4px;"><label for="FieldsValues-{{type_field_id}}-{{counter}}"></label><input id="FieldsValues-{{type_field_id}}-{{counter}}" type="url" name="FieldsValues-{{type_field_id}}-{{counter}}" value="{{value}}"></div>
<div class="w3-col w3-right-align s2 m1 l1"><button onclick="document.getElementById('FieldsValues-New-{{type_field_id}}-{{counter}}').remove()" type="button" class="w3-button w3-small w3-delete w3-border w3-round-large"><i class="bi bi-dash-square-fill"></i></button></div> <div class="field-buttons"><button onclick="document.getElementById('FieldsValues-New-{{type_field_id}}-{{counter}}').remove()" type="button" class="delete"><i class="bi bi-dash-square-fill"></i></button></div>
</div> </div>

View File

@ -213,7 +213,6 @@ textarea {
button, .button { button, .button {
border: none; border: none;
display: inline-block;
vertical-align: middle; vertical-align: middle;
overflow: hidden; overflow: hidden;
text-decoration: none; text-decoration: none;
@ -654,6 +653,7 @@ th.operations, td.operations {
display:flex; display:flex;
align-items:center; align-items:center;
flex-direction: row; flex-direction: row;
margin-bottom: 5px;
} }
.field-value { .field-value {
@ -665,6 +665,10 @@ th.operations, td.operations {
width: 50px; width: 50px;
} }
.field-opaque {
opacity: 0.25;
}
.col, .col,
.half, .half,
.third, .third,

File diff suppressed because one or more lines are too long

View File

@ -161,13 +161,35 @@ function bm_show_confirm(sender, title, message) {
} }
function bm_item_field_add(type_field_id, widget) { function bm_item_field_add(type_field_id, widget) {
let template = Handlebars.templates['items/field-' + widget] let template = Handlebars.templates['field-' + widget]
let fields_list = document.getElementById('fields-' + type_field_id); let fields_list = document.getElementById('fields-' + type_field_id);
let counter = parseInt(document.getElementById('fields-' + type_field_id + '-counter').innerHTML); let counter = parseInt(document.getElementById('fields-' + type_field_id + '-counter').innerHTML);
fields_list.insertAdjacentHTML('beforeend', template({type_field_id:type_field_id,counter:counter, value:""})); fields_list.insertAdjacentHTML('beforeend', template({type_field_id:type_field_id,counter:counter, value:""}));
document.getElementById('fields-' + type_field_id + '-counter').innerHTML = (counter + 1).toString(); document.getElementById('fields-' + type_field_id + '-counter').innerHTML = (counter + 1).toString();
} }
function bm_item_field_delete(sender, field_name) {
document.getElementById('FieldsValuesToRemove-' + field_name).value = '1';
sender.hidden = true;
document.getElementById('Undelete-' + field_name).hidden = false;
document.getElementById('FieldsValues-' + field_name).classList.add('field-opaque');
}
function bm_item_field_undelete(sender, field_name) {
document.getElementById('FieldsValuesToRemove-' + field_name).value = '';
sender.hidden = true;
document.getElementById('Delete-' + field_name).hidden = false;
document.getElementById('FieldsValues-' + field_name).classList.remove('field-opaque');
}
function bm_showMessage() {
document.getElementById('message').show();
setTimeout(() => {
document.getElementById('message').close();
document.getElementById('message').innerHTML = '';
}, "5000");
}
document.addEventListener("DOMContentLoaded", function(event){ document.addEventListener("DOMContentLoaded", function(event){
// const easyMDE = new EasyMDE({autosave: {enabled: true, uniqueId: 'eMDE-item-descriotion'}, element: document.getElementById('item-description')}); // const easyMDE = new EasyMDE({autosave: {enabled: true, uniqueId: 'eMDE-item-descriotion'}, element: document.getElementById('item-description')});
/* /*
@ -214,6 +236,8 @@ document.addEventListener("DOMContentLoaded", function(event){
}); });
document.body.addEventListener("closeQuickboxTransformModal", function(evt){ document.body.addEventListener("closeQuickboxTransformModal", function(evt){
bm_showMessage();
document.getElementById('dialog').close(); document.getElementById('dialog').close();
document.getElementById('dialog').remove(); document.getElementById('dialog').remove();
if(evt.detail.keepQuickNote == 0){ if(evt.detail.keepQuickNote == 0){
@ -226,11 +250,7 @@ document.addEventListener("DOMContentLoaded", function(event){
}); });
document.body.addEventListener("showMessage", function(evt){ document.body.addEventListener("showMessage", function(evt){
document.getElementById('message').show(); bm_showMessage();
setTimeout(() => {
document.getElementById('message').close();
document.getElementById('message').innerHTML = '';
}, "5000");
}); });
new SlimSelect({select: '.slim-select'}); new SlimSelect({select: '.slim-select'});

View File

@ -1,6 +1,6 @@
(function() { (function() {
var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {}; var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
templates['items/field-text'] = template({"compiler":[8,">= 4.3.0"],"main":function(container,depth0,helpers,partials,data) { templates['field-text'] = template({"compiler":[8,">= 4.3.0"],"main":function(container,depth0,helpers,partials,data) {
var helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=container.hooks.helperMissing, alias3="function", alias4=container.escapeExpression, lookupProperty = container.lookupProperty || function(parent, propertyName) { var helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=container.hooks.helperMissing, alias3="function", alias4=container.escapeExpression, lookupProperty = container.lookupProperty || function(parent, propertyName) {
if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
return parent[propertyName]; return parent[propertyName];
@ -8,31 +8,31 @@ templates['items/field-text'] = template({"compiler":[8,">= 4.3.0"],"main":funct
return undefined return undefined
}; };
return "<div class=\"w3-row w3-section\" id=\"FieldsValues-New-" return "<div class=\"field\" id=\"FieldsValues-New-"
+ alias4(((helper = (helper = lookupProperty(helpers,"type_field_id") || (depth0 != null ? lookupProperty(depth0,"type_field_id") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"type_field_id","hash":{},"data":data,"loc":{"start":{"line":1,"column":52},"end":{"line":1,"column":69}}}) : helper))) + alias4(((helper = (helper = lookupProperty(helpers,"type_field_id") || (depth0 != null ? lookupProperty(depth0,"type_field_id") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"type_field_id","hash":{},"data":data,"loc":{"start":{"line":1,"column":40},"end":{"line":1,"column":57}}}) : helper)))
+ "-" + "-"
+ alias4(((helper = (helper = lookupProperty(helpers,"counter") || (depth0 != null ? lookupProperty(depth0,"counter") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"counter","hash":{},"data":data,"loc":{"start":{"line":1,"column":70},"end":{"line":1,"column":81}}}) : helper))) + alias4(((helper = (helper = lookupProperty(helpers,"counter") || (depth0 != null ? lookupProperty(depth0,"counter") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"counter","hash":{},"data":data,"loc":{"start":{"line":1,"column":58},"end":{"line":1,"column":69}}}) : helper)))
+ "\">\n <div class=\"w3-col s10 m11 l11\" style=\"padding-right: 4px;\"><label for=\"FieldsValues-" + "\">\n <div class=\"field-values\"><label for=\"FieldsValues-"
+ alias4(((helper = (helper = lookupProperty(helpers,"type_field_id") || (depth0 != null ? lookupProperty(depth0,"type_field_id") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"type_field_id","hash":{},"data":data,"loc":{"start":{"line":2,"column":89},"end":{"line":2,"column":106}}}) : helper))) + alias4(((helper = (helper = lookupProperty(helpers,"type_field_id") || (depth0 != null ? lookupProperty(depth0,"type_field_id") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"type_field_id","hash":{},"data":data,"loc":{"start":{"line":2,"column":55},"end":{"line":2,"column":72}}}) : helper)))
+ "-" + "-"
+ alias4(((helper = (helper = lookupProperty(helpers,"counter") || (depth0 != null ? lookupProperty(depth0,"counter") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"counter","hash":{},"data":data,"loc":{"start":{"line":2,"column":107},"end":{"line":2,"column":118}}}) : helper))) + alias4(((helper = (helper = lookupProperty(helpers,"counter") || (depth0 != null ? lookupProperty(depth0,"counter") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"counter","hash":{},"data":data,"loc":{"start":{"line":2,"column":73},"end":{"line":2,"column":84}}}) : helper)))
+ "\"></label><input id=\"FieldsValues-" + "\"></label><input id=\"FieldsValues-"
+ alias4(((helper = (helper = lookupProperty(helpers,"type_field_id") || (depth0 != null ? lookupProperty(depth0,"type_field_id") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"type_field_id","hash":{},"data":data,"loc":{"start":{"line":2,"column":152},"end":{"line":2,"column":169}}}) : helper))) + alias4(((helper = (helper = lookupProperty(helpers,"type_field_id") || (depth0 != null ? lookupProperty(depth0,"type_field_id") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"type_field_id","hash":{},"data":data,"loc":{"start":{"line":2,"column":118},"end":{"line":2,"column":135}}}) : helper)))
+ "-" + "-"
+ alias4(((helper = (helper = lookupProperty(helpers,"counter") || (depth0 != null ? lookupProperty(depth0,"counter") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"counter","hash":{},"data":data,"loc":{"start":{"line":2,"column":170},"end":{"line":2,"column":181}}}) : helper))) + alias4(((helper = (helper = lookupProperty(helpers,"counter") || (depth0 != null ? lookupProperty(depth0,"counter") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"counter","hash":{},"data":data,"loc":{"start":{"line":2,"column":136},"end":{"line":2,"column":147}}}) : helper)))
+ "\" type=\"text\" name=\"FieldsValues-" + "\" type=\"text\" name=\"FieldsValues-"
+ alias4(((helper = (helper = lookupProperty(helpers,"type_field_id") || (depth0 != null ? lookupProperty(depth0,"type_field_id") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"type_field_id","hash":{},"data":data,"loc":{"start":{"line":2,"column":214},"end":{"line":2,"column":231}}}) : helper))) + alias4(((helper = (helper = lookupProperty(helpers,"type_field_id") || (depth0 != null ? lookupProperty(depth0,"type_field_id") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"type_field_id","hash":{},"data":data,"loc":{"start":{"line":2,"column":180},"end":{"line":2,"column":197}}}) : helper)))
+ "-" + "-"
+ alias4(((helper = (helper = lookupProperty(helpers,"counter") || (depth0 != null ? lookupProperty(depth0,"counter") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"counter","hash":{},"data":data,"loc":{"start":{"line":2,"column":232},"end":{"line":2,"column":243}}}) : helper))) + alias4(((helper = (helper = lookupProperty(helpers,"counter") || (depth0 != null ? lookupProperty(depth0,"counter") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"counter","hash":{},"data":data,"loc":{"start":{"line":2,"column":198},"end":{"line":2,"column":209}}}) : helper)))
+ "\" value=\"" + "\" value=\""
+ alias4(((helper = (helper = lookupProperty(helpers,"value") || (depth0 != null ? lookupProperty(depth0,"value") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"value","hash":{},"data":data,"loc":{"start":{"line":2,"column":252},"end":{"line":2,"column":261}}}) : helper))) + alias4(((helper = (helper = lookupProperty(helpers,"value") || (depth0 != null ? lookupProperty(depth0,"value") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"value","hash":{},"data":data,"loc":{"start":{"line":2,"column":218},"end":{"line":2,"column":227}}}) : helper)))
+ "\" class=\"w3-input w3-border\"></div>\n <div class=\"w3-col w3-right-align s2 m1 l1\"><button onclick=\"document.getElementById('FieldsValues-New-" + "\"></div>\n <div class=\"field-buttons\"><button onclick=\"document.getElementById('FieldsValues-New-"
+ alias4(((helper = (helper = lookupProperty(helpers,"type_field_id") || (depth0 != null ? lookupProperty(depth0,"type_field_id") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"type_field_id","hash":{},"data":data,"loc":{"start":{"line":3,"column":107},"end":{"line":3,"column":124}}}) : helper))) + alias4(((helper = (helper = lookupProperty(helpers,"type_field_id") || (depth0 != null ? lookupProperty(depth0,"type_field_id") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"type_field_id","hash":{},"data":data,"loc":{"start":{"line":3,"column":90},"end":{"line":3,"column":107}}}) : helper)))
+ "-" + "-"
+ alias4(((helper = (helper = lookupProperty(helpers,"counter") || (depth0 != null ? lookupProperty(depth0,"counter") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"counter","hash":{},"data":data,"loc":{"start":{"line":3,"column":125},"end":{"line":3,"column":136}}}) : helper))) + alias4(((helper = (helper = lookupProperty(helpers,"counter") || (depth0 != null ? lookupProperty(depth0,"counter") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"counter","hash":{},"data":data,"loc":{"start":{"line":3,"column":108},"end":{"line":3,"column":119}}}) : helper)))
+ "').remove()\" type=\"button\" class=\"w3-button w3-small w3-delete w3-border w3-round-large\"><i class=\"bi bi-dash-square-fill\"></i></button></div>\n</div>"; + "').remove()\" type=\"button\"><i class=\"bi bi-dash-square-fill\"></i></button></div>\n</div>";
},"useData":true}); },"useData":true});
templates['items/field-url'] = template({"compiler":[8,">= 4.3.0"],"main":function(container,depth0,helpers,partials,data) { templates['field-url'] = template({"compiler":[8,">= 4.3.0"],"main":function(container,depth0,helpers,partials,data) {
var helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=container.hooks.helperMissing, alias3="function", alias4=container.escapeExpression, lookupProperty = container.lookupProperty || function(parent, propertyName) { var helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=container.hooks.helperMissing, alias3="function", alias4=container.escapeExpression, lookupProperty = container.lookupProperty || function(parent, propertyName) {
if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
return parent[propertyName]; return parent[propertyName];
@ -40,28 +40,28 @@ templates['items/field-url'] = template({"compiler":[8,">= 4.3.0"],"main":functi
return undefined return undefined
}; };
return "<div class=\"w3-row w3-section\" id=\"FieldsValues-New-" return "<div class=\"field\" id=\"FieldsValues-New-"
+ alias4(((helper = (helper = lookupProperty(helpers,"type_field_id") || (depth0 != null ? lookupProperty(depth0,"type_field_id") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"type_field_id","hash":{},"data":data,"loc":{"start":{"line":1,"column":52},"end":{"line":1,"column":69}}}) : helper))) + alias4(((helper = (helper = lookupProperty(helpers,"type_field_id") || (depth0 != null ? lookupProperty(depth0,"type_field_id") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"type_field_id","hash":{},"data":data,"loc":{"start":{"line":1,"column":40},"end":{"line":1,"column":57}}}) : helper)))
+ "-" + "-"
+ alias4(((helper = (helper = lookupProperty(helpers,"counter") || (depth0 != null ? lookupProperty(depth0,"counter") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"counter","hash":{},"data":data,"loc":{"start":{"line":1,"column":70},"end":{"line":1,"column":81}}}) : helper))) + alias4(((helper = (helper = lookupProperty(helpers,"counter") || (depth0 != null ? lookupProperty(depth0,"counter") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"counter","hash":{},"data":data,"loc":{"start":{"line":1,"column":58},"end":{"line":1,"column":69}}}) : helper)))
+ "\">\n <div class=\"w3-col s10 m11 l11\" style=\"padding-right: 4px;\"><label for=\"FieldsValues-" + "\">\n <div class=\"field-value\" style=\"padding-right: 4px;\"><label for=\"FieldsValues-"
+ alias4(((helper = (helper = lookupProperty(helpers,"type_field_id") || (depth0 != null ? lookupProperty(depth0,"type_field_id") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"type_field_id","hash":{},"data":data,"loc":{"start":{"line":2,"column":89},"end":{"line":2,"column":106}}}) : helper))) + alias4(((helper = (helper = lookupProperty(helpers,"type_field_id") || (depth0 != null ? lookupProperty(depth0,"type_field_id") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"type_field_id","hash":{},"data":data,"loc":{"start":{"line":2,"column":82},"end":{"line":2,"column":99}}}) : helper)))
+ "-" + "-"
+ alias4(((helper = (helper = lookupProperty(helpers,"counter") || (depth0 != null ? lookupProperty(depth0,"counter") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"counter","hash":{},"data":data,"loc":{"start":{"line":2,"column":107},"end":{"line":2,"column":118}}}) : helper))) + alias4(((helper = (helper = lookupProperty(helpers,"counter") || (depth0 != null ? lookupProperty(depth0,"counter") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"counter","hash":{},"data":data,"loc":{"start":{"line":2,"column":100},"end":{"line":2,"column":111}}}) : helper)))
+ "\"></label><input id=\"FieldsValues-" + "\"></label><input id=\"FieldsValues-"
+ alias4(((helper = (helper = lookupProperty(helpers,"type_field_id") || (depth0 != null ? lookupProperty(depth0,"type_field_id") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"type_field_id","hash":{},"data":data,"loc":{"start":{"line":2,"column":152},"end":{"line":2,"column":169}}}) : helper))) + alias4(((helper = (helper = lookupProperty(helpers,"type_field_id") || (depth0 != null ? lookupProperty(depth0,"type_field_id") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"type_field_id","hash":{},"data":data,"loc":{"start":{"line":2,"column":145},"end":{"line":2,"column":162}}}) : helper)))
+ "-" + "-"
+ alias4(((helper = (helper = lookupProperty(helpers,"counter") || (depth0 != null ? lookupProperty(depth0,"counter") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"counter","hash":{},"data":data,"loc":{"start":{"line":2,"column":170},"end":{"line":2,"column":181}}}) : helper))) + alias4(((helper = (helper = lookupProperty(helpers,"counter") || (depth0 != null ? lookupProperty(depth0,"counter") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"counter","hash":{},"data":data,"loc":{"start":{"line":2,"column":163},"end":{"line":2,"column":174}}}) : helper)))
+ "\" type=\"url\" name=\"FieldsValues-" + "\" type=\"url\" name=\"FieldsValues-"
+ alias4(((helper = (helper = lookupProperty(helpers,"type_field_id") || (depth0 != null ? lookupProperty(depth0,"type_field_id") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"type_field_id","hash":{},"data":data,"loc":{"start":{"line":2,"column":213},"end":{"line":2,"column":230}}}) : helper))) + alias4(((helper = (helper = lookupProperty(helpers,"type_field_id") || (depth0 != null ? lookupProperty(depth0,"type_field_id") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"type_field_id","hash":{},"data":data,"loc":{"start":{"line":2,"column":206},"end":{"line":2,"column":223}}}) : helper)))
+ "-" + "-"
+ alias4(((helper = (helper = lookupProperty(helpers,"counter") || (depth0 != null ? lookupProperty(depth0,"counter") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"counter","hash":{},"data":data,"loc":{"start":{"line":2,"column":231},"end":{"line":2,"column":242}}}) : helper))) + alias4(((helper = (helper = lookupProperty(helpers,"counter") || (depth0 != null ? lookupProperty(depth0,"counter") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"counter","hash":{},"data":data,"loc":{"start":{"line":2,"column":224},"end":{"line":2,"column":235}}}) : helper)))
+ "\" value=\"" + "\" value=\""
+ alias4(((helper = (helper = lookupProperty(helpers,"value") || (depth0 != null ? lookupProperty(depth0,"value") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"value","hash":{},"data":data,"loc":{"start":{"line":2,"column":251},"end":{"line":2,"column":260}}}) : helper))) + alias4(((helper = (helper = lookupProperty(helpers,"value") || (depth0 != null ? lookupProperty(depth0,"value") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"value","hash":{},"data":data,"loc":{"start":{"line":2,"column":244},"end":{"line":2,"column":253}}}) : helper)))
+ "\" class=\"w3-input w3-border\"></div>\n <div class=\"w3-col w3-right-align s2 m1 l1\"><button onclick=\"document.getElementById('FieldsValues-New-" + "\"></div>\n <div class=\"field-buttons\"><button onclick=\"document.getElementById('FieldsValues-New-"
+ alias4(((helper = (helper = lookupProperty(helpers,"type_field_id") || (depth0 != null ? lookupProperty(depth0,"type_field_id") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"type_field_id","hash":{},"data":data,"loc":{"start":{"line":3,"column":107},"end":{"line":3,"column":124}}}) : helper))) + alias4(((helper = (helper = lookupProperty(helpers,"type_field_id") || (depth0 != null ? lookupProperty(depth0,"type_field_id") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"type_field_id","hash":{},"data":data,"loc":{"start":{"line":3,"column":90},"end":{"line":3,"column":107}}}) : helper)))
+ "-" + "-"
+ alias4(((helper = (helper = lookupProperty(helpers,"counter") || (depth0 != null ? lookupProperty(depth0,"counter") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"counter","hash":{},"data":data,"loc":{"start":{"line":3,"column":125},"end":{"line":3,"column":136}}}) : helper))) + alias4(((helper = (helper = lookupProperty(helpers,"counter") || (depth0 != null ? lookupProperty(depth0,"counter") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"counter","hash":{},"data":data,"loc":{"start":{"line":3,"column":108},"end":{"line":3,"column":119}}}) : helper)))
+ "').remove()\" type=\"button\" class=\"w3-button w3-small w3-delete w3-border w3-round-large\"><i class=\"bi bi-dash-square-fill\"></i></button></div>\n</div>"; + "').remove()\" type=\"button\" class=\"delete\"><i class=\"bi bi-dash-square-fill\"></i></button></div>\n</div>";
},"useData":true}); },"useData":true});
})(); })();

View File

@ -15,8 +15,8 @@
<div class="field"> <div class="field">
<div id="FieldsValues-{{$field.Type_field_id}}-{{$counter}}" class="field-value">{{ field_widget $field.Widget $field.Type_field_id $counter "" $value $field.Valid_values ""}}</div> <div id="FieldsValues-{{$field.Type_field_id}}-{{$counter}}" class="field-value">{{ field_widget $field.Widget $field.Type_field_id $counter "" $value $field.Valid_values ""}}</div>
<div class="field-buttons"> <div class="field-buttons">
<button id="Delete-{{$field.Type_field_id}}-{{$counter}}" class="delete" type="button" _="on click set {value: '1'} on #FieldsValuesToRemove-{{$field.Type_field_id}}-{{$counter}} then hide me then show #Undelete-{{$field.Type_field_id}}-{{$counter}} then add .w3-opacity-max to #FieldsValues-{{$field.Type_field_id}}-{{$counter}}" ><i class="bi bi-dash-square" title="Remove"></i></button> <button onclick="bm_item_field_delete(this, '{{$field.Type_field_id}}-{{$counter}}')" id="Delete-{{$field.Type_field_id}}-{{$counter}}" class="delete" type="button"><i class="bi bi-dash-square" title="Remove"></i></button>
<button id="Undelete-{{$field.Type_field_id}}-{{$counter}}" style="margin-right: 5px; display: none" class="delete" type="button" _="on click set {value: ''} on #FieldsValuesToRemove-{{$field.Type_field_id}}-{{$counter}} then hide me then show #Delete-{{$field.Type_field_id}}-{{$counter}} then remove .w3-opacity-max from #FieldsValues-{{$field.Type_field_id}}-{{$counter}}"><i class="bi bi-arrow-counterclockwise" title="Undo"></i></button> <button onclick="bm_item_field_undelete(this, '{{$field.Type_field_id}}-{{$counter}}')" id="Undelete-{{$field.Type_field_id}}-{{$counter}}" hidden class="main" type="button"><i class="bi bi-arrow-counterclockwise" title="Undo"></i></button>
</div> </div>
</div> </div>
{{ $g_counter = $counter}} {{ $g_counter = $counter}}

View File

@ -8,28 +8,14 @@
</div> </div>
<div class="w3-half"> <div class="w3-half">
<label for="Fields-{{.Type_field_id}}-Title">Title</label> <label for="Fields-{{.Type_field_id}}-Title">Title</label>
<input <input type="text" id="Fields-{{.Type_field_id}}-Title" name="Fields-{{.Type_field_id}}-Title" value="{{.Title}}"/>
class=" w3-border"
type="text"
id="Fields-{{.Type_field_id}}-Title"
name="Fields-{{.Type_field_id}}-Title"
value="{{.Title}}"
/>
</div> </div>
</div> </div>
<div class="w3-row"> <div class="w3-row">
<div class="w3-half"> <div class="w3-half">
<label for="Fields-{{.Type_field_id}}-Valid_values" <label for="Fields-{{.Type_field_id}}-Valid_values">Valid values</label>
>Valid values</label <input type="text" id="Fields-{{.Type_field_id}}-Valid_values" name="Fields-{{.Type_field_id}}-Valid_values" value="{{.Valid_values}}"/>
>
<input
class=" w3-border"
type="text"
id="Fields-{{.Type_field_id}}-Valid_values"
name="Fields-{{.Type_field_id}}-Valid_values"
value="{{.Valid_values}}"
/>
</div> </div>
<div class="w3-half"> <div class="w3-half">
{{ widget_select (print "Fields-" .Type_field_id "-Ui_section") "Section" .Ui_section $.uisections `class=" w3-border"` }} {{ widget_select (print "Fields-" .Type_field_id "-Ui_section") "Section" .Ui_section $.uisections `class=" w3-border"` }}
@ -37,19 +23,8 @@
</div> </div>
<div class="w3-row"> <div class="w3-row">
<p> <p>
<input <input id="Fields-{{.Type_field_id}}-Show_on_list" name="Fields-{{.Type_field_id}}-Show_on_list" type="checkbox" value="1"{{if eq .Show_on_list 1 }}checked="checked"{{end}}/>
id="Fields-{{.Type_field_id}}-Show_on_list" <label for="Fields-{{.Type_field_id}}-Show_on_list">Show on list</label>
name="Fields-{{.Type_field_id}}-Show_on_list"
class=""
type="checkbox"
value="1"
{{if eq .Show_on_list 1 }}
checked="checked"
{{end}}
/>
<label for="Fields-{{.Type_field_id}}-Show_on_list"
>Show on list</label
>
</p> </p>
<p> <p>
<input <input

View File

@ -185,7 +185,7 @@ func (app *application) quickboxTransform(w http.ResponseWriter, r *http.Request
} }
triggerResponse := fmt.Sprintf(`{"closeQuickboxTransformModal":{"quickNoteId": "%d", "keepQuickNote": "%d"}}`, quicknote_id, quicknoteTransformFromForm.Keep_in_quickbox) triggerResponse := fmt.Sprintf(`{"closeQuickboxTransformModal":{"quickNoteId": "%d", "keepQuickNote": "%d"}}`, quicknote_id, quicknoteTransformFromForm.Keep_in_quickbox)
w.Header().Add("HX-Trigger-After-Swap", triggerResponse) w.Header().Add("HX-Trigger-After-Settle", triggerResponse)
fullBuf.WriteTo(w) fullBuf.WriteTo(w)
w.WriteHeader(http.StatusUnprocessableEntity) w.WriteHeader(http.StatusUnprocessableEntity)

View File

@ -77,6 +77,7 @@ var TemplateFuncs = template.FuncMap{
"widget_text": widget_text, "widget_text": widget_text,
"widget_select": widget_select, "widget_select": widget_select,
"widget_slim_select": widget_slim_select, "widget_slim_select": widget_slim_select,
"widget_checkbox": widget_checkbox,
"widget_checkboxes": widget_checkboxes, "widget_checkboxes": widget_checkboxes,
"field_widget": field_widget, "field_widget": field_widget,
@ -395,6 +396,28 @@ func render_select(name string, label string, value any, options []WidgetOption,
return template.HTML(o) return template.HTML(o)
} }
func widget_checkbox(name string, label string, value string, value_assigned any) template.HTML {
var checked string = ""
var value_assigned_str string = ""
switch v := value_assigned.(type) {
case int64:
value_assigned_str = strconv.FormatInt(v, 10)
case string:
value_assigned_str = value_assigned.(string)
}
if value == value_assigned_str {
checked = `checked="checked"`
}
var o string = `<label class="switch">`
o = o + fmt.Sprintf(`<input id="%v" name="%v" type="checkbox" value="%v" %v />`, name, name, value, checked)
o = o + fmt.Sprintf(`<span class="slider round"></span></label><label for=%v" class="label-checkbox">%v</label>`, name, label)
return template.HTML(o)
}
func widget_checkboxes(name string, label string, value any, options []WidgetOption, attributes string) template.HTML { func widget_checkboxes(name string, label string, value any, options []WidgetOption, attributes string) template.HTML {
var values []string var values []string