summaryrefslogtreecommitdiffabout
path: root/ui-shared.c
authorLars Hjemli <hjemli@gmail.com>2007-12-03 00:49:38 (UTC)
committer Lars Hjemli <hjemli@gmail.com>2007-12-03 00:49:38 (UTC)
commitafcdd083dab81afef744e261d81a452698188c30 (patch) (unidiff)
tree0ca43a6b87567af70c802a25124702c7c7891c9a /ui-shared.c
parentdabb34af760eff2a6ab8e14927fd173cafb77547 (diff)
downloadcgit-afcdd083dab81afef744e261d81a452698188c30.zip
cgit-afcdd083dab81afef744e261d81a452698188c30.tar.gz
cgit-afcdd083dab81afef744e261d81a452698188c30.tar.bz2
Add support for automatic and custom clone urls
This adds support for two new parameters to cgitrc: clone-prefix and repo.clone-url. If clone-prefix is specified, all repos will get a clone url printed in the sidebar; the url is generated by clone-prefix + repo.url. Additionally, each repo can specify repo.clone-url which will override any such auto-generated url. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Diffstat (limited to 'ui-shared.c') (more/less context) (ignore whitespace changes)
-rw-r--r--ui-shared.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/ui-shared.c b/ui-shared.c
index 3e13c86..ece041c 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -460,6 +460,7 @@ void cgit_print_pageheader(char *title, int show_search)
460{ 460{
461 static const char *default_info = "This is cgit, a fast webinterface for git repositories"; 461 static const char *default_info = "This is cgit, a fast webinterface for git repositories";
462 int header = 0; 462 int header = 0;
463 char *url;
463 464
464 html("<table id='layout' summary=''>\n"); 465 html("<table id='layout' summary=''>\n");
465 html("<tr><td id='sidebar'>\n"); 466 html("<tr><td id='sidebar'>\n");
@@ -492,6 +493,22 @@ void cgit_print_pageheader(char *title, int show_search)
492 493
493 for_each_ref(print_archive_ref, &header); 494 for_each_ref(print_archive_ref, &header);
494 495
496 if (cgit_repo->clone_url || cgit_clone_prefix) {
497 html("<h1>clone</h1>\n");
498 if (cgit_repo->clone_url)
499 url = cgit_repo->clone_url;
500 else
501 url = fmt("%s%s", cgit_clone_prefix,
502 cgit_repo->url);
503 html("<a class='menu' href='");
504 html_attr(url);
505 html("' title='");
506 html_attr(url);
507 html("'>\n");
508 html_txt(strrpart(url, 20));
509 html("</a>\n");
510 }
511
495 html("<h1>branch</h1>\n"); 512 html("<h1>branch</h1>\n");
496 html("<form method='get' action=''>\n"); 513 html("<form method='get' action=''>\n");
497 add_hidden_formfields(0, 1, cgit_query_page); 514 add_hidden_formfields(0, 1, cgit_query_page);