[add] page:calendar_edit
This commit is contained in:
parent
e96608222f
commit
4438645a8f
9 changed files with 522 additions and 122 deletions
|
@ -229,6 +229,26 @@ namespace _zeitbild.frontend_web.backend
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
export async function user_list(
|
||||||
|
) : Promise<
|
||||||
|
Array<
|
||||||
|
{
|
||||||
|
id : int;
|
||||||
|
name : string;
|
||||||
|
}
|
||||||
|
>
|
||||||
|
>
|
||||||
|
{
|
||||||
|
return call(
|
||||||
|
lib_plankton.http.enum_method.get,
|
||||||
|
"/users",
|
||||||
|
null
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
export async function calendar_list(
|
export async function calendar_list(
|
||||||
|
@ -250,6 +270,63 @@ namespace _zeitbild.frontend_web.backend
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
export async function calendar_get(
|
||||||
|
calendar_id : _zeitbild.frontend_web.type.calendar_id
|
||||||
|
) : Promise<
|
||||||
|
_zeitbild.frontend_web.type.calendar_object
|
||||||
|
>
|
||||||
|
{
|
||||||
|
return (
|
||||||
|
call(
|
||||||
|
lib_plankton.http.enum_method.get,
|
||||||
|
lib_plankton.string.coin(
|
||||||
|
"/calendar/{{calendar_id}}",
|
||||||
|
{
|
||||||
|
"calendar_id": calendar_id.toFixed(0),
|
||||||
|
}
|
||||||
|
),
|
||||||
|
null
|
||||||
|
)
|
||||||
|
.then(
|
||||||
|
(raw) => Promise.resolve(
|
||||||
|
{
|
||||||
|
"name": raw.name,
|
||||||
|
"access": {
|
||||||
|
"default_level": access_level_decode(raw.access.default_level),
|
||||||
|
"attributed": lib_plankton.map.hashmap.implementation_map(
|
||||||
|
lib_plankton.map.hashmap.make(
|
||||||
|
x => x.toFixed(0),
|
||||||
|
{
|
||||||
|
"pairs": (
|
||||||
|
raw.access.attributed
|
||||||
|
.map(
|
||||||
|
(entry) => ({
|
||||||
|
"key": entry.user_id,
|
||||||
|
"value": access_level_decode(entry.level),
|
||||||
|
})
|
||||||
|
)
|
||||||
|
),
|
||||||
|
}
|
||||||
|
)
|
||||||
|
),
|
||||||
|
},
|
||||||
|
// "resource_id": raw.resource_id
|
||||||
|
// TODO
|
||||||
|
"resource": {
|
||||||
|
"kind": "local",
|
||||||
|
"data": {
|
||||||
|
"events": []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
export async function calendar_add(
|
export async function calendar_add(
|
||||||
|
@ -260,7 +337,11 @@ namespace _zeitbild.frontend_web.backend
|
||||||
{
|
{
|
||||||
return call(
|
return call(
|
||||||
lib_plankton.http.enum_method.post,
|
lib_plankton.http.enum_method.post,
|
||||||
|
lib_plankton.string.coin(
|
||||||
"/calendar",
|
"/calendar",
|
||||||
|
{
|
||||||
|
}
|
||||||
|
),
|
||||||
{
|
{
|
||||||
"name": calendar_object.name,
|
"name": calendar_object.name,
|
||||||
"access": {
|
"access": {
|
||||||
|
@ -281,6 +362,64 @@ namespace _zeitbild.frontend_web.backend
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
export async function calendar_change(
|
||||||
|
calendar_id : _zeitbild.frontend_web.type.calendar_id,
|
||||||
|
calendar_object : _zeitbild.frontend_web.type.calendar_object
|
||||||
|
) : Promise<
|
||||||
|
void
|
||||||
|
>
|
||||||
|
{
|
||||||
|
return call(
|
||||||
|
lib_plankton.http.enum_method.put,
|
||||||
|
lib_plankton.string.coin(
|
||||||
|
"/calendar/{{calendar_id}}",
|
||||||
|
{
|
||||||
|
"calendar_id": calendar_id.toFixed(0),
|
||||||
|
}
|
||||||
|
),
|
||||||
|
{
|
||||||
|
"name": calendar_object.name,
|
||||||
|
"access": {
|
||||||
|
"default_level": access_level_encode(calendar_object.access.default_level),
|
||||||
|
"attributed": (
|
||||||
|
lib_plankton.map.dump(calendar_object.access.attributed)
|
||||||
|
.map(
|
||||||
|
(pair) => ({
|
||||||
|
"user_id": pair.key,
|
||||||
|
"level": access_level_encode(pair.value),
|
||||||
|
})
|
||||||
|
)
|
||||||
|
)
|
||||||
|
},
|
||||||
|
"resource": calendar_object.resource,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
export async function calendar_remove(
|
||||||
|
calendar_id : _zeitbild.frontend_web.type.calendar_id
|
||||||
|
) : Promise<
|
||||||
|
void
|
||||||
|
>
|
||||||
|
{
|
||||||
|
return call(
|
||||||
|
lib_plankton.http.enum_method.delete,
|
||||||
|
lib_plankton.string.coin(
|
||||||
|
"/calendar/{{calendar_id}}",
|
||||||
|
{
|
||||||
|
"calendar_id": calendar_id.toFixed(0),
|
||||||
|
}
|
||||||
|
),
|
||||||
|
null
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
export async function calendar_event_get(
|
export async function calendar_event_get(
|
||||||
|
|
|
@ -66,4 +66,87 @@ namespace _zeitbild.frontend_web.helpers
|
||||||
return Promise.resolve<Array<type_result>>(results);
|
return Promise.resolve<Array<type_result>>(results);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
export function input_access_level(
|
||||||
|
) : lib_plankton.zoo_input.interface_input<_zeitbild.frontend_web.type.enum_access_level>
|
||||||
|
{
|
||||||
|
return (
|
||||||
|
new lib_plankton.zoo_input.class_input_wrapped<
|
||||||
|
/*("none" | "view" | "edit" | "admin")*/string,
|
||||||
|
_zeitbild.frontend_web.type.enum_access_level
|
||||||
|
>(
|
||||||
|
new lib_plankton.zoo_input.class_input_selection(
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"value": "none",
|
||||||
|
"label": lib_plankton.translate.get("access_level.none"),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"value": "view",
|
||||||
|
"label": lib_plankton.translate.get("access_level.view")
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"value": "edit",
|
||||||
|
"label": lib_plankton.translate.get("access_level.edit")
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"value": "admin",
|
||||||
|
"label": lib_plankton.translate.get("access_level.admin")
|
||||||
|
},
|
||||||
|
]
|
||||||
|
),
|
||||||
|
(raw) => {
|
||||||
|
switch (raw) {
|
||||||
|
case "none": return _zeitbild.frontend_web.type.enum_access_level.none;
|
||||||
|
case "view": return _zeitbild.frontend_web.type.enum_access_level.view;
|
||||||
|
case "edit": return _zeitbild.frontend_web.type.enum_access_level.edit;
|
||||||
|
case "admin": return _zeitbild.frontend_web.type.enum_access_level.admin;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
(access_level) => {
|
||||||
|
switch (access_level) {
|
||||||
|
case _zeitbild.frontend_web.type.enum_access_level.none: return "none";
|
||||||
|
case _zeitbild.frontend_web.type.enum_access_level.view: return "view";
|
||||||
|
case _zeitbild.frontend_web.type.enum_access_level.edit: return "edit";
|
||||||
|
case _zeitbild.frontend_web.type.enum_access_level.admin: return "admin";
|
||||||
|
}
|
||||||
|
},
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
export async function input_attributed_access(
|
||||||
|
) : Promise<lib_plankton.zoo_input.class_input_hashmap<_zeitbild.frontend_web.type.user_id, _zeitbild.frontend_web.type.enum_access_level>>
|
||||||
|
{
|
||||||
|
const users : Array<{id : _zeitbild.frontend_web.type.user_id; name : string;}> = await _zeitbild.frontend_web.backend.user_list(
|
||||||
|
);
|
||||||
|
return Promise.resolve(
|
||||||
|
new lib_plankton.zoo_input.class_input_hashmap<_zeitbild.frontend_web.type.user_id, _zeitbild.frontend_web.type.enum_access_level>(
|
||||||
|
// hash_key
|
||||||
|
(user_id) => user_id.toFixed(0),
|
||||||
|
// key_input_factory
|
||||||
|
() => new lib_plankton.zoo_input.class_input_wrapped<string, int>(
|
||||||
|
new lib_plankton.zoo_input.class_input_selection(
|
||||||
|
users
|
||||||
|
.map(
|
||||||
|
(user) => ({
|
||||||
|
"value": user.id.toFixed(0),
|
||||||
|
"label": user.name,
|
||||||
|
})
|
||||||
|
)
|
||||||
|
),
|
||||||
|
x => parseInt(x),
|
||||||
|
x => x.toFixed(0)
|
||||||
|
),
|
||||||
|
// value_input_factory
|
||||||
|
() => input_access_level()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,10 +54,12 @@ namespace _zeitbild.frontend_web
|
||||||
{"name": "calendar_add", "parameters": {}},
|
{"name": "calendar_add", "parameters": {}},
|
||||||
{"label": lib_plankton.translate.get("page.calendar_add.title")}
|
{"label": lib_plankton.translate.get("page.calendar_add.title")}
|
||||||
);
|
);
|
||||||
|
/*
|
||||||
lib_plankton.zoo_page.add_nav_entry(
|
lib_plankton.zoo_page.add_nav_entry(
|
||||||
{"name": "event_add", "parameters": {}},
|
{"name": "event_add", "parameters": {}},
|
||||||
{"label": lib_plankton.translate.get("page.event_add.title")}
|
{"label": lib_plankton.translate.get("page.event_add.title")}
|
||||||
);
|
);
|
||||||
|
*/
|
||||||
lib_plankton.zoo_page.add_nav_entry(
|
lib_plankton.zoo_page.add_nav_entry(
|
||||||
{"name": "logout", "parameters": {}},
|
{"name": "logout", "parameters": {}},
|
||||||
{"label": lib_plankton.translate.get("page.logout.title")}
|
{"label": lib_plankton.translate.get("page.logout.title")}
|
||||||
|
|
|
@ -17,46 +17,37 @@ namespace _zeitbild.frontend_web.pages
|
||||||
_zeitbild.frontend_web.type.calendar_object,
|
_zeitbild.frontend_web.type.calendar_object,
|
||||||
{
|
{
|
||||||
name : string;
|
name : string;
|
||||||
access_default_level : string;
|
access : {
|
||||||
|
default_level : _zeitbild.frontend_web.type.enum_access_level;
|
||||||
|
attributed : lib_plankton.map.type_map<
|
||||||
|
_zeitbild.frontend_web.type.user_id,
|
||||||
|
_zeitbild.frontend_web.type.enum_access_level
|
||||||
|
>;
|
||||||
|
};
|
||||||
resource_kind : string;
|
resource_kind : string;
|
||||||
}
|
}
|
||||||
> = new lib_plankton.zoo_form.class_form<
|
> = new lib_plankton.zoo_form.class_form<
|
||||||
_zeitbild.frontend_web.type.calendar_object,
|
_zeitbild.frontend_web.type.calendar_object,
|
||||||
{
|
{
|
||||||
name : string;
|
name : string;
|
||||||
access_default_level : string;
|
access : {
|
||||||
|
default_level : _zeitbild.frontend_web.type.enum_access_level;
|
||||||
|
attributed : lib_plankton.map.type_map<
|
||||||
|
_zeitbild.frontend_web.type.user_id,
|
||||||
|
_zeitbild.frontend_web.type.enum_access_level
|
||||||
|
>;
|
||||||
|
};
|
||||||
resource_kind : string;
|
resource_kind : string;
|
||||||
}
|
}
|
||||||
>(
|
>(
|
||||||
(calendar_object) => ({
|
(calendar_object) => ({
|
||||||
"name": calendar_object.name,
|
"name": calendar_object.name,
|
||||||
"access_default_level": (() => {
|
"access": calendar_object.access,
|
||||||
switch (calendar_object.access.default_level) {
|
|
||||||
case _zeitbild.frontend_web.type.enum_access_level.none: return "none";
|
|
||||||
case _zeitbild.frontend_web.type.enum_access_level.view: return "view";
|
|
||||||
case _zeitbild.frontend_web.type.enum_access_level.edit: return "edit";
|
|
||||||
case _zeitbild.frontend_web.type.enum_access_level.admin: return "admin";
|
|
||||||
}
|
|
||||||
}) (),
|
|
||||||
"resource_kind": calendar_object.resource.kind,
|
"resource_kind": calendar_object.resource.kind,
|
||||||
}),
|
}),
|
||||||
(raw) => ({
|
(raw) => ({
|
||||||
"name": raw.name,
|
"name": raw.name,
|
||||||
"access": {
|
"access": raw.access,
|
||||||
"default_level": (() => {
|
|
||||||
switch (raw.access_default_level) {
|
|
||||||
case "none": return _zeitbild.frontend_web.type.enum_access_level.none;
|
|
||||||
case "view": return _zeitbild.frontend_web.type.enum_access_level.view;
|
|
||||||
case "edit": return _zeitbild.frontend_web.type.enum_access_level.edit;
|
|
||||||
case "admin": return _zeitbild.frontend_web.type.enum_access_level.admin;
|
|
||||||
}
|
|
||||||
}) (),
|
|
||||||
"attributed": lib_plankton.map.hashmap.implementation_map(
|
|
||||||
lib_plankton.map.hashmap.make(
|
|
||||||
x => x.toFixed(0)
|
|
||||||
)
|
|
||||||
),
|
|
||||||
},
|
|
||||||
"resource": (() => {
|
"resource": (() => {
|
||||||
switch (raw.resource_kind) {
|
switch (raw.resource_kind) {
|
||||||
case "local": {
|
case "local": {
|
||||||
|
@ -93,34 +84,22 @@ namespace _zeitbild.frontend_web.pages
|
||||||
"label": lib_plankton.translate.get("calendar.name")
|
"label": lib_plankton.translate.get("calendar.name")
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "access_default_level",
|
"name": "access",
|
||||||
"input": new lib_plankton.zoo_input.class_input_selection(
|
"input": new lib_plankton.zoo_input.class_input_group(
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"value": "none",
|
"name": "default_level",
|
||||||
"label": lib_plankton.translate.get("access_level.none"),
|
"input": _zeitbild.frontend_web.helpers.input_access_level(),
|
||||||
|
"label": lib_plankton.translate.get("calendar.access.default_level"),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"value": "view",
|
"name": "attributed",
|
||||||
"label": lib_plankton.translate.get("access_level.view")
|
"input": await _zeitbild.frontend_web.helpers.input_attributed_access(),
|
||||||
},
|
"label": lib_plankton.translate.get("calendar.access.attributed"),
|
||||||
{
|
|
||||||
"value": "edit",
|
|
||||||
"label": lib_plankton.translate.get("access_level.edit")
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"value": "admin",
|
|
||||||
"label": lib_plankton.translate.get("access_level.admin")
|
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
),
|
),
|
||||||
"label": lib_plankton.string.coin(
|
"label": lib_plankton.translate.get("calendar.access.access"),
|
||||||
"{{default_level}}",
|
|
||||||
{
|
|
||||||
"head": lib_plankton.translate.get("calendar.access.access"),
|
|
||||||
"default_level": lib_plankton.translate.get("calendar.access.default_level"),
|
|
||||||
}
|
|
||||||
)
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "resource_kind",
|
"name": "resource_kind",
|
||||||
|
|
163
source/pages/calendar_edit/logic.ts
Normal file
163
source/pages/calendar_edit/logic.ts
Normal file
|
@ -0,0 +1,163 @@
|
||||||
|
namespace _zeitbild.frontend_web.pages
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
lib_plankton.zoo_page.register(
|
||||||
|
"calendar_edit",
|
||||||
|
async (parameters, target_element) => {
|
||||||
|
const read_only : boolean = ((parameters["read_only"] ?? "yes") === "yes");
|
||||||
|
const calendar_id : int = parseInt(parameters["calendar_id"]);
|
||||||
|
target_element.innerHTML = "";
|
||||||
|
target_element.innerHTML = await _zeitbild.frontend_web.helpers.template_coin(
|
||||||
|
"calendar_edit",
|
||||||
|
{
|
||||||
|
"label": lib_plankton.translate.get("page.calendar_edit.title.regular")
|
||||||
|
}
|
||||||
|
);
|
||||||
|
const form : lib_plankton.zoo_form.class_form<
|
||||||
|
_zeitbild.frontend_web.type.calendar_object,
|
||||||
|
{
|
||||||
|
name : string;
|
||||||
|
access : {
|
||||||
|
default_level : _zeitbild.frontend_web.type.enum_access_level;
|
||||||
|
attributed : lib_plankton.map.type_map<
|
||||||
|
_zeitbild.frontend_web.type.user_id,
|
||||||
|
_zeitbild.frontend_web.type.enum_access_level
|
||||||
|
>;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
> = new lib_plankton.zoo_form.class_form<
|
||||||
|
_zeitbild.frontend_web.type.calendar_object,
|
||||||
|
{
|
||||||
|
name : string;
|
||||||
|
access : {
|
||||||
|
default_level : _zeitbild.frontend_web.type.enum_access_level;
|
||||||
|
attributed : lib_plankton.map.type_map<
|
||||||
|
_zeitbild.frontend_web.type.user_id,
|
||||||
|
_zeitbild.frontend_web.type.enum_access_level
|
||||||
|
>;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
>(
|
||||||
|
(calendar_object) => ({
|
||||||
|
"name": calendar_object.name,
|
||||||
|
"access": calendar_object.access,
|
||||||
|
}),
|
||||||
|
(raw) => ({
|
||||||
|
"name": raw.name,
|
||||||
|
"access": raw.access,
|
||||||
|
"resource": {
|
||||||
|
"kind": "local",
|
||||||
|
"data": {
|
||||||
|
"events": [],
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
new lib_plankton.zoo_input.class_input_group<any>(
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"name": "name",
|
||||||
|
"input": new lib_plankton.zoo_input.class_input_text(),
|
||||||
|
"label": lib_plankton.translate.get("calendar.name")
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "access",
|
||||||
|
"input": new lib_plankton.zoo_input.class_input_group(
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"name": "default_level",
|
||||||
|
"input": _zeitbild.frontend_web.helpers.input_access_level(),
|
||||||
|
"label": lib_plankton.translate.get("calendar.access.default_level"),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "attributed",
|
||||||
|
"input": await _zeitbild.frontend_web.helpers.input_attributed_access(),
|
||||||
|
"label": lib_plankton.translate.get("calendar.access.attributed"),
|
||||||
|
},
|
||||||
|
]
|
||||||
|
),
|
||||||
|
"label": lib_plankton.translate.get("calendar.access.access"),
|
||||||
|
},
|
||||||
|
]
|
||||||
|
),
|
||||||
|
(
|
||||||
|
read_only
|
||||||
|
?
|
||||||
|
[
|
||||||
|
]
|
||||||
|
:
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"label": lib_plankton.translate.get("page.calendar_edit.actions.change"),
|
||||||
|
"target": "submit",
|
||||||
|
"procedure": async (get_value, get_representation) => {
|
||||||
|
const value : any = await get_value();
|
||||||
|
try {
|
||||||
|
await _zeitbild.frontend_web.backend.calendar_change(
|
||||||
|
calendar_id,
|
||||||
|
value
|
||||||
|
);
|
||||||
|
lib_plankton.zoo_page.set(
|
||||||
|
{
|
||||||
|
"name": "events",
|
||||||
|
"parameters": {}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
// do nothing
|
||||||
|
/*
|
||||||
|
lib_plankton.zoo_page.set(
|
||||||
|
{
|
||||||
|
"name": "event_add",
|
||||||
|
"parameters": {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": lib_plankton.translate.get("page.calendar_edit.actions.remove"),
|
||||||
|
"target": "submit",
|
||||||
|
"procedure": async (get_value, get_representation) => {
|
||||||
|
try {
|
||||||
|
await _zeitbild.frontend_web.backend.calendar_remove(
|
||||||
|
calendar_id
|
||||||
|
);
|
||||||
|
lib_plankton.zoo_page.set(
|
||||||
|
{
|
||||||
|
"name": "events",
|
||||||
|
"parameters": {}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
// do nothing
|
||||||
|
/*
|
||||||
|
lib_plankton.zoo_page.set(
|
||||||
|
{
|
||||||
|
"name": "event_add",
|
||||||
|
"parameters": {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
]
|
||||||
|
)
|
||||||
|
);
|
||||||
|
await form.setup(document.querySelector("#calendar_edit_form"));
|
||||||
|
const calendar_object : _zeitbild.frontend_web.type.calendar_object = await _zeitbild.frontend_web.backend.calendar_get(
|
||||||
|
calendar_id
|
||||||
|
);
|
||||||
|
await form.input_write(calendar_object);
|
||||||
|
return Promise.resolve<void>(undefined);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
1
source/pages/calendar_edit/structure.html.tpl
Normal file
1
source/pages/calendar_edit/structure.html.tpl
Normal file
|
@ -0,0 +1 @@
|
||||||
|
|
|
@ -31,6 +31,30 @@ namespace _zeitbild.frontend_web.pages
|
||||||
"timezone_shift": /*conf.timezone_shift*/0,
|
"timezone_shift": /*conf.timezone_shift*/0,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
// sources
|
||||||
|
{
|
||||||
|
target_element.querySelectorAll(".tableview-sources-entry").forEach(
|
||||||
|
(element) => {
|
||||||
|
element.addEventListener(
|
||||||
|
"click",
|
||||||
|
(event) => {
|
||||||
|
const calendar_id : _zeitbild.frontend_web.type.calendar_id = parseInt(element.getAttribute("rel"));
|
||||||
|
lib_plankton.zoo_page.set(
|
||||||
|
{
|
||||||
|
"name": "calendar_edit",
|
||||||
|
"parameters": {
|
||||||
|
"read_only": false, // TODO
|
||||||
|
"calendar_id": calendar_id,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
// cells
|
||||||
|
{
|
||||||
target_element.querySelectorAll(".calendar-cell-regular").forEach(
|
target_element.querySelectorAll(".calendar-cell-regular").forEach(
|
||||||
(element) => {
|
(element) => {
|
||||||
element.addEventListener(
|
element.addEventListener(
|
||||||
|
@ -61,6 +85,9 @@ namespace _zeitbild.frontend_web.pages
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
// events
|
||||||
|
{
|
||||||
target_element.querySelectorAll(".calendar-event_entry").forEach(
|
target_element.querySelectorAll(".calendar-event_entry").forEach(
|
||||||
(element) => {
|
(element) => {
|
||||||
element.addEventListener(
|
element.addEventListener(
|
||||||
|
@ -122,6 +149,7 @@ namespace _zeitbild.frontend_web.pages
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
target_element.innerHTML = "";
|
target_element.innerHTML = "";
|
||||||
|
|
5
source/templates/calendar_edit.html.tpl
Normal file
5
source/templates/calendar_edit.html.tpl
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<div id="calendar_edit">
|
||||||
|
<h2>{{label}}</h2>
|
||||||
|
<div id="calendar_edit_form">
|
||||||
|
</div>
|
||||||
|
</div>
|
|
@ -10,7 +10,7 @@
|
||||||
</label>
|
</label>
|
||||||
<label id="events_control_count">
|
<label id="events_control_count">
|
||||||
<span>{{label_control_count}}</span>
|
<span>{{label_control_count}}</span>
|
||||||
<input type="count"/>
|
<input type="number"/>
|
||||||
</label>
|
</label>
|
||||||
<input type="submit" id="events_control_apply" value="{{label_control_apply}}"/>
|
<input type="submit" id="events_control_apply" value="{{label_control_apply}}"/>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Add table
Reference in a new issue