commit 9ea3876
default
·
2023-11-26 19:27:57 +0000 UTC
parent 3f94080
html_top_controls() is fully xs_html.
1 files changed,
+25,
-30
M
html.c
M
html.c
+25,
-30
1@@ -709,27 +709,25 @@ xs_str *html_user_header(snac *snac, xs_str *s, int local)
2 }
3
4
5-xs_str *html_top_controls(snac *snac, xs_str *s)
6+xs_html *html_top_controls(snac *snac)
7 /* generates the top controls */
8 {
9- xs_str_cat(s, "<div class=\"snac-top-controls\">\n");
10+ xs *ops_action = xs_fmt("%s/admin/action", snac->actor);
11
12- xs_html *new_note = html_note(snac, L("New Post..."),
13- "new_post_div", "new_post_form",
14- L("What's on your mind?"), "",
15- NULL, NULL,
16- xs_stock_false, "",
17- xs_stock_false, NULL,
18- NULL, 1);
19+ xs_html *top_controls = xs_html_tag("div",
20+ xs_html_attr("class", "snac-top-controls"),
21
22- xs *s1 = xs_html_render(new_note);
23+ /** new post **/
24+ html_note(snac, L("New Post..."),
25+ "new_post_div", "new_post_form",
26+ L("What's on your mind?"), "",
27+ NULL, NULL,
28+ xs_stock_false, "",
29+ xs_stock_false, NULL,
30+ NULL, 1),
31
32- xs *s2 = NULL;
33-
34- /** operations form **/
35- {
36- xs *ops_action = xs_fmt("%s/admin/action", snac->actor);
37- xs_html *ops = xs_html_tag("details",
38+ /** operations **/
39+ xs_html_tag("details",
40 xs_html_tag("summary",
41 xs_html_text(L("Operations..."))),
42 xs_html_tag("p", NULL),
43@@ -762,12 +760,9 @@ xs_str *html_top_controls(snac *snac, xs_str *s)
44 xs_html_attr("name", "action"),
45 xs_html_attr("value", L("Boost"))),
46 xs_html_text(L("(by URL)"))),
47- xs_html_tag("p", NULL));
48+ xs_html_tag("p", NULL)));
49
50- s2 = xs_html_render(ops);
51- }
52-
53- /** user settings form **/
54+ /** user settings **/
55
56 char *email = "[disabled by admin]";
57
58@@ -818,7 +813,8 @@ xs_str *html_top_controls(snac *snac, xs_str *s)
59
60 xs *user_setup_action = xs_fmt("%s/admin/user-setup", snac->actor);
61
62- xs_html *user_settings = xs_html_tag("details",
63+ xs_html_add(top_controls,
64+ xs_html_tag("details",
65 xs_html_tag("summary",
66 xs_html_text(L("User Settings..."))),
67 xs_html_tag("div",
68@@ -946,13 +942,9 @@ xs_str *html_top_controls(snac *snac, xs_str *s)
69 xs_html_tag("input",
70 xs_html_attr("type", "submit"),
71 xs_html_attr("class", "button"),
72- xs_html_attr("value", L("Update user info"))))));
73+ xs_html_attr("value", L("Update user info")))))));
74
75- xs *s3 = xs_html_render(user_settings);
76-
77- s = xs_str_cat(s, s1, s2, s3, "</div><!-- snac-top-controls -->\n");
78-
79- return s;
80+ return top_controls;
81 }
82
83
84@@ -1717,8 +1709,11 @@ xs_str *html_timeline(snac *user, const xs_list *list, int local,
85 else
86 s = html_instance_header(s, tag);
87
88- if (user && !local)
89- s = html_top_controls(user, s);
90+ if (user && !local) {
91+ xs_html *h = html_top_controls(user);
92+ xs *s1 = xs_html_render(h);
93+ s = xs_str_cat(s, s1);
94+ }
95
96 s = xs_str_cat(s, "<a name=\"snac-posts\"></a>\n");
97 s = xs_str_cat(s, "<div class=\"snac-posts\">\n");