From dfce67570fad0853ba7f7d083708208abaaf35af Mon Sep 17 00:00:00 2001 From: RunasSudo Date: Fri, 16 May 2025 20:11:16 +1000 Subject: [PATCH] Use themed display for repo age on index page --- themed/index.html | 2 +- ui-repolist.c | 12 ++++++++++-- ui-repolist.h | 2 +- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/themed/index.html b/themed/index.html index aa50f0a..712307e 100644 --- a/themed/index.html +++ b/themed/index.html @@ -34,7 +34,7 @@
{{ ctx.repo->name }}
{! free(repourl); !}
{{ ctx.repo->desc }}
-
Updated {! cgit_repolist_print_modtime(ctx.repo); !} ago
+
Updated {! cgit_repolist_print_modtime_themed(ctx.repo); !}
{% endfor %} diff --git a/ui-repolist.c b/ui-repolist.c index 01f1fb5..1802086 100644 --- a/ui-repolist.c +++ b/ui-repolist.c @@ -82,9 +82,12 @@ static void print_modtime(struct cgit_repo *repo) cgit_print_age(t, 0, -1); } -void cgit_repolist_print_modtime(struct cgit_repo *repo) +void cgit_repolist_print_modtime_themed(struct cgit_repo *repo) { - print_modtime(repo); + time_t t; + if (get_repo_modtime(repo, &t)) { + cgit_print_age_themed(t, 0, TM_MONTH * 12); + } } static int is_match(struct cgit_repo *repo) @@ -274,6 +277,11 @@ static int sort_repolist(char *field) return 0; } +int cgit_repolist_sort_repolist(char *field) +{ + return sort_repolist(field); +} + void _orig_cgit_print_repolist(void) { diff --git a/ui-repolist.h b/ui-repolist.h index fd266df..47e434a 100644 --- a/ui-repolist.h +++ b/ui-repolist.h @@ -2,7 +2,7 @@ #define UI_REPOLIST_H extern int cgit_repolist_is_visible(struct cgit_repo *repo); -extern void cgit_repolist_print_modtime(struct cgit_repo *repo); +extern void cgit_repolist_print_modtime_themed(struct cgit_repo *repo); extern int cgit_repolist_sort_repolist(char *field); extern void cgit_print_repolist(void);