mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-11-25 14:35:04 +00:00
Some html_entry() refactoring.
This commit is contained in:
parent
800bb0123d
commit
2111886448
1 changed files with 22 additions and 10 deletions
32
html.c
32
html.c
|
@ -1298,23 +1298,32 @@ xs_str *html_entry(snac *user, xs_str *os, const xs_dict *msg, int local,
|
|||
else
|
||||
s = xs_str_cat(s, "<div class=\"snac-child\">\n"); /** **/
|
||||
|
||||
s = xs_str_cat(s, "<div class=\"snac-post-header\">\n<div class=\"snac-score\">"); /** **/
|
||||
s = xs_str_cat(s, "<div class=\"snac-post-header\">\n"); /** **/
|
||||
|
||||
xs_html *score = xs_html_tag("div",
|
||||
xs_html_attr("class", "snac-score"));
|
||||
|
||||
if (user && is_pinned(user, id)) {
|
||||
/* add a pin emoji */
|
||||
xs *f = xs_fmt("<span title=\"%s\"> 📌 </span>", L("Pinned"));
|
||||
s = xs_str_cat(s, f);
|
||||
xs_html_add(score,
|
||||
xs_html_tag("span",
|
||||
xs_html_attr("title", L("Pinned")),
|
||||
xs_html_raw(" 📌 ")));
|
||||
}
|
||||
|
||||
if (strcmp(type, "Question") == 0) {
|
||||
/* add the ballot box emoji */
|
||||
xs *f = xs_fmt("<span title=\"%s\"> 🗳 </span>", L("Poll"));
|
||||
s = xs_str_cat(s, f);
|
||||
xs_html_add(score,
|
||||
xs_html_tag("span",
|
||||
xs_html_attr("title", L("Poll")),
|
||||
xs_html_raw(" 🗳 ")));
|
||||
|
||||
if (user && was_question_voted(user, id)) {
|
||||
/* add a check to show this poll was voted */
|
||||
xs *f2 = xs_fmt("<span title=\"%s\"> ✓ </span>", L("Voted"));
|
||||
s = xs_str_cat(s, f2);
|
||||
xs_html_add(score,
|
||||
xs_html_tag("span",
|
||||
xs_html_attr("title", L("Voted")),
|
||||
xs_html_raw(" ✓ ")));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1324,13 +1333,16 @@ xs_str *html_entry(snac *user, xs_str *os, const xs_dict *msg, int local,
|
|||
int n_boosts = object_announces_len(id);
|
||||
|
||||
/* alternate emojis: %d 👍 %d 🔁 */
|
||||
|
||||
xs *s1 = xs_fmt("%d ★ %d ↺\n", n_likes, n_boosts);
|
||||
|
||||
s = xs_str_cat(s, s1);
|
||||
xs_html_add(score,
|
||||
xs_html_raw(s1));
|
||||
}
|
||||
|
||||
s = xs_str_cat(s, "</div>\n");
|
||||
{
|
||||
xs *s1 = xs_html_render(score);
|
||||
s = xs_str_cat(s, s1);
|
||||
}
|
||||
|
||||
if (boosts == NULL)
|
||||
boosts = object_announces(id);
|
||||
|
|
Loading…
Reference in a new issue