diff --git a/themed/index.html b/themed/index.html new file mode 100644 index 0000000..03c0169 --- /dev/null +++ b/themed/index.html @@ -0,0 +1,63 @@ +{! int cgit_repolist_is_visible(struct cgit_repo *repo); !} +{! void cgit_repolist_print_modtime(struct cgit_repo *repo); !} +{! void cgit_shared_site_url(const char *page, const char *search, const char *sort, int ofs, int always_root); !} + +{% page cgit_print_repolist %} +{! ctx.page.title = ctx.cfg.root_title; !} + + + + + {{ ctx.cfg.root_title }} + + + + +
+ {# Repo header #} +
+ {{ ctx.cfg.root_title }} +
+
+
+ {# Main content #} +
+ {# Search box #} + + +
+
+ {# Repo list #} + {! for (int i = 0; i < cgit_repolist.count; i++) { !} + {! ctx.repo = &cgit_repolist.repos[i]; !} + {! if (!cgit_repolist_is_visible(ctx.repo)) { continue; } !} +
+ {# Heroicons outline cube #} + +
+
+ {! char *repourl = cgit_repourl(ctx.repo->url); !} +
{{ ctx.repo->name }}
+ {! free(repourl); !} +
{{ ctx.repo->desc }}
+
Updated {! cgit_repolist_print_modtime(ctx.repo); !} ago
+
+ {! } !} +
+
+ + + +{% endpage %} diff --git a/ui-repolist.c b/ui-repolist.c index d12e3dd..01f1fb5 100644 --- a/ui-repolist.c +++ b/ui-repolist.c @@ -82,6 +82,11 @@ static void print_modtime(struct cgit_repo *repo) cgit_print_age(t, 0, -1); } +void cgit_repolist_print_modtime(struct cgit_repo *repo) +{ + print_modtime(repo); +} + static int is_match(struct cgit_repo *repo) { if (!ctx.qry.search) @@ -115,6 +120,11 @@ static int is_visible(struct cgit_repo *repo) return 1; } +int cgit_repolist_is_visible(struct cgit_repo *repo) +{ + return is_visible(repo); +} + static int any_repos_visible(void) { int i; @@ -265,7 +275,7 @@ static int sort_repolist(char *field) } -void cgit_print_repolist(void) +void _orig_cgit_print_repolist(void) { int i, columns = 3, hits = 0, header = 0; char *last_section = NULL; diff --git a/ui-repolist.h b/ui-repolist.h index 1b6b322..f62cd3e 100644 --- a/ui-repolist.h +++ b/ui-repolist.h @@ -1,6 +1,9 @@ #ifndef UI_REPOLIST_H #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_print_repolist(void); extern void cgit_print_site_readme(void); diff --git a/ui-shared.c b/ui-shared.c index 4250b89..5853a96 100644 --- a/ui-shared.c +++ b/ui-shared.c @@ -235,6 +235,11 @@ static void site_url(const char *page, const char *search, const char *sort, int } } +void cgit_shared_site_url(const char *page, const char *search, const char *sort, int ofs, int always_root) +{ + site_url(page, search, sort, ofs, always_root); +} + static void site_link(const char *page, const char *name, const char *title, const char *class, const char *search, const char *sort, int ofs, int always_root) { diff --git a/ui-shared.h b/ui-shared.h index f12fa99..ce05a9b 100644 --- a/ui-shared.h +++ b/ui-shared.h @@ -1,6 +1,8 @@ #ifndef UI_SHARED_H #define UI_SHARED_H +extern void cgit_shared_site_url(const char *page, const char *search, const char *sort, int ofs, int always_root); + extern const char *cgit_httpscheme(void); extern char *cgit_hosturl(void); extern const char *cgit_rooturl(void);