diff options
| author | 2023-11-23 22:31:19 +0100 | |
|---|---|---|
| committer | 2023-11-23 22:31:19 +0100 | |
| commit | 9880ac3c09e9bc0e93175578d1f991a4ee376086 (patch) | |
| tree | bd5c64dcc3541d9f0194d30d6b5ffd0331a1fc8a /html.c | |
| parent | html_footer() is pure xs_html. (diff) | |
| download | snac2-9880ac3c09e9bc0e93175578d1f991a4ee376086.tar.gz snac2-9880ac3c09e9bc0e93175578d1f991a4ee376086.tar.xz snac2-9880ac3c09e9bc0e93175578d1f991a4ee376086.zip | |
Use html_note() for the reply form.
Diffstat (limited to 'html.c')
| -rw-r--r-- | html.c | 58 |
1 files changed, 14 insertions, 44 deletions
| @@ -1119,51 +1119,21 @@ xs_str *html_entry_controls(snac *snac, xs_str *os, const xs_dict *msg, const ch | |||
| 1119 | 1119 | ||
| 1120 | { /** reply **/ | 1120 | { /** reply **/ |
| 1121 | /* the post textarea */ | 1121 | /* the post textarea */ |
| 1122 | xs *ct = build_mentions(snac, msg); | 1122 | xs *ct = build_mentions(snac, msg); |
| 1123 | xs *div_id = xs_fmt("%s_reply", md5); | ||
| 1124 | xs *form_id = xs_fmt("%s_reply_form", md5); | ||
| 1125 | xs *redir = xs_fmt("%s_entry", md5); | ||
| 1126 | |||
| 1127 | xs_html *h = xs_html_tag("p", | ||
| 1128 | html_note(snac, L("Reply..."), | ||
| 1129 | div_id, form_id, | ||
| 1130 | "", ct, | ||
| 1131 | NULL, NULL, | ||
| 1132 | xs_dict_get(msg, "sensitive"), xs_dict_get(msg, "summary"), | ||
| 1133 | xs_stock_false, redir, | ||
| 1134 | (char *)id, 0)); | ||
| 1123 | 1135 | ||
| 1124 | const xs_val *sensitive = xs_dict_get(msg, "sensitive"); | 1136 | xs *s1 = xs_html_render(h); |
| 1125 | const char *summary = xs_dict_get(msg, "summary"); | ||
| 1126 | |||
| 1127 | xs *s1 = xs_fmt( | ||
| 1128 | "<p><details><summary>%s</summary>\n" | ||
| 1129 | "<p><div class=\"snac-note\" id=\"%s_reply\">\n" | ||
| 1130 | "<form autocomplete=\"off\" method=\"post\" action=\"%s/admin/note\" " | ||
| 1131 | "enctype=\"multipart/form-data\" id=\"%s_reply_form\">\n" | ||
| 1132 | "<textarea class=\"snac-textarea\" name=\"content\" " | ||
| 1133 | "rows=\"4\" wrap=\"virtual\" required=\"required\">%s</textarea>\n" | ||
| 1134 | "<input type=\"hidden\" name=\"in_reply_to\" value=\"%s\">\n" | ||
| 1135 | |||
| 1136 | "<p>%s: <input type=\"checkbox\" name=\"sensitive\" %s> " | ||
| 1137 | "<input type=\"text\" name=\"summary\" placeholder=\"%s\" value=\"%s\">\n" | ||
| 1138 | "<p>%s: <input type=\"checkbox\" name=\"mentioned_only\">\n" | ||
| 1139 | |||
| 1140 | "<details><summary>%s</summary>\n" | ||
| 1141 | "<p>%s: <input type=\"file\" name=\"attach\">\n" | ||
| 1142 | "<p>%s: <input type=\"text\" name=\"alt_text\">\n" | ||
| 1143 | "</details>\n" | ||
| 1144 | |||
| 1145 | "<input type=\"hidden\" name=\"redir\" value=\"%s_entry\">\n" | ||
| 1146 | "<p><input type=\"submit\" class=\"button\" value=\"%s\">\n" | ||
| 1147 | "</form><p></div>\n" | ||
| 1148 | "</details><p>" | ||
| 1149 | "\n", | ||
| 1150 | |||
| 1151 | L("Reply..."), | ||
| 1152 | md5, | ||
| 1153 | snac->actor, md5, | ||
| 1154 | ct, | ||
| 1155 | id, | ||
| 1156 | L("Sensitive content"), | ||
| 1157 | xs_type(sensitive) == XSTYPE_TRUE ? "checked" : "", | ||
| 1158 | L("Sensitive content description"), | ||
| 1159 | xs_is_null(summary) ? "" : summary, | ||
| 1160 | L("Only for mentioned people"), | ||
| 1161 | L("Attach..."), | ||
| 1162 | L("File"), | ||
| 1163 | L("File description"), | ||
| 1164 | md5, | ||
| 1165 | L("Post") | ||
| 1166 | ); | ||
| 1167 | 1137 | ||
| 1168 | s = xs_str_cat(s, s1); | 1138 | s = xs_str_cat(s, s1); |
| 1169 | } | 1139 | } |