PageSourceSearch

https://tiki.org/public/generated/js/MOVE_THIS_CONTENT_ELSEWHERE/plugin-edit.js

js tiki.org collected 2026-10-02 03:28:42 UTC 1,937 bytes, 2 lines download raw bytes

1function m(e,a){const t=$(`#${e}`),n=$(".btn-container .buttons",t),i=$("input[name='label']",t).val(),s=$("input[name='classnames']",t).val(),o=$("input[name='actions']",t).val();h(i,s,o)(n)(t);const c=$(a).closest(".collapse").get(0);bootstrap.Collapse.getInstance(c).hide(),$(".field",t).val("")}function h(e,a,t){const n=$("<div></div>").text(e).addClass(a);return i=>{const s=$("<div></div>").addClass("flex-shrink-0 flex-grow-0 d-flex gap-2 p-2 border rounded shadow-sm btn-wrapper");return s.append(n),s.append($(".delete-icon").first().clone().removeClass("d-none")),$(".delete-icon",s).click(function(){b($(this))}),i.append(s),o=>{const l=$("input#label",o),p=$("input#classNames",o),c=$("input#action",o);if(!e)return;const v=l.val(),f=v?`${v},${e}`:e;l.val(f);const r=f.split(",").length-1,u=p.val().split(",");for(;u.length<r;)u.push("");u[r]=a,p.val(u.join(","));const d=c.val().split(",");for(;d.length<r;)d.push("");d[r]=t,c.val(d.join(","))}}}function b(e){const a=$(".btn-wrapper .delete-icon").index(e);$("input#label, input#classNames, input#action").each(function(){const t=$(this).val().split(",");t.splice(a,1),$(this).val(t.join(","))}),e.closest(".btn-wrapper").remove()}function w(e){const a=$("input#label").val().split(","),t=$("input#classNames").val().split(","),n=$("input#action").val().split(","),i=$(`#${e}`).find(".btn-container .buttons");a.forEach((s,o)=>{if(!s)return;h(s,t[o],n[o])(i)})}function g(e,a,t){const n=$(`#${e}`),i=n.closest(".field-container"),s=$(`[name='params[${a}]']`),o=function(){n.val(""),i.hide(),n.rules()?.required&&(n.rules("remove","required"),n.attr("data-required","true"))};s.val()===t?i.show():o(),s.on("change",function(){$(this).val()===t?(i.show(),n.attr("data-required")&&(n.rules("add","required"),n.removeAttr("data-required"))):o()})}
1export{w as generateButtonsFromInput,g as registerFieldDependency,m as submitNewButton};
2//# sourceMappingURL=plugin-edit.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.