commit 9880ac3
default
·
2023-11-23 21:31:19 +0000 UTC
parent 8b4ae8b
Use html_note() for the reply form.
1 files changed,
+14,
-44
M
html.c
M
html.c
+14,
-44
1@@ -1119,51 +1119,21 @@ xs_str *html_entry_controls(snac *snac, xs_str *os, const xs_dict *msg, const ch
2
3 { /** reply **/
4 /* the post textarea */
5- xs *ct = build_mentions(snac, msg);
6+ xs *ct = build_mentions(snac, msg);
7+ xs *div_id = xs_fmt("%s_reply", md5);
8+ xs *form_id = xs_fmt("%s_reply_form", md5);
9+ xs *redir = xs_fmt("%s_entry", md5);
10+
11+ xs_html *h = xs_html_tag("p",
12+ html_note(snac, L("Reply..."),
13+ div_id, form_id,
14+ "", ct,
15+ NULL, NULL,
16+ xs_dict_get(msg, "sensitive"), xs_dict_get(msg, "summary"),
17+ xs_stock_false, redir,
18+ (char *)id, 0));
19
20- const xs_val *sensitive = xs_dict_get(msg, "sensitive");
21- const char *summary = xs_dict_get(msg, "summary");
22-
23- xs *s1 = xs_fmt(
24- "<p><details><summary>%s</summary>\n"
25- "<p><div class=\"snac-note\" id=\"%s_reply\">\n"
26- "<form autocomplete=\"off\" method=\"post\" action=\"%s/admin/note\" "
27- "enctype=\"multipart/form-data\" id=\"%s_reply_form\">\n"
28- "<textarea class=\"snac-textarea\" name=\"content\" "
29- "rows=\"4\" wrap=\"virtual\" required=\"required\">%s</textarea>\n"
30- "<input type=\"hidden\" name=\"in_reply_to\" value=\"%s\">\n"
31-
32- "<p>%s: <input type=\"checkbox\" name=\"sensitive\" %s> "
33- "<input type=\"text\" name=\"summary\" placeholder=\"%s\" value=\"%s\">\n"
34- "<p>%s: <input type=\"checkbox\" name=\"mentioned_only\">\n"
35-
36- "<details><summary>%s</summary>\n"
37- "<p>%s: <input type=\"file\" name=\"attach\">\n"
38- "<p>%s: <input type=\"text\" name=\"alt_text\">\n"
39- "</details>\n"
40-
41- "<input type=\"hidden\" name=\"redir\" value=\"%s_entry\">\n"
42- "<p><input type=\"submit\" class=\"button\" value=\"%s\">\n"
43- "</form><p></div>\n"
44- "</details><p>"
45- "\n",
46-
47- L("Reply..."),
48- md5,
49- snac->actor, md5,
50- ct,
51- id,
52- L("Sensitive content"),
53- xs_type(sensitive) == XSTYPE_TRUE ? "checked" : "",
54- L("Sensitive content description"),
55- xs_is_null(summary) ? "" : summary,
56- L("Only for mentioned people"),
57- L("Attach..."),
58- L("File"),
59- L("File description"),
60- md5,
61- L("Post")
62- );
63+ xs *s1 = xs_html_render(h);
64
65 s = xs_str_cat(s, s1);
66 }