[int]
This commit is contained in:
parent
17f432ab10
commit
9d1a0c856c
13 changed files with 63 additions and 57 deletions
|
@ -14,14 +14,30 @@ You should have received a copy of the GNU General Public License along with thi
|
|||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @todo outsource
|
||||
*/
|
||||
function template_request(
|
||||
id : string
|
||||
) : DocumentFragment
|
||||
namespace _espe.helpers
|
||||
{
|
||||
let dom_template = document.querySelector("template#" + id);
|
||||
// return template["content"].cloneNode(true);
|
||||
return (document.importNode(dom_template["content"], true) as DocumentFragment)
|
||||
|
||||
/**
|
||||
* @todo outsource
|
||||
*/
|
||||
export function template_request(
|
||||
id : string
|
||||
) : DocumentFragment
|
||||
{
|
||||
let dom_template = document.querySelector("template#" + id);
|
||||
// return template["content"].cloneNode(true);
|
||||
return (document.importNode(dom_template["content"], true) as DocumentFragment)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @todo outsource
|
||||
*/
|
||||
export function null_when_empty(
|
||||
str : (null | string)
|
||||
) : (null | string)
|
||||
{
|
||||
return (((str === null) || (str === "")) ? null : str);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License along with thi
|
|||
lib_plankton.zoo_page.register(
|
||||
"group_create",
|
||||
(parameters, target_element) => {
|
||||
target_element.appendChild(template_request("group_create"));
|
||||
target_element.appendChild(_espe.helpers.template_request("group_create"));
|
||||
|
||||
target_element.querySelector(".group_create-title").textContent = lib_plankton.translate.get("page.group_create.title");
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ lib_plankton.zoo_page.register(
|
|||
};
|
||||
const term : (null | string) = (parameters["term"] ?? "");
|
||||
|
||||
target_element.appendChild(template_request("group_list"));
|
||||
target_element.appendChild(_espe.helpers.template_request("group_list"));
|
||||
|
||||
target_element.querySelector(".group_list-title").textContent = lib_plankton.translate.get("page.group_list.title");
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ lib_plankton.zoo_page.register(
|
|||
async (parameters, target_element) => {
|
||||
const id : int = parseInt(parameters["id"]);
|
||||
|
||||
let dom_fragment : DocumentFragment = template_request("group_view");
|
||||
let dom_fragment : DocumentFragment = _espe.helpers.template_request("group_view");
|
||||
|
||||
dom_fragment.querySelector(".group_view-title").textContent = lib_plankton.translate.get("page.group_view.title");
|
||||
|
||||
|
|
|
@ -16,17 +16,12 @@ You should have received a copy of the GNU General Public License along with thi
|
|||
lib_plankton.zoo_page.register(
|
||||
"invite_create",
|
||||
async (parameters, target_element) => {
|
||||
target_element.appendChild(template_request("invite_create"));
|
||||
target_element.appendChild(_espe.helpers.template_request("invite_create"));
|
||||
|
||||
target_element.querySelector(".invite_create-title").textContent = lib_plankton.translate.get("page.invite_create.title");
|
||||
|
||||
const indent = str => (/*"... " + */str);
|
||||
|
||||
/**
|
||||
* @todo outsource
|
||||
*/
|
||||
const null_when_empty = (str) => (((str === null) || (str === "")) ? null : str);
|
||||
|
||||
/**
|
||||
* @todo cache
|
||||
*/
|
||||
|
@ -131,11 +126,11 @@ lib_plankton.zoo_page.register(
|
|||
representation => ({
|
||||
"data": {
|
||||
"name_changeable": representation.name.changeable,
|
||||
"name_value": null_when_empty(representation.name.value),
|
||||
"name_value": _espe.helpers.null_when_empty(representation.name.value),
|
||||
"label_changeable": representation.label.changeable,
|
||||
"label_value": null_when_empty(representation.label.value),
|
||||
"label_value": _espe.helpers.null_when_empty(representation.label.value),
|
||||
"email_address_changeable": representation.email_address.changeable,
|
||||
"email_address_value": null_when_empty(representation.email_address.value),
|
||||
"email_address_value": _espe.helpers.null_when_empty(representation.email_address.value),
|
||||
"groups_changeable": representation.groups.changeable,
|
||||
"groups_value": representation.groups.value,
|
||||
"expiry": (
|
||||
|
@ -220,7 +215,7 @@ lib_plankton.zoo_page.register(
|
|||
groups_as_array.map(
|
||||
group_thingy => group_thingy.id.toFixed(0)
|
||||
),
|
||||
group_id_encoded => groups_as_map.get(parseInt(group_id_encoded)).name
|
||||
group_id_encoded => groups_as_map.get(parseInt(group_id_encoded)).label
|
||||
),
|
||||
(value_inner) => {
|
||||
const array : Array<int> = [];
|
||||
|
|
|
@ -38,7 +38,7 @@ lib_plankton.zoo_page.register(
|
|||
const key : string = parameters["key"];
|
||||
|
||||
update_nav({"mode": null});
|
||||
target_element.appendChild(template_request("invite_handle"));
|
||||
target_element.appendChild(_espe.helpers.template_request("invite_handle"));
|
||||
set_state(
|
||||
"load",
|
||||
[
|
||||
|
|
|
@ -31,7 +31,7 @@ lib_plankton.zoo_page.register(
|
|||
const term : (null | string) = (parameters["term"] ?? "");
|
||||
|
||||
// exec
|
||||
target_element.appendChild(template_request("invite_list"));
|
||||
target_element.appendChild(_espe.helpers.template_request("invite_list"));
|
||||
|
||||
target_element.querySelector(".invite_list-title").textContent = lib_plankton.translate.get("page.invite_list.title");
|
||||
|
||||
|
|
|
@ -31,17 +31,12 @@ lib_plankton.zoo_page.register(
|
|||
// parameters
|
||||
const id : int = parseInt(parameters["id"]);
|
||||
|
||||
target_element.appendChild(template_request("invite_view"));
|
||||
target_element.appendChild(_espe.helpers.template_request("invite_view"));
|
||||
|
||||
target_element.querySelector(".invite_view-title").textContent = lib_plankton.translate.get("page.invite_view.title");
|
||||
|
||||
const indent = str => (/*"... " + */str);
|
||||
|
||||
/**
|
||||
* @todo outsource
|
||||
*/
|
||||
const null_when_empty = (str) => (((str === null) || (str === "")) ? null : str);
|
||||
|
||||
/**
|
||||
* @todo cache
|
||||
*/
|
||||
|
@ -157,7 +152,7 @@ lib_plankton.zoo_page.register(
|
|||
"label_changeable": representation.label.changeable,
|
||||
"label_value": representation.label.value,
|
||||
"email_address_changeable": representation.email_address.changeable,
|
||||
"email_address_value": null_when_empty(representation.email_address.value),
|
||||
"email_address_value": _espe.helpers.null_when_empty(representation.email_address.value),
|
||||
"groups_changeable": representation.groups.changeable,
|
||||
"groups_value": representation.groups.value,
|
||||
"url": "",
|
||||
|
@ -210,6 +205,24 @@ lib_plankton.zoo_page.register(
|
|||
),
|
||||
"label": lib_plankton.translate.get("domain.member.label.label"),
|
||||
},
|
||||
{
|
||||
"name": "email_address",
|
||||
"input": new lib_plankton.zoo_input.class_input_group(
|
||||
[
|
||||
{
|
||||
"name": "value",
|
||||
"input": new lib_plankton.zoo_input.class_input_text({"read_only": true}),
|
||||
"label": indent(lib_plankton.translate.get("common.initial_value")),
|
||||
},
|
||||
{
|
||||
"name": "changeable",
|
||||
"input": new lib_plankton.zoo_input.class_input_checkbox({"read_only": true}),
|
||||
"label": indent(lib_plankton.translate.get("common.changeable")),
|
||||
},
|
||||
]
|
||||
),
|
||||
"label": lib_plankton.translate.get("domain.member.email_address.label"),
|
||||
},
|
||||
{
|
||||
"name": "groups",
|
||||
"input": new lib_plankton.zoo_input.class_input_group(
|
||||
|
@ -227,7 +240,7 @@ lib_plankton.zoo_page.register(
|
|||
groups_as_array.map(
|
||||
group_thingy => group_thingy.id.toFixed(0)
|
||||
),
|
||||
group_id_encoded => groups_as_map.get(parseInt(group_id_encoded)).name
|
||||
group_id_encoded => groups_as_map.get(parseInt(group_id_encoded)).label
|
||||
),
|
||||
(value_inner) => {
|
||||
const array : Array<int> = [];
|
||||
|
@ -250,24 +263,6 @@ lib_plankton.zoo_page.register(
|
|||
),
|
||||
"label": lib_plankton.translate.get("domain.member.groups.label"),
|
||||
},
|
||||
{
|
||||
"name": "email_address",
|
||||
"input": new lib_plankton.zoo_input.class_input_group(
|
||||
[
|
||||
{
|
||||
"name": "value",
|
||||
"input": new lib_plankton.zoo_input.class_input_text({"read_only": true}),
|
||||
"label": indent(lib_plankton.translate.get("common.initial_value")),
|
||||
},
|
||||
{
|
||||
"name": "changeable",
|
||||
"input": new lib_plankton.zoo_input.class_input_checkbox({"read_only": true}),
|
||||
"label": indent(lib_plankton.translate.get("common.changeable")),
|
||||
},
|
||||
]
|
||||
),
|
||||
"label": lib_plankton.translate.get("domain.member.email_address.label"),
|
||||
},
|
||||
{
|
||||
"name": "expiry",
|
||||
"input": new lib_plankton.zoo_input.class_input_soft(
|
||||
|
|
|
@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License along with thi
|
|||
lib_plankton.zoo_page.register(
|
||||
"login",
|
||||
(parameters, target_element) => {
|
||||
target_element.appendChild(template_request("login"));
|
||||
target_element.appendChild(_espe.helpers.template_request("login"));
|
||||
|
||||
target_element.querySelector(".login-title").textContent = lib_plankton.translate.get("page.login.title");
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ lib_plankton.zoo_page.register(
|
|||
};
|
||||
const term : (null | string) = (parameters["term"] ?? "");
|
||||
|
||||
target_element.appendChild(template_request("member_list"));
|
||||
target_element.appendChild(_espe.helpers.template_request("member_list"));
|
||||
|
||||
target_element.querySelector(".member_list-title").textContent = lib_plankton.translate.get("page.member_list.title");
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ lib_plankton.zoo_page.register(
|
|||
async (parameters, target_element) => {
|
||||
const id : int = parseInt(parameters["id"]);
|
||||
|
||||
let dom_fragment : DocumentFragment = template_request("member_view");
|
||||
let dom_fragment : DocumentFragment = _espe.helpers.template_request("member_view");
|
||||
|
||||
dom_fragment.querySelector(".member_view-title").textContent = lib_plankton.translate.get("page.member_view.title");
|
||||
|
||||
|
@ -133,7 +133,7 @@ lib_plankton.zoo_page.register(
|
|||
groups_as_array.map(
|
||||
group_thingy => group_thingy.id.toFixed(0)
|
||||
),
|
||||
group_id_encoded => groups_as_map.get(parseInt(group_id_encoded)).name
|
||||
group_id_encoded => groups_as_map.get(parseInt(group_id_encoded)).label
|
||||
),
|
||||
(value_inner) => {
|
||||
const array : Array<int> = [];
|
||||
|
|
|
@ -38,7 +38,7 @@ lib_plankton.zoo_page.register(
|
|||
const token : string = parameters.token;
|
||||
|
||||
update_nav({"mode": null});
|
||||
target_element.appendChild(template_request("password_change_exec"));
|
||||
target_element.appendChild(_espe.helpers.template_request("password_change_exec"));
|
||||
target_element.querySelector(".password_change_exec-title").textContent = lib_plankton.translate.get("page.password_change_exec.title");
|
||||
set_state(
|
||||
"load",
|
||||
|
|
|
@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License along with thi
|
|||
lib_plankton.zoo_page.register(
|
||||
"password_change_init",
|
||||
(parameters, target_element) => {
|
||||
target_element.appendChild(template_request("password_change_init"));
|
||||
target_element.appendChild(_espe.helpers.template_request("password_change_init"));
|
||||
|
||||
target_element.querySelector(".password_change_init-title").textContent = lib_plankton.translate.get("page.password_change_init.title");
|
||||
target_element.querySelector(".password_change_init-info").textContent = lib_plankton.translate.get("page.password_change_init.info");
|
||||
|
|
Loading…
Add table
Reference in a new issue