Mercurial > libervia-web
annotate libervia/pages/blog/edit/page_meta.py @ 1466:cff720e26089
pages (blog/view): activate pagination when a single item is shown:
`previous_page_url` and `next_page_url` are set when `item_id` is used. For now, they are
both activated even if there is no item before or after, as it would request to make extra
request to check it. This may be improved in 0.9 by using internal cache.
fix 399
author | Goffi <goffi@goffi.org> |
---|---|
date | Thu, 30 Sep 2021 17:04:22 +0200 |
parents | 925a7c498cda |
children | 081b4f8a63d8 |
rev | line source |
---|---|
1416 | 1 #!/usr/bin/env python3 |
2 | |
3 from libervia.server.constants import Const as C | |
4 from sat.core.log import getLogger | |
5 from sat.tools.common import data_format | |
6 | |
7 log = getLogger(__name__) | |
8 | |
9 name = "blog_edit" | |
10 access = C.PAGES_ACCESS_PROFILE | |
11 template = "blog/publish.html" | |
12 | |
13 | |
14 async def on_data_post(self, request): | |
15 profile = self.getProfile(request) | |
16 if profile is None: | |
17 self.pageError(request, C.HTTP_FORBIDDEN) | |
18 request_data = self.getRData(request) | |
19 title, tags, body = self.getPostedData(request, ('title', 'tags', 'body')) | |
20 mb_data = {"content_rich": body} | |
21 title = title.strip() | |
22 if title: | |
23 mb_data["title_rich"] = title | |
24 tags = [t.strip() for t in tags.split(',') if t.strip()] | |
25 if tags: | |
26 mb_data["tags"] = tags | |
27 | |
28 await self.host.bridgeCall( | |
29 'mbSend', | |
30 "", | |
31 "", | |
32 data_format.serialise(mb_data), | |
33 profile | |
34 ) | |
1420
925a7c498cda
pages (blog/edit): move preview code to new `BlogEditor` class in `editor` module
Goffi <goffi@goffi.org>
parents:
1416
diff
changeset
|
35 |
925a7c498cda
pages (blog/edit): move preview code to new `BlogEditor` class in `editor` module
Goffi <goffi@goffi.org>
parents:
1416
diff
changeset
|
36 request_data["post_redirect_page"] = self.getPageByName("blog") |