Einladungs-System #2
15 changed files with 3782 additions and 1047 deletions
1034
lib/plankton/plankton.d.ts
vendored
1034
lib/plankton/plankton.d.ts
vendored
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -2,7 +2,7 @@
|
|||
"backend": {
|
||||
"scheme": "http",
|
||||
"host": "localhost",
|
||||
"port": 7979,
|
||||
"port": 4916,
|
||||
"path_base": ""
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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_special_character": "das Passwort muss ein Sonderzeichen beinhalten",
|
||||
"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"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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_special_character": "das Passwort muss ein Sonderzeichen beinhalten",
|
||||
"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"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -485,4 +485,86 @@ 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(
|
||||
key : string
|
||||
) : Promise<
|
||||
{
|
||||
membership_number_changeable : boolean;
|
||||
membership_number_value : (null | string);
|
||||
name_changeable : boolean;
|
||||
name_value : string;
|
||||
email_address_changeable : boolean;
|
||||
email_address_value : (null | string);
|
||||
groups_changeable : boolean;
|
||||
groups_value : Array<string>;
|
||||
}
|
||||
>
|
||||
{
|
||||
return abstract_call(
|
||||
"GET",
|
||||
lib_plankton.string.coin(
|
||||
"/invite/examine?key={{key}}",
|
||||
{
|
||||
"key": key
|
||||
}
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*/
|
||||
export async function invite_accept(
|
||||
key : string,
|
||||
data : {
|
||||
membership_number_value : string;
|
||||
name_value : string;
|
||||
email_address_value : (null | string);
|
||||
groups_value : Array<string>;
|
||||
}
|
||||
) : Promise<void>
|
||||
{
|
||||
return abstract_call(
|
||||
"POST",
|
||||
"/invite/accept",
|
||||
{
|
||||
"data": {
|
||||
"key": key,
|
||||
"membership_number_value": data.membership_number_value,
|
||||
"name_value": data.name_value,
|
||||
"email_address_value": data.email_address_value,
|
||||
"groups_value": data.groups_value,
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -69,6 +69,11 @@ function setup_nav(
|
|||
"label": "Anlegen",
|
||||
"classes": ["logged_in"],
|
||||
},
|
||||
{
|
||||
"location": {"name": "invite_list", "parameters": {}},
|
||||
"label": "Einladungen",
|
||||
"classes": ["logged_in"],
|
||||
},
|
||||
{
|
||||
"location": {"name": "logout", "parameters": {}},
|
||||
"label": "Abmelden",
|
||||
|
|
154
source/pages/invite_handle/logic.ts
Normal file
154
source/pages/invite_handle/logic.ts
Normal file
|
@ -0,0 +1,154 @@
|
|||
/*
|
||||
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_handle",
|
||||
async (parameters, target_element) => {
|
||||
// parameters
|
||||
const key : string = parameters["key"];
|
||||
|
||||
target_element.appendChild(template_request("invite_handle"));
|
||||
|
||||
target_element.querySelector(".invite_handle-title").textContent = lib_plankton.translate.get("page.invite_handle.title");
|
||||
|
||||
const data : {
|
||||
membership_number_changeable : boolean;
|
||||
membership_number_value : (null | string);
|
||||
name_changeable : boolean;
|
||||
name_value : string;
|
||||
email_address_changeable : boolean;
|
||||
email_address_value : (null | string);
|
||||
groups_changeable : boolean;
|
||||
groups_value : Array<string>;
|
||||
} = await _espe.backend.invite_examine(key);
|
||||
|
||||
const form = new lib_plankton.zoo_form.class_form<
|
||||
{
|
||||
membership_number_value : (null | string);
|
||||
name_value : string;
|
||||
email_address_value : (null | string);
|
||||
groups_value : Array<string>;
|
||||
},
|
||||
{
|
||||
membership_number_value : string;
|
||||
name_value : string;
|
||||
email_address_value : string;
|
||||
groups_value : Array<string>;
|
||||
}
|
||||
>(
|
||||
value => ({
|
||||
"membership_number_value": (value.membership_number_value ?? ""),
|
||||
"name_value": value.name_value,
|
||||
"email_address_value": (value.email_address_value ?? ""),
|
||||
"groups_value": value.groups_value,
|
||||
}),
|
||||
representation => ({
|
||||
"membership_number_value": representation.membership_number_value,
|
||||
"name_value": representation.name_value,
|
||||
"email_address_value": representation.email_address_value,
|
||||
"groups_value": representation.groups_value,
|
||||
}),
|
||||
new lib_plankton.zoo_input.class_input_group(
|
||||
[
|
||||
{
|
||||
"name": "membership_number_value",
|
||||
"input": new lib_plankton.zoo_input.class_input_text(
|
||||
{
|
||||
"read_only": (! data.membership_number_changeable),
|
||||
}
|
||||
),
|
||||
/**
|
||||
* @todo translate
|
||||
*/
|
||||
"label": "Mitgliedsnummer",
|
||||
},
|
||||
{
|
||||
"name": "groups_value",
|
||||
"input": new lib_plankton.zoo_input.class_input_list(
|
||||
() => new lib_plankton.zoo_input.class_input_text(
|
||||
{
|
||||
"read_only": (! data.groups_changeable),
|
||||
}
|
||||
),
|
||||
{
|
||||
"read_only": (! data.groups_changeable),
|
||||
}
|
||||
),
|
||||
/**
|
||||
* @todo translate
|
||||
*/
|
||||
"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",
|
||||
},
|
||||
]
|
||||
),
|
||||
[
|
||||
{
|
||||
"label": "Senden",
|
||||
"procedure": async (get_value, get_representation) => {
|
||||
const value = await get_value();
|
||||
await _espe.backend.invite_accept(
|
||||
key,
|
||||
{
|
||||
"membership_number_value": value.membership_number_value,
|
||||
"name_value": value.name_value,
|
||||
"email_address_value": value.email_address_value,
|
||||
"groups_value": value.groups_value,
|
||||
}
|
||||
);
|
||||
/**
|
||||
* @todo redirect
|
||||
*/
|
||||
/*
|
||||
lib_plankton.zoo_page.set({"name": "view", "parameters": {"id": id}});
|
||||
*/
|
||||
},
|
||||
}
|
||||
]
|
||||
);
|
||||
await form.setup(target_element.querySelector(".invite_handle-form") as HTMLElement);
|
||||
await form.input_write(
|
||||
{
|
||||
"membership_number_value": data.membership_number_value,
|
||||
"name_value": data.name_value,
|
||||
"email_address_value": data.email_address_value,
|
||||
"groups_value": data.groups_value,
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
19
source/pages/invite_handle/structure.html
Normal file
19
source/pages/invite_handle/structure.html
Normal file
|
@ -0,0 +1,19 @@
|
|||
<!--
|
||||
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/>.
|
||||
-->
|
||||
|
||||
<template id="invite_handle">
|
||||
<h2 class="invite_handle-title"></h2>
|
||||
<div class="invite_handle-form"></div>
|
||||
</template>
|
81
source/pages/invite_list/logic.ts
Normal file
81
source/pages/invite_list/logic.ts
Normal 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,
|
||||
" "
|
||||
);
|
||||
*/
|
||||
}
|
||||
);
|
22
source/pages/invite_list/structure.html
Normal file
22
source/pages/invite_list/structure.html
Normal file
|
@ -0,0 +1,22 @@
|
|||
<!--
|
||||
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/>.
|
||||
-->
|
||||
|
||||
<template id="invite_list">
|
||||
<h2 class="invite_list-title"></h2>
|
||||
<!--
|
||||
<pre class="invite_list-data"></pre>
|
||||
-->
|
||||
<div class="invite_list-search"></div>
|
||||
</template>
|
|
@ -25,7 +25,7 @@ lib_plankton.zoo_page.register(
|
|||
};
|
||||
};
|
||||
const term : (null | string) = (parameters["term"] ?? "");
|
||||
|
||||
|
||||
target_element.appendChild(template_request("list"));
|
||||
|
||||
target_element.querySelector(".list-title").textContent = lib_plankton.translate.get("page.list.title");
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
@ -30,7 +30,6 @@ html
|
|||
color: hsl(var(--hue), 0%, 100%);
|
||||
}
|
||||
|
||||
|
||||
body
|
||||
{
|
||||
max-width: 960px;
|
||||
|
@ -171,6 +170,12 @@ nav > ul > li:hover::after
|
|||
font-weight: bold;
|
||||
}
|
||||
|
||||
.plankton_form_actions > *
|
||||
{
|
||||
display: block;
|
||||
margin: 8px;
|
||||
}
|
||||
|
||||
.plankton_search_item
|
||||
{
|
||||
cursor: pointer;
|
||||
|
@ -210,7 +215,6 @@ nav > ul > li:hover::after
|
|||
display: block;
|
||||
}
|
||||
|
||||
|
||||
.plankton_input_enumeration > *
|
||||
{
|
||||
display: block;
|
||||
|
@ -236,3 +240,14 @@ nav > ul > li:hover::after
|
|||
{
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
|
||||
.plankton_input_list_element > *
|
||||
{
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.plankton_input_list_element_input
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
@ -47,6 +47,8 @@ ${dir_temp}/logic-unlinked.js: \
|
|||
${dir_source}/pages/register/logic.ts \
|
||||
${dir_source}/pages/password_change_init/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}/logic/main.ts
|
||||
@ ${cmd_log} "logic | compile …"
|
||||
@ ${cmd_mkdir} $(dir $@)
|
||||
|
@ -83,7 +85,9 @@ ${dir_build}/index.html: \
|
|||
${dir_source}/pages/view/structure.html \
|
||||
${dir_source}/pages/register/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
|
||||
@ ${cmd_log} "structure …"
|
||||
@ ${cmd_mkdir} $(dir $@)
|
||||
@ tools/make-index $^ > $@
|
||||
|
|
Loading…
Add table
Reference in a new issue