diff options
Diffstat (limited to 'internal/admin/static')
| -rw-r--r-- | internal/admin/static/admin.css | 7 | ||||
| -rw-r--r-- | internal/admin/static/intereditor.js | 50 |
2 files changed, 30 insertions, 27 deletions
diff --git a/internal/admin/static/admin.css b/internal/admin/static/admin.css index 7c8f0a5..a5c3497 100644 --- a/internal/admin/static/admin.css +++ b/internal/admin/static/admin.css @@ -447,15 +447,18 @@ g.ud-hover:hover text{font-weight:bold} .ie-step-label{font-size:10px;color:#6af;text-transform:uppercase;letter-spacing:.3px;font-weight:bold;white-space:nowrap} .ie-step-addmore{color:#6af;border:1px solid rgba(100,160,255,.25);background:transparent;font-size:10px;padding:1px 6px;border-radius:3px;cursor:pointer;font-family:monospace;line-height:1} .ie-step-addmore:hover{background:rgba(100,160,255,.1)} +.ie-step-addmore::after{content:"+"} +.ie-step-row.show-addbar .ie-step-addmore::after{content:"-"} .ie-step-spacer{flex:1} .ie-step-up,.ie-step-dn{padding:2px 6px;font-size:9px} .ie-step-cond-panel{margin:2px 0} +.ie-cond-title{font-size:10px;color:#6af;text-transform:uppercase;letter-spacing:.3px;font-weight:bold;margin-bottom:2px} .ie-step-effects{margin:2px 0} .ie-step-messages{margin:2px 0} .ie-step-addbar{display:none;flex-wrap:wrap;gap:3px;margin-top:2px} .ie-step-row.show-addbar .ie-step-addbar{display:flex} -.ie-step-addbar-bottom{display:flex;flex-wrap:wrap;gap:4px;margin-top:6px} -.ie-step-addbar-bottom .btn{padding:4px 10px;font-size:11px} +.ie-step-addbar-bottom{display:grid;grid-template-columns:repeat(5,1fr);gap:4px;margin-top:6px} +.ie-step-addbar-bottom .btn{width:100%;box-sizing:border-box;text-align:center;padding:4px 10px;font-size:11px} /* ── Message rows within a step ── */ .ie-msg-row{display:flex;align-items:center;gap:4px} diff --git a/internal/admin/static/intereditor.js b/internal/admin/static/intereditor.js index 653bccf..a17225a 100644 --- a/internal/admin/static/intereditor.js +++ b/internal/admin/static/intereditor.js @@ -78,7 +78,7 @@ function ie_renderStepAddbar(step, secId, idx, si, secPath) { function ie_renderBottomAddbar(secId, secPath, idx) { var h = ''; IE_STEP_KINDS.forEach(function(sk) { - h += '<button class="btn btn-sm ie-add-btn" onclick="ie_addStepKind(\'' + escAttr(secId) + '\',\'' + escAttr(secPath) + '\',' + idx + ',\'' + escAttr(sk.key) + '\')">+ ' + esc(sk.label) + ' Step</button>'; + h += '<button class="btn btn-sm ie-add-btn" onclick="ie_addStepKind(\'' + escAttr(secId) + '\',\'' + escAttr(secPath) + '\',' + idx + ',\'' + escAttr(sk.key) + '\')">+ ' + esc(sk.label) + '</button>'; }); return h; } @@ -331,7 +331,15 @@ function ie_renderCond(condObj, secId, idx, secPath, kind) { var h = ''; var isGroup = condObj && (condObj.all_of || condObj.any_of); if (condObj && typeof condObj === 'object') { + var condTitleText = ''; + if (kind && kind.indexOf('step-') === 0) { + var sn = parseInt(kind.slice(5), 10); + if (!isNaN(sn)) condTitleText = 'Condition for Step ' + (sn + 1); + } else if (kind === 'entry') { + condTitleText = 'Condition for Action Block'; + } h += '<div class="ie-cond-root">'; + if (condTitleText) h += '<div class="ie-cond-title">' + esc(condTitleText) + '</div>'; h += ie_renderGroup(condObj, secId, secPath, idx, '', kind); h += '</div>'; } @@ -517,7 +525,7 @@ function ie_renderAct(stepObj, secId, idx, si, secPath) { function ie_renderMessages(step, secId, idx, si, secPath) { var present = step && Array.isArray(step.messages); if (!present) { - return '<button class="btn btn-sm ie-add-btn" onclick="ie_addMessages(\'' + escAttr(secId) + '\',\'' + escAttr(secPath) + '\',' + idx + ',' + si + ')">+ Add Message</button>'; + return ''; } var msgs = step.messages; var rmFn = 'ie_removeMessage(this,\'' + escAttr(secId) + '\',\'' + escAttr(secPath) + '\',' + idx + ',' + si + ')'; @@ -549,24 +557,25 @@ function ie_renderStepList(steps, secId, idx, secPath) { h += '<div class="ie-step-row" data-step="' + si + '" data-idx="' + idx + '">'; h += '<div class="ie-step-header">'; h += '<span class="ie-step-label">Step ' + (si + 1) + '</span>'; - h += '<button class="btn btn-sm ie-step-addmore" onclick="this.closest(\'.ie-step-row\').classList.toggle(\'show-addbar\')" title="Add action to this step">+</button>'; + h += '<button class="btn btn-sm ie-step-addmore" onclick="this.closest(\'.ie-step-row\').classList.toggle(\'show-addbar\')" title="Add action to this step"></button>'; + if (!stepCond) { + h += '<button class="btn btn-sm ie-add-btn" onclick="ie_addStepCond(\'' + escAttr(secId) + '\',\'' + escAttr(secPath) + '\',' + idx + ',' + si + ')">+ Add Step Condition</button>'; + } h += '<span class="ie-step-spacer"></span>'; if (si > 0) h += '<button class="btn btn-sm ie-step-up" onclick="ie_moveStep(\'' + escAttr(secId) + '\',\'' + escAttr(secPath) + '\',' + idx + ',' + si + ',' + (si - 1) + ')" title="Move up">▲</button>'; if (si < steps.length - 1) h += '<button class="btn btn-sm ie-step-dn" onclick="ie_moveStep(\'' + escAttr(secId) + '\',\'' + escAttr(secPath) + '\',' + idx + ',' + si + ',' + (si + 1) + ')" title="Move down">▼</button>'; h += '<button class="btn btn-sm btn-danger" onclick="ie_removeStep(\'' + escAttr(secId) + '\',\'' + escAttr(secPath) + '\',' + idx + ',' + si + ')" title="Remove step">X</button>'; h += '</div>'; - h += '<div class="ie-step-cond-panel">'; if (stepCond) { + h += '<div class="ie-step-cond-panel">'; h += ie_renderCond(step.condition || null, secId, idx, secPath, 'step-' + si); - } else { - h += '<button class="btn btn-sm ie-add-btn" onclick="ie_addStepCond(\'' + escAttr(secId) + '\',\'' + escAttr(secPath) + '\',' + idx + ',' + si + ')">+ Add Step Condition</button>'; + h += '</div>'; } - h += '</div>'; h += '<div class="ie-step-effects">' + ie_renderAct(step, secId, idx, si, secPath) + '</div>'; - h += '<div class="ie-step-addbar">' + ie_renderStepAddbar(step, secId, idx, si, secPath) + '</div>'; h += '<div class="ie-step-messages">' + ie_renderMessages(step, secId, idx, si, secPath) + '</div>'; + h += '<div class="ie-step-addbar">' + ie_renderStepAddbar(step, secId, idx, si, secPath) + '</div>'; h += '</div>'; }); @@ -876,29 +885,20 @@ function ie_toggleCondMode(secId, secPath, idx, kind, groupPath) { var ed = window._editorData; if (!ed) return; _ie_syncCond(ed, secId, secPath, idx, kind); - var cond = _ie_getCond(ed, secPath, idx, kind); - var group = ie_condAt(cond, groupPath); - if (!group || !group.all_of && !group.any_of) return; - - var oldMode = group.all_of ? 'all_of' : 'any_of'; - var children = group.all_of || group.any_of; - var newGroup = {}; - if (group.not) newGroup.not = true; - newGroup[oldMode === 'all_of' ? 'any_of' : 'all_of'] = children; - - var newCond = ie_condReplace(cond, groupPath, newGroup); - _ie_setCond(ed, secPath, idx, kind, newCond); - ced_syncDOMToData(ed); window._ieRenderOnly(); } function ie_toggleCondNot(secId, secPath, idx, kind, groupPath) { - ced_syncDOMToData(window._editorData); + var ed = window._editorData; + if (!ed) return; + _ie_syncCond(ed, secId, secPath, idx, kind); window._ieRenderOnly(); } function ie_toggleNotLeaf(secId, secPath, idx, kind, groupPath, ci) { - ced_syncDOMToData(window._editorData); + var ed = window._editorData; + if (!ed) return; + _ie_syncCond(ed, secId, secPath, idx, kind); window._ieRenderOnly(); } @@ -923,7 +923,7 @@ function ie_moveStep(secId, secPath, idx, fromSi, toSi) { if (!steps || fromSi < 0 || fromSi >= steps.length || toSi < 0 || toSi >= steps.length) return; var m = steps.splice(fromSi, 1)[0]; steps.splice(toSi, 0, m); - window._ieRenderCurrent(); + window._ieRenderOnly(); } function ie_moveRow(secPath, fromIdx, toIdx) { @@ -935,7 +935,7 @@ function ie_moveRow(secPath, fromIdx, toIdx) { if (!arr || fromIdx < 0 || fromIdx >= arr.length || toIdx < 0 || toIdx >= arr.length) return; var m = arr.splice(fromIdx, 1)[0]; arr.splice(toIdx, 0, m); - window._ieRenderCurrent(); + window._ieRenderOnly(); } function ie_moveMessage(secId, secPath, idx, si, fromMi, toMi) { |
