From c4c55c23c564160a7150062ffb73041f21de70e9 Mon Sep 17 00:00:00 2001 From: Ian C Date: Tue, 26 Jun 2018 21:12:37 +0000 Subject: Added links for edit actions, and place holders for the event handlers. --- www/css/main.css | 4 ++-- www/index.html | 1 + www/scripts/main.js | 46 +++++++++++++++++++++++++++++++++++++++------- 3 files changed, 42 insertions(+), 9 deletions(-) (limited to 'www') diff --git a/www/css/main.css b/www/css/main.css index 22284e4..ab6eb04 100644 --- a/www/css/main.css +++ b/www/css/main.css @@ -18,12 +18,12 @@ td input tr.style1 { - background-color: #aaaaff; + background-color: #ddddff; } tr.style2 { - background-color: #8888ff; + background-color: #ccccff; } a:link diff --git a/www/index.html b/www/index.html index 9c2474c..4a1b421 100644 --- a/www/index.html +++ b/www/index.html @@ -20,6 +20,7 @@ Group:    +
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 -- cgit v1.2.3