Use themed display for repo age on index page

This commit is contained in:
RunasSudo 2025-05-16 20:11:16 +10:00
parent cca01672a2
commit dfce67570f
Signed by: RunasSudo
GPG Key ID: 7234E476BF21C61A
3 changed files with 12 additions and 4 deletions

View File

@ -34,7 +34,7 @@
<div><a href="{{ repourl|attr }}" class="font-semibold text-blue-500 hover:text-blue-600 hover:underline">{{ ctx.repo->name }}</a></div> <div><a href="{{ repourl|attr }}" class="font-semibold text-blue-500 hover:text-blue-600 hover:underline">{{ ctx.repo->name }}</a></div>
{! free(repourl); !} {! free(repourl); !}
<div class="text-sm text-gray-500">{{ ctx.repo->desc }}</div> <div class="text-sm text-gray-500">{{ ctx.repo->desc }}</div>
<div class="text-sm text-gray-500">Updated {! cgit_repolist_print_modtime(ctx.repo); !} ago</div> <div class="text-sm text-gray-500">Updated {! cgit_repolist_print_modtime_themed(ctx.repo); !}</div>
</div> </div>
{% endfor %} {% endfor %}
</div> </div>

View File

@ -82,9 +82,12 @@ static void print_modtime(struct cgit_repo *repo)
cgit_print_age(t, 0, -1); 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) static int is_match(struct cgit_repo *repo)
@ -274,6 +277,11 @@ static int sort_repolist(char *field)
return 0; return 0;
} }
int cgit_repolist_sort_repolist(char *field)
{
return sort_repolist(field);
}
void _orig_cgit_print_repolist(void) void _orig_cgit_print_repolist(void)
{ {

View File

@ -2,7 +2,7 @@
#define UI_REPOLIST_H #define UI_REPOLIST_H
extern int cgit_repolist_is_visible(struct cgit_repo *repo); 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 int cgit_repolist_sort_repolist(char *field);
extern void cgit_print_repolist(void); extern void cgit_print_repolist(void);