[task-193] [int]

This commit is contained in:
roydfalk 2025-04-12 10:19:59 +00:00
parent b2eeb3f1fe
commit 76a2d7dff4
13 changed files with 3577 additions and 1091 deletions

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -69,6 +69,8 @@
"page.password_change_exec.flaw.password_lacks_number": "das Passwort muss ein Zahl beinhalten", "page.password_change_exec.flaw.password_lacks_number": "das Passwort muss ein Zahl beinhalten",
"page.password_change_exec.flaw.password_lacks_special_character": "das Passwort muss ein Sonderzeichen beinhalten", "page.password_change_exec.flaw.password_lacks_special_character": "das Passwort muss ein Sonderzeichen beinhalten",
"page.password_change_exec.flaw.unhandled_error": "da ist etwas schief gelaufen :/", "page.password_change_exec.flaw.unhandled_error": "da ist etwas schief gelaufen :/",
"page.password_change_exec.status.success": "erledigt" "page.password_change_exec.status.success": "erledigt",
"page.invite_list.title": "Einladungen",
"page.invite_handle.title": "Einladung"
} }
} }

View file

@ -69,6 +69,8 @@
"page.password_change_exec.flaw.password_lacks_number": "das Passwort muss ein Zahl beinhalten", "page.password_change_exec.flaw.password_lacks_number": "das Passwort muss ein Zahl beinhalten",
"page.password_change_exec.flaw.password_lacks_special_character": "das Passwort muss ein Sonderzeichen beinhalten", "page.password_change_exec.flaw.password_lacks_special_character": "das Passwort muss ein Sonderzeichen beinhalten",
"page.password_change_exec.flaw.unhandled_error": "da ist etwas schief gelaufen :/", "page.password_change_exec.flaw.unhandled_error": "da ist etwas schief gelaufen :/",
"page.password_change_exec.status.success": "done" "page.password_change_exec.status.success": "done",
"page.invite_list.title": "Invites",
"page.invite_handle.title": "Invite"
} }
} }

View file

@ -485,20 +485,45 @@ namespace _espe.backend
); );
} }
/**
*/
export async function invite_list(
) : Promise<
Array<
{
id : int;
key : string;
expiry : (null | int);
name_value : string;
}
>
>
{
return abstract_call(
"GET",
lib_plankton.string.coin(
"/invite/list",
{
}
)
);
}
/** /**
*/ */
export async function invite_examine( export async function invite_examine(
key : string key : string
) : Promise< ) : Promise<
{ {
membership_number_mode : int; membership_number_changeable : boolean;
membership_number_value : (null | string); membership_number_value : (null | string);
name_mode : int; name_changeable : boolean;
name_value : string; name_value : string;
email_address_mode : int; email_address_changeable : boolean;
email_address_value : (null | string); email_address_value : (null | string);
groups_mode : int; groups_changeable : boolean;
groups_value : Array<string>; groups_value : Array<string>;
} }
> >

View file

@ -69,6 +69,11 @@ function setup_nav(
"label": "Anlegen", "label": "Anlegen",
"classes": ["logged_in"], "classes": ["logged_in"],
}, },
{
"location": {"name": "invite_list", "parameters": {}},
"label": "Einladungen",
"classes": ["logged_in"],
},
{ {
"location": {"name": "logout", "parameters": {}}, "location": {"name": "logout", "parameters": {}},
"label": "Abmelden", "label": "Abmelden",

View file

@ -21,18 +21,16 @@ lib_plankton.zoo_page.register(
target_element.appendChild(template_request("invite_handle")); target_element.appendChild(template_request("invite_handle"));
/** target_element.querySelector(".invite_handle-title").textContent = lib_plankton.translate.get("page.invite_handle.title");
* @todo invite_handle-title
*/
const data : { const data : {
membership_number_mode : int; membership_number_changeable : boolean;
membership_number_value : (null | string); membership_number_value : (null | string);
name_mode : int; name_changeable : boolean;
name_value : string; name_value : string;
email_address_mode : int; email_address_changeable : boolean;
email_address_value : (null | string); email_address_value : (null | string);
groups_mode : int; groups_changeable : boolean;
groups_value : Array<string>; groups_value : Array<string>;
} = await _espe.backend.invite_examine(key); } = await _espe.backend.invite_examine(key);
@ -64,23 +62,11 @@ lib_plankton.zoo_page.register(
}), }),
new lib_plankton.zoo_input.class_input_group( new lib_plankton.zoo_input.class_input_group(
[ [
{
"name": "name_value",
"input": new lib_plankton.zoo_input.class_input_text(
{
"read_only": (data.name_mode <= 1),
}
),
/**
* @todo translate
*/
"label": "Name",
},
{ {
"name": "membership_number_value", "name": "membership_number_value",
"input": new lib_plankton.zoo_input.class_input_text( "input": new lib_plankton.zoo_input.class_input_text(
{ {
"read_only": (data.membership_number_mode <= 1), "read_only": (! data.membership_number_changeable),
} }
), ),
/** /**
@ -88,27 +74,16 @@ lib_plankton.zoo_page.register(
*/ */
"label": "Mitgliedsnummer", "label": "Mitgliedsnummer",
}, },
{
"name": "email_address_value",
"input": new lib_plankton.zoo_input.class_input_text(
{
"read_only": (data.email_address_mode <= 1),
}
),
/**
* @todo translate
*/
"label": "E-Mail-Adresse",
},
{ {
"name": "groups_value", "name": "groups_value",
"input": new lib_plankton.zoo_input.class_input_list( "input": new lib_plankton.zoo_input.class_input_list(
() => new lib_plankton.zoo_input.class_input_text(), () => new lib_plankton.zoo_input.class_input_text(
{
"read_only": (! data.groups_changeable),
}
),
{ {
/** "read_only": (! data.groups_changeable),
* @todo does not work yet
*/
// "read_only": (data.groups_mode <= 1),
} }
), ),
/** /**
@ -116,6 +91,30 @@ lib_plankton.zoo_page.register(
*/ */
"label": "Gruppen", "label": "Gruppen",
}, },
{
"name": "name_value",
"input": new lib_plankton.zoo_input.class_input_text(
{
"read_only": (! data.name_changeable),
}
),
/**
* @todo translate
*/
"label": "Name",
},
{
"name": "email_address_value",
"input": new lib_plankton.zoo_input.class_input_text(
{
"read_only": (! data.email_address_changeable),
}
),
/**
* @todo translate
*/
"label": "E-Mail-Adresse",
},
] ]
), ),
[ [

View file

@ -0,0 +1,81 @@
/*
Espe | Ein schlichtes Werkzeug zur Mitglieder-Verwaltung | Frontend
Copyright (C) 2024 Christian Fraß
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public
License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later
version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see
<https://www.gnu.org/licenses/>.
*/
lib_plankton.zoo_page.register(
"invite_list",
async (parameters, target_element) => {
type type_item = {
id : int;
key : string;
expiry : (null | int);
name_value : string;
};
target_element.appendChild(template_request("invite_list"));
target_element.querySelector(".invite_list-title").textContent = lib_plankton.translate.get("page.invite_list.title");
const search : lib_plankton.zoo_search.type_search<type_item> = lib_plankton.zoo_search.make<type_item>(
(term) => _espe.backend.invite_list(),
{
"encode_item": (item) => lib_plankton.string.coin(
"[{{id}}] {{name}}: {{key}}",
{
"id": item.id.toFixed(0),
"name": item.name_value,
"key": item.key,
}
),
"hooks_begin": [
(term) => {
/**
* @todo
*/
}
],
"hooks_select": [
(item) => {
const url : URL = new URL(window.location.toString());
url.hash = lib_plankton.string.coin(
"#invite_handle,key={{key}}",
{
"key": item.key,
}
);
console.info(url.toString());
}
]
}
);
lib_plankton.zoo_search.render(
search,
target_element.querySelector(".invite_list-search"),
{
"state": {
"term": "",
}
}
);
/*
const data = await _espe.backend.invite_list();
(target_element.querySelector(".invite_list-data") as HTMLElement).textContent = JSON.stringify(
data,
undefined,
" "
);
*/
}
);

View file

@ -1,4 +1,4 @@
/* <!--
Espe | Ein schlichtes Werkzeug zur Mitglieder-Verwaltung | Frontend Espe | Ein schlichtes Werkzeug zur Mitglieder-Verwaltung | Frontend
Copyright (C) 2024 Christian Fraß Copyright (C) 2024 Christian Fraß
@ -11,5 +11,12 @@ warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Gen
You should have received a copy of the GNU General Public License along with this program. If not, see You should have received a copy of the GNU General Public License along with this program. If not, see
<https://www.gnu.org/licenses/>. <https://www.gnu.org/licenses/>.
*/ -->
<template id="invite_list">
<h2 class="invite_list-title"></h2>
<!--
<pre class="invite_list-data"></pre>
-->
<div class="invite_list-search"></div>
</template>

View file

@ -25,7 +25,7 @@ lib_plankton.zoo_page.register(
}; };
}; };
const term : (null | string) = (parameters["term"] ?? ""); const term : (null | string) = (parameters["term"] ?? "");
target_element.appendChild(template_request("list")); target_element.appendChild(template_request("list"));
target_element.querySelector(".list-title").textContent = lib_plankton.translate.get("page.list.title"); target_element.querySelector(".list-title").textContent = lib_plankton.translate.get("page.list.title");

View file

@ -39,18 +39,3 @@ You should have received a copy of the GNU General Public License along with thi
} }
*/ */
.plankton_form_actions > *
{
display: block;
margin: 8px;
}
section.view .plankton_input_list_element > *
{
display: inline-block;
}
section.view .plankton_input_list_element_input
{
}

View file

@ -30,7 +30,6 @@ html
color: hsl(var(--hue), 0%, 100%); color: hsl(var(--hue), 0%, 100%);
} }
body body
{ {
max-width: 960px; max-width: 960px;
@ -171,6 +170,12 @@ nav > ul > li:hover::after
font-weight: bold; font-weight: bold;
} }
.plankton_form_actions > *
{
display: block;
margin: 8px;
}
.plankton_search_item .plankton_search_item
{ {
cursor: pointer; cursor: pointer;
@ -210,7 +215,6 @@ nav > ul > li:hover::after
display: block; display: block;
} }
.plankton_input_enumeration > * .plankton_input_enumeration > *
{ {
display: block; display: block;
@ -236,3 +240,14 @@ nav > ul > li:hover::after
{ {
margin-bottom: 8px; margin-bottom: 8px;
} }
.plankton_input_list_element > *
{
display: inline-block;
}
.plankton_input_list_element_input
{
}

View file

@ -47,6 +47,7 @@ ${dir_temp}/logic-unlinked.js: \
${dir_source}/pages/register/logic.ts \ ${dir_source}/pages/register/logic.ts \
${dir_source}/pages/password_change_init/logic.ts \ ${dir_source}/pages/password_change_init/logic.ts \
${dir_source}/pages/password_change_exec/logic.ts \ ${dir_source}/pages/password_change_exec/logic.ts \
${dir_source}/pages/invite_list/logic.ts \
${dir_source}/pages/invite_handle/logic.ts \ ${dir_source}/pages/invite_handle/logic.ts \
${dir_source}/logic/main.ts ${dir_source}/logic/main.ts
@ ${cmd_log} "logic | compile …" @ ${cmd_log} "logic | compile …"
@ -69,8 +70,7 @@ ${dir_build}/style.css: \
${dir_source}/pages/view/style.css \ ${dir_source}/pages/view/style.css \
${dir_source}/pages/register/style.css \ ${dir_source}/pages/register/style.css \
${dir_source}/pages/password_change_init/style.css \ ${dir_source}/pages/password_change_init/style.css \
${dir_source}/pages/password_change_exec/style.css \ ${dir_source}/pages/password_change_exec/style.css
${dir_source}/pages/invite_handle/style.css
@ ${cmd_log} "style …" @ ${cmd_log} "style …"
@ ${cmd_mkdir} $(dir $@) @ ${cmd_mkdir} $(dir $@)
@ ${cmd_cat} $^ > $@ @ ${cmd_cat} $^ > $@
@ -86,6 +86,7 @@ ${dir_build}/index.html: \
${dir_source}/pages/register/structure.html \ ${dir_source}/pages/register/structure.html \
${dir_source}/pages/password_change_init/structure.html \ ${dir_source}/pages/password_change_init/structure.html \
${dir_source}/pages/password_change_exec/structure.html \ ${dir_source}/pages/password_change_exec/structure.html \
${dir_source}/pages/invite_list/structure.html \
${dir_source}/pages/invite_handle/structure.html ${dir_source}/pages/invite_handle/structure.html
@ ${cmd_log} "structure …" @ ${cmd_log} "structure …"
@ ${cmd_mkdir} $(dir $@) @ ${cmd_mkdir} $(dir $@)