From: Christian Heller Date: Thu, 6 Feb 2025 12:42:57 +0000 (+0100) Subject: In /edit_structured, fully disallow movement, and deletion, of date line. X-Git-Url: https://plomlompom.com/repos/%7B%7Bdb.prefix%7D%7D/static/%7B%7B%20web_path%20%7D%7D/decks/tasks?a=commitdiff_plain;ds=sidebyside;p=plomledger In /edit_structured, fully disallow movement, and deletion, of date line. --- diff --git a/templates/edit_structured.tmpl b/templates/edit_structured.tmpl index 46ef79d..8569dea 100644 --- a/templates/edit_structured.tmpl +++ b/templates/edit_structured.tmpl @@ -122,13 +122,13 @@ function update_form() { dat_lines.splice(i-1, 1); dat_lines.splice(i, 0, prev_line); }); - add_button(td_btns, 'v', i+1 < dat_lines.length ? false : true, function() { + add_button(td_btns, 'v', (i && i+1 < dat_lines.length) ? false : true, function() { const next_line = dat_lines[i]; dat_lines.splice(i, 1); dat_lines.splice(i+1, 0, next_line); }); td_btns.appendChild(document.createTextNode(' · · · ')) - add_button(td_btns, 'delete', false, function() { dat_lines.splice(i, 1); }); + add_button(td_btns, 'delete', i > 0 ? false : true, function() { dat_lines.splice(i, 1); }); // add error explanation row if necessary if (dat_line.error) {