diff --git a/inventory/static/js/widget.js b/inventory/static/js/widget.js index bd2c239..2c7dc0b 100644 --- a/inventory/static/js/widget.js +++ b/inventory/static/js/widget.js @@ -53,37 +53,6 @@ function renderToast({ message, type = ToastConfig.defaultType, timeout = ToastC }); } -const EditorWidget = (() => { - let tempIdCounter = 1; - - function autoResizeTextarea(textarea) { - textarea.style.height = 'auto'; - textarea.style.height = `${textarea.scrollHeight + 2}px`; - } - - function createEditorWidget(template, id, timestamp, content = '') { - let html = template.innerHTML - .replace(/__ID__/g, id) - .replace(/__TIMESTAMP__/g, timestamp) - .replace(/__CONTENT__/g, content); - - const wrapper = document.createElement("div"); - wrapper.innerHTML = html; - - return wrapper.firstElementChild; - } - - function createTempId(prefix = "temp") { - return `${prefix}-${tempIdCounter++}`; - } - - return { - autoResizeTextarea, - createEditorWidget, - createTempId - }; -})(); - const ComboBoxWidget = (() => { let tempIdCounter = 1; diff --git a/inventory/templates/fragments/_editor_fragment.html b/inventory/templates/fragments/_editor_fragment.html deleted file mode 100644 index 9e96624..0000000 --- a/inventory/templates/fragments/_editor_fragment.html +++ /dev/null @@ -1,47 +0,0 @@ -{% import "fragments/_icon_fragment.html" as icons %} - -{% macro render_editor(id, title, mode='edit', content=None) %} - -
-
- -
-
- -
-
-
-
-
- - -{% endmacro %} \ No newline at end of file diff --git a/inventory/templates/layout.html b/inventory/templates/layout.html index 0902d5a..9c4ea7b 100644 --- a/inventory/templates/layout.html +++ b/inventory/templates/layout.html @@ -1,6 +1,5 @@ {% import "fragments/_breadcrumb_fragment.html" as breadcrumbs %} {% import "fragments/_combobox_fragment.html" as combos %} -{% import "fragments/_editor_fragment.html" as editor %} {% import "fragments/_icon_fragment.html" as icons %} {% import "fragments/_link_fragment.html" as links %} {% import "fragments/_table_fragment.html" as tables %} @@ -20,13 +19,10 @@ rel="stylesheet" integrity="sha384-gdnBcErvPbrURVoR9w3NhVMliw+ZmcTCmq+64xj2Ksx21nRJFX3qW0zFvBotL5rm" crossorigin="anonymous"> - @@ -57,7 +53,7 @@
- {% block content %}{% endblock %} + {% block content %}{% endblock %}
- diff --git a/inventory/templates/worklog.html b/inventory/templates/worklog.html index 89e1acc..c30d016 100644 --- a/inventory/templates/worklog.html +++ b/inventory/templates/worklog.html @@ -4,7 +4,7 @@ {% block title %}{{ title }}{% endblock %} {% block content %} - + {% endblock %} {% block script %} @@ -128,7 +137,6 @@ if (addUpdateButton) { addUpdateButton.addEventListener("click", (e) => { - {# const row = document.createElement("div"); row.classList.add("row"); @@ -151,21 +159,14 @@ updateContent.dataset.noteId = ""; updateContent.name = "updateNew"; - // Hook in auto-resize - updateContent.addEventListener("input", () => autoResizeTextarea(updateContent)); - autoResizeTextarea(updateContent); - // Stitch it all together igroup.appendChild(ts); igroup.appendChild(updateContent); col.appendChild(igroup); row.appendChild(col); - #} - const template = document.getElementById("editor-template"); - const newEditor = EditorWidget.createEditorWidget(template, EditorWidget.createTempId("new"), formatDate(new Date())); const updatesContainer = document.getElementById("updates-container"); - updatesContainer.appendChild(newEditor); + updatesContainer.appendChild(row); }); }