Skip to content
Snippets Groups Projects
Commit b8259dde authored by lowercasedonkey's avatar lowercasedonkey
Browse files

fix no tab refresh

parent 21c29b0c
No related branches found
No related tags found
1 merge request!8328fix no tab refresh
/** /**
* @param {App.Entity.SlaveState} slave * @param {App.Entity.SlaveState} slave
* @returns {Node} * @returns {DocumentFragment}
*/ */
App.UI.SlaveInteract.modify = function(slave) { App.UI.SlaveInteract.modify = function(slave) {
const {he, his} = getPronouns(slave); const {he, his} = getPronouns(slave);
......
...@@ -70,7 +70,7 @@ App.UI.SlaveInteract.mainPage = function(slave) { ...@@ -70,7 +70,7 @@ App.UI.SlaveInteract.mainPage = function(slave) {
* @typedef {Object} siCategory * @typedef {Object} siCategory
* @property {string} title * @property {string} title
* @property {string} id * @property {string} id
* @property {Node} node * @property {DocumentFragment|HTMLElement} node
* @property {Function} [onClick] * @property {Function} [onClick]
*/ */
...@@ -156,6 +156,10 @@ App.UI.SlaveInteract.mainPage = function(slave) { ...@@ -156,6 +156,10 @@ App.UI.SlaveInteract.mainPage = function(slave) {
return el; return el;
/**
* @param {siCategory} item
* @returns {HTMLElement}
*/
function makeTabButton(item) { function makeTabButton(item) {
const btn = document.createElement("button"); const btn = document.createElement("button");
btn.className = "tab-links"; btn.className = "tab-links";
...@@ -173,18 +177,26 @@ App.UI.SlaveInteract.mainPage = function(slave) { ...@@ -173,18 +177,26 @@ App.UI.SlaveInteract.mainPage = function(slave) {
} }
} }
/**
* @returns {DocumentFragment}
*/
function displayWithoutTabs() { function displayWithoutTabs() {
const el = new DocumentFragment(); const el = new DocumentFragment();
App.Events.drawEventArt(el, slave); App.Events.drawEventArt(el, slave);
for (const item of buttons) { for (const item of buttons) {
App.UI.DOM.appendNewElement("h2", el, item.title); App.UI.DOM.appendNewElement("h2", el, item.title);
el.append(item.node); el.append(makeContentSpan(item));
if (item.hasOwnProperty("onClick")) { if (item.hasOwnProperty("onClick")) {
item.onClick(); item.onClick();
} }
} }
return el; return el;
} }
/**
* @param {siCategory} item
* @returns {HTMLElement}
*/
function makeTabContents(item) { function makeTabContents(item) {
const wrapperEl = document.createElement("div"); const wrapperEl = document.createElement("div");
wrapperEl.id = item.id; wrapperEl.id = item.id;
...@@ -193,14 +205,21 @@ App.UI.SlaveInteract.mainPage = function(slave) { ...@@ -193,14 +205,21 @@ App.UI.SlaveInteract.mainPage = function(slave) {
const classEl = document.createElement("div"); const classEl = document.createElement("div");
classEl.classList.add("content"); classEl.classList.add("content");
classEl.append(makeContentSpan(item));
wrapperEl.append(classEl);
return wrapperEl;
}
/**
* @param {siCategory} item
* @returns {HTMLElement}
*/
function makeContentSpan(item) {
const uniqueContent = document.createElement("span"); const uniqueContent = document.createElement("span");
uniqueContent.id = `content-${item.id}`; uniqueContent.id = `content-${item.id}`;
uniqueContent.append(item.node); uniqueContent.append(item.node);
classEl.append(uniqueContent); return uniqueContent;
wrapperEl.append(classEl);
return wrapperEl;
} }
}; };
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment