From ae2e0ef3a0970b2820a7f74958b68fd68ae7b7e6 Mon Sep 17 00:00:00 2001 From: lowercasedonkey <lowercasedonkey@gmail.com> Date: Wed, 7 Oct 2020 18:56:13 -0400 Subject: [PATCH] fixes --- src/interaction/slaveInteract.js | 44 ++++++++++++++++++++---------- src/uncategorized/slaveInteract.tw | 5 ++++ 2 files changed, 34 insertions(+), 15 deletions(-) diff --git a/src/interaction/slaveInteract.js b/src/interaction/slaveInteract.js index 15c5b85285e..06bcd1ee59c 100644 --- a/src/interaction/slaveInteract.js +++ b/src/interaction/slaveInteract.js @@ -76,43 +76,57 @@ App.UI.SlaveInteract.mainPage = function(slave) { const tabBar = document.createElement("div"); tabBar.classList.add("tab-bar"); + tabBar.style.backgroundColor = "grey"; const buttons = [ { - get onclick() { return App.UI.tabBar.openTab(event, 'Description'); }, id: "tab Description", title: "Description" + title: "Description", id: "Description" }, { - get onclick() { return App.UI.tabBar.openTab(event, 'Modify'); }, id: "tab Modify", title: "Modify" + title: "Modify", id: "Modify" }, { - get onclick() { return App.UI.tabBar.openTab(event, 'Work'); }, id: "tab Work", title: "Work" + title: "Work", id: "Work" }, { - get onclick() { return App.UI.tabBar.openTab(event, 'Appearance'); }, id: "tab Appearance", title: "Appearance" + title: "Appearance", id: "Appearance" }, { - get onclick() { return App.UI.tabBar.openTab(event, 'PhysicalRegimen'); }, id: "tab PhysicalRegimen", title: "Physical Regimen" + title: "Physical Regimen", id: "PhysicalRegimen" }, { - get onclick() { return App.UI.tabBar.openTab(event, 'Rules'); }, id: "tab Rules", title: "Rules" + title: "Rules", id: "Rules" }, { - get onclick() { return App.UI.tabBar.openTab(event, 'Financial'); }, id: "tab Financial", title: "Financial" + title: "Financial", id: "Financial" }, { - get onclick() { return App.UI.tabBar.openTab(event, 'Customize'); }, id: "tab Customize", title: "Customize" + title: "Customize", id: "Customize" }, { - get onclick() { return (App.UI.tabBar.openTab(event, 'family-tab'), renderFamilyTree(V.slaves, slave.ID)); }, id: "tab family-tab", title: "Family" + title: "Family", id: "family-tab" } ]; for (const item of buttons) { - const button = document.createElement("button"); - button.classList.add("tab-links"); - button.onclick = (event) => { item.onClick; }; - button.id = item.id; - button.append(item.title); - tabBar.append(button); + el.append(makeTabButton(item.id, item.title)); } + + function makeTabButton(name, text) { + const btn = document.createElement("button"); + btn.className = "tab-links"; + btn.id = `tab ${name}`; + btn.innerHTML = text; + if (name === "Family") { + btn.onclick = (event) => { + App.UI.tabBar.openTab(event, name); + renderFamilyTree(V.slaves, slave.ID); + }; + } else { + btn.onclick = (event) => App.UI.tabBar.openTab(event, name); + } + return btn; + } + + el.append(tabBar); App.Events.drawEventArt(el, slave); diff --git a/src/uncategorized/slaveInteract.tw b/src/uncategorized/slaveInteract.tw index e0595f0c31f..582bc677bcd 100644 --- a/src/uncategorized/slaveInteract.tw +++ b/src/uncategorized/slaveInteract.tw @@ -1,4 +1,9 @@ :: Slave Interact [nobr jump-from-safe] <<set $nextButton = "Confirm changes", $nextLink = "Main">> +<style> +.active { + background-color: grey; +} +</style> <<includeDOM App.UI.SlaveInteract.mainPage(getSlave(V.AS))>> -- GitLab