Mercurial > libervia-web
annotate libervia/web/pages/lists/create/page_meta.py @ 1595:7941444c1671
pages: set `own_local_jid` to avoid confusion with `own_jid`:
- `own_jid` is the real JID of the user.
- `own_local_jid` is the JID used in chat, which can be real JID, or a room JID.
author | Goffi <goffi@goffi.org> |
---|---|
date | Wed, 13 Dec 2023 22:05:48 +0100 |
parents | eb00d593801d |
children |
rev | line source |
---|---|
1378
e3e303a30a74
pages (tickets): renamed "tickets" to "lists":
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
1 #!/usr/bin/env python3 |
e3e303a30a74
pages (tickets): renamed "tickets" to "lists":
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
2 |
1518
eb00d593801d
refactoring: rename `libervia` to `libervia.web` + update imports following backend changes
Goffi <goffi@goffi.org>
parents:
1509
diff
changeset
|
3 from libervia.web.server.constants import Const as C |
eb00d593801d
refactoring: rename `libervia` to `libervia.web` + update imports following backend changes
Goffi <goffi@goffi.org>
parents:
1509
diff
changeset
|
4 from libervia.backend.tools.common import data_format |
eb00d593801d
refactoring: rename `libervia` to `libervia.web` + update imports following backend changes
Goffi <goffi@goffi.org>
parents:
1509
diff
changeset
|
5 from libervia.backend.core.log import getLogger |
1378
e3e303a30a74
pages (tickets): renamed "tickets" to "lists":
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
6 |
e3e303a30a74
pages (tickets): renamed "tickets" to "lists":
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
7 log = getLogger(__name__) |
e3e303a30a74
pages (tickets): renamed "tickets" to "lists":
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
8 |
e3e303a30a74
pages (tickets): renamed "tickets" to "lists":
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
9 name = "list_create" |
1387
a84383c659b4
lists: creation, invitation, item deletion:
Goffi <goffi@goffi.org>
parents:
1378
diff
changeset
|
10 access = C.PAGES_ACCESS_PROFILE |
a84383c659b4
lists: creation, invitation, item deletion:
Goffi <goffi@goffi.org>
parents:
1378
diff
changeset
|
11 template = "list/create.html" |
1378
e3e303a30a74
pages (tickets): renamed "tickets" to "lists":
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
12 |
e3e303a30a74
pages (tickets): renamed "tickets" to "lists":
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
13 |
e3e303a30a74
pages (tickets): renamed "tickets" to "lists":
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
14 def parse_url(self, request): |
1509
106bae41f5c8
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
1387
diff
changeset
|
15 self.get_path_args(request, ["template_id"]) |
106bae41f5c8
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
1387
diff
changeset
|
16 data = self.get_r_data(request) |
1387
a84383c659b4
lists: creation, invitation, item deletion:
Goffi <goffi@goffi.org>
parents:
1378
diff
changeset
|
17 if data["template_id"]: |
1509
106bae41f5c8
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
1387
diff
changeset
|
18 self.http_redirect( |
1387
a84383c659b4
lists: creation, invitation, item deletion:
Goffi <goffi@goffi.org>
parents:
1378
diff
changeset
|
19 request, |
1509
106bae41f5c8
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
1387
diff
changeset
|
20 self.get_page_by_name("list_create_from_tpl").get_url(data["template_id"]) |
1387
a84383c659b4
lists: creation, invitation, item deletion:
Goffi <goffi@goffi.org>
parents:
1378
diff
changeset
|
21 ) |
1378
e3e303a30a74
pages (tickets): renamed "tickets" to "lists":
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
22 |
e3e303a30a74
pages (tickets): renamed "tickets" to "lists":
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
23 |
e3e303a30a74
pages (tickets): renamed "tickets" to "lists":
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
24 async def prepare_render(self, request): |
e3e303a30a74
pages (tickets): renamed "tickets" to "lists":
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
25 template_data = request.template_data |
1509
106bae41f5c8
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
1387
diff
changeset
|
26 profile = self.get_profile(request) |
106bae41f5c8
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
1387
diff
changeset
|
27 tpl_raw = await self.host.bridge_call( |
106bae41f5c8
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
1387
diff
changeset
|
28 "list_templates_names_get", |
1378
e3e303a30a74
pages (tickets): renamed "tickets" to "lists":
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
29 "", |
e3e303a30a74
pages (tickets): renamed "tickets" to "lists":
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
30 profile, |
e3e303a30a74
pages (tickets): renamed "tickets" to "lists":
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
31 ) |
1387
a84383c659b4
lists: creation, invitation, item deletion:
Goffi <goffi@goffi.org>
parents:
1378
diff
changeset
|
32 lists_templates = data_format.deserialise(tpl_raw, type_check=list) |
a84383c659b4
lists: creation, invitation, item deletion:
Goffi <goffi@goffi.org>
parents:
1378
diff
changeset
|
33 template_data["icons_names"] = {tpl['icon'] for tpl in lists_templates} |
a84383c659b4
lists: creation, invitation, item deletion:
Goffi <goffi@goffi.org>
parents:
1378
diff
changeset
|
34 template_data["lists_templates"] = [ |
a84383c659b4
lists: creation, invitation, item deletion:
Goffi <goffi@goffi.org>
parents:
1378
diff
changeset
|
35 { |
a84383c659b4
lists: creation, invitation, item deletion:
Goffi <goffi@goffi.org>
parents:
1378
diff
changeset
|
36 "icon": tpl["icon"], |
a84383c659b4
lists: creation, invitation, item deletion:
Goffi <goffi@goffi.org>
parents:
1378
diff
changeset
|
37 "name": tpl["name"], |
1509
106bae41f5c8
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
1387
diff
changeset
|
38 "url": self.get_url(tpl["id"]), |
1387
a84383c659b4
lists: creation, invitation, item deletion:
Goffi <goffi@goffi.org>
parents:
1378
diff
changeset
|
39 } |
a84383c659b4
lists: creation, invitation, item deletion:
Goffi <goffi@goffi.org>
parents:
1378
diff
changeset
|
40 for tpl in lists_templates |
a84383c659b4
lists: creation, invitation, item deletion:
Goffi <goffi@goffi.org>
parents:
1378
diff
changeset
|
41 ] |