diff options
author | Ian C <ianc@noddybox.co.uk> | 2018-06-26 21:12:37 +0000 |
---|---|---|
committer | Ian C <ianc@noddybox.co.uk> | 2018-06-26 21:12:37 +0000 |
commit | c4c55c23c564160a7150062ffb73041f21de70e9 (patch) | |
tree | 6aa857aebc680d624dc442b8d0818420d42c522c /www/scripts | |
parent | 7236430484ffbd9874083b9703ff3015e3347c89 (diff) |
Added links for edit actions, and place holders for the event handlers.
Diffstat (limited to 'www/scripts')
-rw-r--r-- | www/scripts/main.js | 46 |
1 files changed, 39 insertions, 7 deletions
diff --git a/www/scripts/main.js b/www/scripts/main.js index 900357b..9c77f56 100644 --- a/www/scripts/main.js +++ b/www/scripts/main.js @@ -118,11 +118,10 @@ function LoadGroups(keep_selection) elem.add(option); } - alert(globalCurrentGroup); elem.value = globalCurrentGroup; } -function AddTableInputCell(id, text, name, tr) +function AddTableInputCell(id, text, name, node) { var td = document.createElement("td"); var input = document.createElement("input"); @@ -132,7 +131,26 @@ function AddTableInputCell(id, text, name, tr) input.type = "text"; td.appendChild(input); - tr.appendChild(td); + node.appendChild(td); +} + +function AddSmallLink(node, text, func, id) +{ + var anchor = document.createElement("a"); + + anchor.href = "#"; + anchor.onclick = func; + anchor.text = text; + anchor.className = "smalltext"; + anchor.dataset.pmId = id; + + node.appendChild(anchor); +} + +function AddNBSP(node) +{ + var nbsp = document.createTextNode("\u00a0"); + node.appendChild(nbsp); } function AddRow(table, id, desc, username, password, rowcount) @@ -141,11 +159,11 @@ function AddRow(table, id, desc, username, password, rowcount) if ((rowcount % 2) == 1) { - tr.style = "style1"; + tr.className = "style1"; } else { - tr.style = "style2"; + tr.className = "style2"; } AddTableInputCell(id, desc, "Description", tr); @@ -156,11 +174,13 @@ function AddRow(table, id, desc, username, password, rowcount) if (id == -1) { - td.innerText = "Stuff for new entry"; + AddSmallLink(td, "Add", DoAdd, id); } else { - td.innerText = "Stuff for existing entry"; + AddSmallLink(td, "Edit", DoEdit, id); + AddNBSP(td); + AddSmallLink(td, "Delete", DoDelete, id); } tr.appendChild(td); @@ -218,4 +238,16 @@ function DoSelectGroup() LoadTable(); } +function DoAdd() +{ +} + +function DoEdit() +{ +} + +function DoDelete() +{ +} + // vim: sw=4 ts=4 |