The post edit box also uses html_note().

This commit is contained in:
default 2023-11-23 22:55:20 +01:00
parent 9880ac3c09
commit 073140eced

58
html.c
View file

@ -1065,54 +1065,24 @@ xs_str *html_entry_controls(snac *snac, xs_str *os, const xs_dict *msg, const ch
s = xs_str_cat(s, "</form>\n"); s = xs_str_cat(s, "</form>\n");
const char *prev_src1 = xs_dict_get(msg, "sourceContent"); char *prev_src = xs_dict_get(msg, "sourceContent");
if (!xs_is_null(prev_src1) && strcmp(actor, snac->actor) == 0) { /** edit **/
xs *prev_src = encode_html(prev_src1);
const xs_val *sensitive = xs_dict_get(msg, "sensitive");
const char *summary = xs_dict_get(msg, "summary");
if (!xs_is_null(prev_src) && strcmp(actor, snac->actor) == 0) { /** edit **/
/* post can be edited */ /* post can be edited */
xs *s1 = xs_fmt( xs *div_id = xs_fmt("%s_edit", md5);
"<p><details><summary>%s</summary>\n" xs *form_id = xs_fmt("%s_edit_form", md5);
"<p><div class=\"snac-note\" id=\"%s_edit\">\n" xs *redir = xs_fmt("%s_entry", md5);
"<form autocomplete=\"off\" method=\"post\" action=\"%s/admin/note\" "
"enctype=\"multipart/form-data\" id=\"%s_edit_form\">\n"
"<textarea class=\"snac-textarea\" name=\"content\" "
"rows=\"4\" wrap=\"virtual\" required=\"required\">%s</textarea>\n"
"<input type=\"hidden\" name=\"edit_id\" value=\"%s\">\n"
"<p>%s: <input type=\"checkbox\" name=\"sensitive\" %s> " xs_html *h = xs_html_tag("p",
"<input type=\"text\" name=\"summary\" placeholder=\"%s\" value=\"%s\">\n" html_note(snac, L("Edit..."),
"<p>%s: <input type=\"checkbox\" name=\"mentioned_only\">\n" div_id, form_id,
"", prev_src,
(char *)id, NULL,
xs_dict_get(msg, "sensitive"), xs_dict_get(msg, "summary"),
xs_stock_false, redir,
NULL, 0));
"<details><summary>%s</summary>\n" xs *s1 = xs_html_render(h);
"<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("Edit..."),
md5,
snac->actor, md5,
prev_src,
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")
);
s = xs_str_cat(s, s1); s = xs_str_cat(s, s1);
} }