commit a787c81
default
·
2024-05-24 10:12:03 +0000 UTC
parent fcead8e
Added links to the lists in html_timeline().
M
data.c
+1,
-1
1@@ -1832,7 +1832,7 @@ xs_val *list_maint(snac *user, const char *list, int op)
2 fn = xs_replace_i(fn, ".lst", ".idx");
3 unlink(fn);
4
5- fn = xs_append(fn, ".bak");
6+ fn = xs_str_cat(fn, ".bak");
7 unlink(fn);
8 }
9 }
M
html.c
+25,
-0
1@@ -2066,6 +2066,31 @@ xs_str *html_timeline(snac *user, const xs_list *list, int read_only,
2 xs_html_text(title)));
3 }
4
5+ /* show links to the available lists */
6+ {
7+ xs *lists = list_maint(user, NULL, 0); /* get list of lists */
8+
9+ if (xs_list_len(lists)) {
10+ int ct = 0;
11+ const char *v;
12+
13+ xs_html *lol = xs_html_tag("ul",
14+ xs_html_attr("class", "snac-list-of-lists"));
15+ xs_html_add(body, lol);
16+
17+ while (xs_list_next(lists, &v, &ct)) {
18+ xs *url = xs_fmt("%s/list/%s", user->actor, xs_list_get(v, 0));
19+
20+ xs_html_add(lol,
21+ xs_html_tag("li",
22+ xs_html_tag("a",
23+ xs_html_attr("href", url),
24+ xs_html_attr("class", "snac-list-link"),
25+ xs_html_text(xs_list_get(v, 1)))));
26+ }
27+ }
28+ }
29+
30 xs_html_add(body,
31 xs_html_tag("a",
32 xs_html_attr("name", "snac-posts")));