diff options
Diffstat (limited to 'ui-shared.c')
-rw-r--r-- | ui-shared.c | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/ui-shared.c b/ui-shared.c index 72a1505..0b7937c 100644 --- a/ui-shared.c +++ b/ui-shared.c | |||
@@ -203,6 +203,9 @@ static void site_url(const char *page, const char *search, const char *sort, int | |||
203 | { | 203 | { |
204 | char *delim = "?"; | 204 | char *delim = "?"; |
205 | 205 | ||
206 | if (!strcmp(page ? page : "", ctx.cfg.root_default_tab)) | ||
207 | page = NULL; | ||
208 | |||
206 | if (always_root || page) | 209 | if (always_root || page) |
207 | html_attr(cgit_rooturl()); | 210 | html_attr(cgit_rooturl()); |
208 | else { | 211 | else { |
@@ -257,7 +260,7 @@ static void site_link(const char *page, const char *name, const char *title, | |||
257 | void cgit_index_link(const char *name, const char *title, const char *class, | 260 | void cgit_index_link(const char *name, const char *title, const char *class, |
258 | const char *pattern, const char *sort, int ofs, int always_root) | 261 | const char *pattern, const char *sort, int ofs, int always_root) |
259 | { | 262 | { |
260 | site_link(NULL, name, title, class, pattern, sort, ofs, always_root); | 263 | site_link("repolist", name, title, class, pattern, sort, ofs, always_root); |
261 | } | 264 | } |
262 | 265 | ||
263 | static char *repolink(const char *title, const char *class, const char *page, | 266 | static char *repolink(const char *title, const char *class, const char *page, |
@@ -317,6 +320,14 @@ static void reporevlink(const char *page, const char *name, const char *title, | |||
317 | { | 320 | { |
318 | char *delim; | 321 | char *delim; |
319 | 322 | ||
323 | if (!strcmp(page | ||
324 | ? page | ||
325 | : "", | ||
326 | ctx.repo | ||
327 | ? ctx.repo->default_tab | ||
328 | : ctx.cfg.root_default_tab)) | ||
329 | page = NULL; | ||
330 | |||
320 | delim = repolink(title, class, page, head, path); | 331 | delim = repolink(title, class, page, head, path); |
321 | if (rev && ctx.qry.head != NULL && strcmp(rev, ctx.qry.head)) { | 332 | if (rev && ctx.qry.head != NULL && strcmp(rev, ctx.qry.head)) { |
322 | html(delim); | 333 | html(delim); |
@@ -328,10 +339,17 @@ static void reporevlink(const char *page, const char *name, const char *title, | |||
328 | html("</a>"); | 339 | html("</a>"); |
329 | } | 340 | } |
330 | 341 | ||
342 | void cgit_repo_link(const char *name, const char *title, const char *class, | ||
343 | const char *head) | ||
344 | { | ||
345 | reporevlink(NULL, name, title, class, head, NULL, NULL); | ||
346 | } | ||
347 | |||
348 | |||
331 | void cgit_summary_link(const char *name, const char *title, const char *class, | 349 | void cgit_summary_link(const char *name, const char *title, const char *class, |
332 | const char *head) | 350 | const char *head) |
333 | { | 351 | { |
334 | reporevlink(NULL, name, title, class, head, NULL, NULL); | 352 | reporevlink("summary", name, title, class, head, NULL, NULL); |
335 | } | 353 | } |
336 | 354 | ||
337 | void cgit_tag_link(const char *name, const char *title, const char *class, | 355 | void cgit_tag_link(const char *name, const char *title, const char *class, |
@@ -1111,7 +1129,7 @@ void cgit_print_pageheader(void) | |||
1111 | html("</form>\n"); | 1129 | html("</form>\n"); |
1112 | } else if (ctx.env.authenticated) { | 1130 | } else if (ctx.env.authenticated) { |
1113 | char *currenturl = cgit_currenturl(); | 1131 | char *currenturl = cgit_currenturl(); |
1114 | site_link(NULL, "index", NULL, hc("repolist"), NULL, NULL, 0, 1); | 1132 | site_link("repolist", "index", NULL, hc("repolist"), NULL, NULL, 0, 1); |
1115 | if (ctx.cfg.root_readme) | 1133 | if (ctx.cfg.root_readme) |
1116 | site_link("about", "about", NULL, hc("about"), | 1134 | site_link("about", "about", NULL, hc("about"), |
1117 | NULL, NULL, 0, 1); | 1135 | NULL, NULL, 0, 1); |