diff options
| author | Mehmet Samet Duman <froster12@naver.com> | 2026-02-13 15:20:08 +0300 |
|---|---|---|
| committer | Mehmet Samet Duman <froster12@naver.com> | 2026-02-13 15:20:08 +0300 |
| commit | e94c3cd8bda6f9c2a6d0a613733c6eeddd1a406f (patch) | |
| tree | f3d2ca5307ac44bd65150428844436c63c375592 | |
| parent | 4ce807b14cde82df10e0c63220a5b1b73610d7d2 (diff) | |
| download | Project-Tick-e94c3cd8bda6f9c2a6d0a613733c6eeddd1a406f.tar.gz Project-Tick-e94c3cd8bda6f9c2a6d0a613733c6eeddd1a406f.zip | |
feat: add root homepage configuration and update UI to display it
Signed-off-by: Mehmet Samet Duman <froster12@naver.com>
| -rw-r--r-- | cgitrc.5.txt | 4 | ||||
| -rwxr-xr-x | tests/setup.sh | 2 | ||||
| -rw-r--r-- | tests/t0114-root-homepage.sh | 4 | ||||
| -rw-r--r-- | ui-shared.c | 4 |
4 files changed, 10 insertions, 4 deletions
diff --git a/cgitrc.5.txt b/cgitrc.5.txt index a7d4c8c64b..dcca570a48 100644 --- a/cgitrc.5.txt +++ b/cgitrc.5.txt @@ -393,8 +393,8 @@ root-cla:: root-homepage:: Specifies an external URL to be shown as a link on the repository index page tabs (next to "index", "about", etc). This is kept for - backward compatibility; for multiple links use "root-link". Default - value: none. + backward compatibility and may be used together with "root-link". + Default value: none. root-homepage-title:: Text to use for the root-homepage link label. This only applies to diff --git a/tests/setup.sh b/tests/setup.sh index 33f0e3cbe8..1bd7da0149 100755 --- a/tests/setup.sh +++ b/tests/setup.sh @@ -120,6 +120,8 @@ clone-url=git://example.org/\$CGIT_REPO_URL.git enable-filter-overrides=1 root-coc=$PWD/site-coc.txt root-cla=$PWD/site-cla.txt +root-homepage=https://projecttick.org +root-homepage-title=Project Tick root-link=GitHub|https://github.com/example root-link=GitLab|https://gitlab.com/example root-link=Codeberg|https://codeberg.org/example diff --git a/tests/t0114-root-homepage.sh b/tests/t0114-root-homepage.sh index 22f1bd463a..f5a4d28797 100644 --- a/tests/t0114-root-homepage.sh +++ b/tests/t0114-root-homepage.sh @@ -5,6 +5,8 @@ test_description='Check root external links' test_expect_success 'index has configured root links' ' cgit_url "" >tmp && + grep "https://projecttick.org" tmp && + grep ">Project Tick<" tmp && grep "https://github.com/example" tmp && grep ">GitHub<" tmp && grep "https://gitlab.com/example" tmp && @@ -15,6 +17,8 @@ test_expect_success 'index has configured root links' ' test_expect_success 'root pages keep root links' ' cgit_query "p=coc" >tmp && + grep "https://projecttick.org" tmp && + grep ">Project Tick<" tmp && grep "https://github.com/example" tmp && grep ">GitHub<" tmp && grep "https://gitlab.com/example" tmp && diff --git a/ui-shared.c b/ui-shared.c index f8ba28e3cf..eb09aebd12 100644 --- a/ui-shared.c +++ b/ui-shared.c @@ -1157,11 +1157,11 @@ void cgit_print_pageheader(void) if (ctx.cfg.root_cla) site_link("cla", "Contributor License Agreement", NULL, hc("cla"), NULL, NULL, 0, 1); + if (ctx.cfg.root_homepage) + print_root_link(ctx.cfg.root_homepage_title, ctx.cfg.root_homepage); if (ctx.cfg.root_links.nr) for_each_string_list_item(item, &ctx.cfg.root_links) print_root_link(item->string, item->util); - else if (ctx.cfg.root_homepage) - print_root_link(ctx.cfg.root_homepage_title, ctx.cfg.root_homepage); html("</td><td class='form'>"); html("<form method='get' action='"); html_attr(currenturl); |
