File tree 2 files changed +16
-1
lines changed
2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change 6
6
7
7
# @rx.page(route='/about')
8
8
def blog_post_detail_page () -> rx .Component :
9
+ can_edit = True
10
+ edit_link = rx .link ("Edit" , href = f"/blog/{ state .BlogPostState .blog_post_id } /edit" )
11
+ edit_link_el = rx .cond (
12
+ can_edit ,
13
+ edit_link ,
14
+ rx .fragment ("" )
15
+ )
9
16
my_child = rx .vstack (
10
- rx .heading (state .BlogPostState .post .title , size = "9" ),
17
+ rx .hstack (
18
+ rx .heading (state .BlogPostState .post .title , size = "9" ),
19
+ edit_link_el ,
20
+ align = 'end'
21
+ ),
11
22
rx .text (
12
23
state .BlogPostState .post .content ,
24
+ white_space = 'pre-wrap'
13
25
),
14
26
spacing = "5" ,
15
27
align = "center" ,
Original file line number Diff line number Diff line change @@ -25,6 +25,9 @@ def get_post_detail(self):
25
25
)
26
26
).one_or_none ()
27
27
self .post = result
28
+ if result is None :
29
+ self .post_content = ""
30
+ return
28
31
self .post_content = self .post .content
29
32
# return
30
33
You can’t perform that action at this time.
0 commit comments