summaryrefslogtreecommitdiff
path: root/html.c
diff options
context:
space:
mode:
authorGravatar default2023-11-27 21:28:27 +0100
committerGravatar default2023-11-27 21:28:27 +0100
commit2111886448db2e5685c95156f9045916e33e9400 (patch)
treecb685271fe4d233640c50a0ef4bec539d57894ee /html.c
parentMinor html_entry() tweaks. (diff)
downloadsnac2-2111886448db2e5685c95156f9045916e33e9400.tar.gz
snac2-2111886448db2e5685c95156f9045916e33e9400.tar.xz
snac2-2111886448db2e5685c95156f9045916e33e9400.zip
Some html_entry() refactoring.
Diffstat (limited to 'html.c')
-rw-r--r--html.c32
1 files changed, 22 insertions, 10 deletions
diff --git a/html.c b/html.c
index 3fbf545..d6b14a4 100644
--- a/html.c
+++ b/html.c
@@ -1298,23 +1298,32 @@ xs_str *html_entry(snac *user, xs_str *os, const xs_dict *msg, int local,
1298 else 1298 else
1299 s = xs_str_cat(s, "<div class=\"snac-child\">\n"); /** **/ 1299 s = xs_str_cat(s, "<div class=\"snac-child\">\n"); /** **/
1300 1300
1301 s = xs_str_cat(s, "<div class=\"snac-post-header\">\n<div class=\"snac-score\">"); /** **/ 1301 s = xs_str_cat(s, "<div class=\"snac-post-header\">\n"); /** **/
1302
1303 xs_html *score = xs_html_tag("div",
1304 xs_html_attr("class", "snac-score"));
1302 1305
1303 if (user && is_pinned(user, id)) { 1306 if (user && is_pinned(user, id)) {
1304 /* add a pin emoji */ 1307 /* add a pin emoji */
1305 xs *f = xs_fmt("<span title=\"%s\"> &#128204; </span>", L("Pinned")); 1308 xs_html_add(score,
1306 s = xs_str_cat(s, f); 1309 xs_html_tag("span",
1310 xs_html_attr("title", L("Pinned")),
1311 xs_html_raw(" &#128204; ")));
1307 } 1312 }
1308 1313
1309 if (strcmp(type, "Question") == 0) { 1314 if (strcmp(type, "Question") == 0) {
1310 /* add the ballot box emoji */ 1315 /* add the ballot box emoji */
1311 xs *f = xs_fmt("<span title=\"%s\"> &#128499; </span>", L("Poll")); 1316 xs_html_add(score,
1312 s = xs_str_cat(s, f); 1317 xs_html_tag("span",
1318 xs_html_attr("title", L("Poll")),
1319 xs_html_raw(" &#128499; ")));
1313 1320
1314 if (user && was_question_voted(user, id)) { 1321 if (user && was_question_voted(user, id)) {
1315 /* add a check to show this poll was voted */ 1322 /* add a check to show this poll was voted */
1316 xs *f2 = xs_fmt("<span title=\"%s\"> &#10003; </span>", L("Voted")); 1323 xs_html_add(score,
1317 s = xs_str_cat(s, f2); 1324 xs_html_tag("span",
1325 xs_html_attr("title", L("Voted")),
1326 xs_html_raw(" &#10003; ")));
1318 } 1327 }
1319 } 1328 }
1320 1329
@@ -1324,13 +1333,16 @@ xs_str *html_entry(snac *user, xs_str *os, const xs_dict *msg, int local,
1324 int n_boosts = object_announces_len(id); 1333 int n_boosts = object_announces_len(id);
1325 1334
1326 /* alternate emojis: %d &#128077; %d &#128257; */ 1335 /* alternate emojis: %d &#128077; %d &#128257; */
1327
1328 xs *s1 = xs_fmt("%d &#9733; %d &#8634;\n", n_likes, n_boosts); 1336 xs *s1 = xs_fmt("%d &#9733; %d &#8634;\n", n_likes, n_boosts);
1329 1337
1330 s = xs_str_cat(s, s1); 1338 xs_html_add(score,
1339 xs_html_raw(s1));
1331 } 1340 }
1332 1341
1333 s = xs_str_cat(s, "</div>\n"); 1342 {
1343 xs *s1 = xs_html_render(score);
1344 s = xs_str_cat(s, s1);
1345 }
1334 1346
1335 if (boosts == NULL) 1347 if (boosts == NULL)
1336 boosts = object_announces(id); 1348 boosts = object_announces(id);