commit 7236e15
default
·
2023-11-21 10:26:45 +0000 UTC
parent f3ad5f0
More refactoring of html_people_list().
1 files changed,
+10,
-18
M
html.c
M
html.c
+10,
-18
1@@ -1718,16 +1718,11 @@ xs_str *html_people_list(snac *snac, xs_str *os, xs_list *list, const char *head
2 xs *actor = NULL;
3
4 if (valid_status(actor_get(actor_id, &actor))) {
5- s = xs_str_cat(s, "<div class=\"snac-post\">\n");
6-
7- xs_html *snac_post_header = xs_html_tag("div",
8- xs_html_attr("class", "snac-post-header"),
9- html_actor_icon(actor, xs_dict_get(actor, "published"), NULL, NULL, 0));
10-
11- {
12- xs *s1 = xs_html_render(snac_post_header);
13- s = xs_str_cat(s, s1);
14- }
15+ xs_html *snac_post = xs_html_tag("div",
16+ xs_html_attr("class", "snac-post"),
17+ xs_html_tag("div",
18+ xs_html_attr("class", "snac-post-header"),
19+ html_actor_icon(actor, xs_dict_get(actor, "published"), NULL, NULL, 0)));
20
21 /* content (user bio) */
22 char *c = xs_dict_get(actor, "summary");
23@@ -1746,16 +1741,13 @@ xs_str *html_people_list(snac *snac, xs_str *os, xs_list *list, const char *head
24 xs_html_tag("p",
25 xs_html_raw(sc))); /* already sanitized */
26
27- {
28- xs *s1 = xs_html_render(snac_content);
29- s = xs_str_cat(s, s1);
30- }
31+ xs_html_add(snac_post, snac_content);
32 }
33
34 /* buttons */
35 xs *btn_form_action = xs_fmt("%s/admin/action", snac->actor);
36
37- xs_html *snac_controls = xs_html_tag("DIV",
38+ xs_html *snac_controls = xs_html_tag("div",
39 xs_html_attr("class", "snac-controls"));
40
41 xs_html *form = xs_html_tag("form",
42@@ -1849,12 +1841,12 @@ xs_str *html_people_list(snac *snac, xs_str *os, xs_list *list, const char *head
43
44 xs_html_add(snac_controls, dm_textarea);
45
46+ xs_html_add(snac_post, snac_controls);
47+
48 {
49- xs *s1 = xs_html_render(snac_controls);
50+ xs *s1 = xs_html_render(snac_post);
51 s = xs_str_cat(s, s1);
52 }
53-
54- s = xs_str_cat(s, "</div>\n");
55 }
56 }
57