diff options
| author | 2023-11-21 11:26:45 +0100 | |
|---|---|---|
| committer | 2023-11-21 11:26:45 +0100 | |
| commit | 7236e15e8c9ade3d6950558d593de1d457a76c18 (patch) | |
| tree | 229db4b6f94e8e4397f93d42100b4893b7059b25 | |
| parent | More refactoring of html_people_list(). (diff) | |
| download | snac2-7236e15e8c9ade3d6950558d593de1d457a76c18.tar.gz snac2-7236e15e8c9ade3d6950558d593de1d457a76c18.tar.xz snac2-7236e15e8c9ade3d6950558d593de1d457a76c18.zip | |
More refactoring of html_people_list().
| -rw-r--r-- | html.c | 28 |
1 files changed, 10 insertions, 18 deletions
| @@ -1718,16 +1718,11 @@ xs_str *html_people_list(snac *snac, xs_str *os, xs_list *list, const char *head | |||
| 1718 | xs *actor = NULL; | 1718 | xs *actor = NULL; |
| 1719 | 1719 | ||
| 1720 | if (valid_status(actor_get(actor_id, &actor))) { | 1720 | if (valid_status(actor_get(actor_id, &actor))) { |
| 1721 | s = xs_str_cat(s, "<div class=\"snac-post\">\n"); | 1721 | xs_html *snac_post = xs_html_tag("div", |
| 1722 | 1722 | xs_html_attr("class", "snac-post"), | |
| 1723 | xs_html *snac_post_header = xs_html_tag("div", | 1723 | xs_html_tag("div", |
| 1724 | xs_html_attr("class", "snac-post-header"), | 1724 | xs_html_attr("class", "snac-post-header"), |
| 1725 | html_actor_icon(actor, xs_dict_get(actor, "published"), NULL, NULL, 0)); | 1725 | html_actor_icon(actor, xs_dict_get(actor, "published"), NULL, NULL, 0))); |
| 1726 | |||
| 1727 | { | ||
| 1728 | xs *s1 = xs_html_render(snac_post_header); | ||
| 1729 | s = xs_str_cat(s, s1); | ||
| 1730 | } | ||
| 1731 | 1726 | ||
| 1732 | /* content (user bio) */ | 1727 | /* content (user bio) */ |
| 1733 | char *c = xs_dict_get(actor, "summary"); | 1728 | char *c = xs_dict_get(actor, "summary"); |
| @@ -1746,16 +1741,13 @@ xs_str *html_people_list(snac *snac, xs_str *os, xs_list *list, const char *head | |||
| 1746 | xs_html_tag("p", | 1741 | xs_html_tag("p", |
| 1747 | xs_html_raw(sc))); /* already sanitized */ | 1742 | xs_html_raw(sc))); /* already sanitized */ |
| 1748 | 1743 | ||
| 1749 | { | 1744 | xs_html_add(snac_post, snac_content); |
| 1750 | xs *s1 = xs_html_render(snac_content); | ||
| 1751 | s = xs_str_cat(s, s1); | ||
| 1752 | } | ||
| 1753 | } | 1745 | } |
| 1754 | 1746 | ||
| 1755 | /* buttons */ | 1747 | /* buttons */ |
| 1756 | xs *btn_form_action = xs_fmt("%s/admin/action", snac->actor); | 1748 | xs *btn_form_action = xs_fmt("%s/admin/action", snac->actor); |
| 1757 | 1749 | ||
| 1758 | xs_html *snac_controls = xs_html_tag("DIV", | 1750 | xs_html *snac_controls = xs_html_tag("div", |
| 1759 | xs_html_attr("class", "snac-controls")); | 1751 | xs_html_attr("class", "snac-controls")); |
| 1760 | 1752 | ||
| 1761 | xs_html *form = xs_html_tag("form", | 1753 | xs_html *form = xs_html_tag("form", |
| @@ -1849,12 +1841,12 @@ xs_str *html_people_list(snac *snac, xs_str *os, xs_list *list, const char *head | |||
| 1849 | 1841 | ||
| 1850 | xs_html_add(snac_controls, dm_textarea); | 1842 | xs_html_add(snac_controls, dm_textarea); |
| 1851 | 1843 | ||
| 1844 | xs_html_add(snac_post, snac_controls); | ||
| 1845 | |||
| 1852 | { | 1846 | { |
| 1853 | xs *s1 = xs_html_render(snac_controls); | 1847 | xs *s1 = xs_html_render(snac_post); |
| 1854 | s = xs_str_cat(s, s1); | 1848 | s = xs_str_cat(s, s1); |
| 1855 | } | 1849 | } |
| 1856 | |||
| 1857 | s = xs_str_cat(s, "</div>\n"); | ||
| 1858 | } | 1850 | } |
| 1859 | } | 1851 | } |
| 1860 | 1852 | ||