summaryrefslogtreecommitdiff
path: root/html.c
diff options
context:
space:
mode:
authordefault <nobody@localhost>2023-11-23 22:31:19 +0100
committerdefault <nobody@localhost>2023-11-23 22:31:19 +0100
commit9880ac3c09e9bc0e93175578d1f991a4ee376086 (patch)
treebd5c64dcc3541d9f0194d30d6b5ffd0331a1fc8a /html.c
parent8b4ae8b1a08a758eae5f4487d5a9207d422f4e5b (diff)
Use html_note() for the reply form.
Diffstat (limited to 'html.c')
-rw-r--r--html.c58
1 files changed, 14 insertions, 44 deletions
diff --git a/html.c b/html.c
index a8c0bdf..a923771 100644
--- a/html.c
+++ b/html.c
@@ -1119,51 +1119,21 @@ xs_str *html_entry_controls(snac *snac, xs_str *os, const xs_dict *msg, const ch
{ /** reply **/
/* the post textarea */
- xs *ct = build_mentions(snac, msg);
+ xs *ct = build_mentions(snac, msg);
+ xs *div_id = xs_fmt("%s_reply", md5);
+ xs *form_id = xs_fmt("%s_reply_form", md5);
+ xs *redir = xs_fmt("%s_entry", md5);
+
+ xs_html *h = xs_html_tag("p",
+ html_note(snac, L("Reply..."),
+ div_id, form_id,
+ "", ct,
+ NULL, NULL,
+ xs_dict_get(msg, "sensitive"), xs_dict_get(msg, "summary"),
+ xs_stock_false, redir,
+ (char *)id, 0));
- const xs_val *sensitive = xs_dict_get(msg, "sensitive");
- const char *summary = xs_dict_get(msg, "summary");
-
- xs *s1 = xs_fmt(
- "<p><details><summary>%s</summary>\n"
- "<p><div class=\"snac-note\" id=\"%s_reply\">\n"
- "<form autocomplete=\"off\" method=\"post\" action=\"%s/admin/note\" "
- "enctype=\"multipart/form-data\" id=\"%s_reply_form\">\n"
- "<textarea class=\"snac-textarea\" name=\"content\" "
- "rows=\"4\" wrap=\"virtual\" required=\"required\">%s</textarea>\n"
- "<input type=\"hidden\" name=\"in_reply_to\" value=\"%s\">\n"
-
- "<p>%s: <input type=\"checkbox\" name=\"sensitive\" %s> "
- "<input type=\"text\" name=\"summary\" placeholder=\"%s\" value=\"%s\">\n"
- "<p>%s: <input type=\"checkbox\" name=\"mentioned_only\">\n"
-
- "<details><summary>%s</summary>\n"
- "<p>%s: <input type=\"file\" name=\"attach\">\n"
- "<p>%s: <input type=\"text\" name=\"alt_text\">\n"
- "</details>\n"
-
- "<input type=\"hidden\" name=\"redir\" value=\"%s_entry\">\n"
- "<p><input type=\"submit\" class=\"button\" value=\"%s\">\n"
- "</form><p></div>\n"
- "</details><p>"
- "\n",
-
- L("Reply..."),
- md5,
- snac->actor, md5,
- ct,
- id,
- L("Sensitive content"),
- xs_type(sensitive) == XSTYPE_TRUE ? "checked" : "",
- L("Sensitive content description"),
- xs_is_null(summary) ? "" : summary,
- L("Only for mentioned people"),
- L("Attach..."),
- L("File"),
- L("File description"),
- md5,
- L("Post")
- );
+ xs *s1 = xs_html_render(h);
s = xs_str_cat(s, s1);
}