diff options
Diffstat (limited to 'ui-shared.c')
-rw-r--r-- | ui-shared.c | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/ui-shared.c b/ui-shared.c index 4f84b7c..6be0c2e 100644 --- a/ui-shared.c +++ b/ui-shared.c | |||
@@ -303,7 +303,8 @@ void cgit_plain_link(const char *name, const char *title, const char *class, | |||
303 | 303 | ||
304 | void cgit_log_link(const char *name, const char *title, const char *class, | 304 | void cgit_log_link(const char *name, const char *title, const char *class, |
305 | const char *head, const char *rev, const char *path, | 305 | const char *head, const char *rev, const char *path, |
306 | int ofs, const char *grep, const char *pattern, int showmsg) | 306 | int ofs, const char *grep, const char *pattern, int showmsg, |
307 | int follow) | ||
307 | { | 308 | { |
308 | char *delim; | 309 | char *delim; |
309 | 310 | ||
@@ -332,6 +333,11 @@ void cgit_log_link(const char *name, const char *title, const char *class, | |||
332 | if (showmsg) { | 333 | if (showmsg) { |
333 | html(delim); | 334 | html(delim); |
334 | html("showmsg=1"); | 335 | html("showmsg=1"); |
336 | delim = "&"; | ||
337 | } | ||
338 | if (follow) { | ||
339 | html(delim); | ||
340 | html("follow=1"); | ||
335 | } | 341 | } |
336 | html("'>"); | 342 | html("'>"); |
337 | html_txt(name); | 343 | html_txt(name); |
@@ -373,6 +379,10 @@ void cgit_commit_link(char *name, const char *title, const char *class, | |||
373 | html("ignorews=1"); | 379 | html("ignorews=1"); |
374 | delim = "&"; | 380 | delim = "&"; |
375 | } | 381 | } |
382 | if (ctx.qry.follow) { | ||
383 | html(delim); | ||
384 | html("follow=1"); | ||
385 | } | ||
376 | html("'>"); | 386 | html("'>"); |
377 | if (name[0] != '\0') | 387 | if (name[0] != '\0') |
378 | html_txt(name); | 388 | html_txt(name); |
@@ -429,6 +439,10 @@ void cgit_diff_link(const char *name, const char *title, const char *class, | |||
429 | html("ignorews=1"); | 439 | html("ignorews=1"); |
430 | delim = "&"; | 440 | delim = "&"; |
431 | } | 441 | } |
442 | if (ctx.qry.follow) { | ||
443 | html(delim); | ||
444 | html("follow=1"); | ||
445 | } | ||
432 | html("'>"); | 446 | html("'>"); |
433 | html_txt(name); | 447 | html_txt(name); |
434 | html("</a>"); | 448 | html("</a>"); |
@@ -469,7 +483,7 @@ static void cgit_self_link(char *name, const char *title, const char *class) | |||
469 | ctx.qry.has_sha1 ? ctx.qry.sha1 : NULL, | 483 | ctx.qry.has_sha1 ? ctx.qry.sha1 : NULL, |
470 | ctx.qry.path, ctx.qry.ofs, | 484 | ctx.qry.path, ctx.qry.ofs, |
471 | ctx.qry.grep, ctx.qry.search, | 485 | ctx.qry.grep, ctx.qry.search, |
472 | ctx.qry.showmsg); | 486 | ctx.qry.showmsg, ctx.qry.follow); |
473 | else if (!strcmp(ctx.qry.page, "commit")) | 487 | else if (!strcmp(ctx.qry.page, "commit")) |
474 | cgit_commit_link(name, title, class, ctx.qry.head, | 488 | cgit_commit_link(name, title, class, ctx.qry.head, |
475 | ctx.qry.has_sha1 ? ctx.qry.sha1 : NULL, | 489 | ctx.qry.has_sha1 ? ctx.qry.sha1 : NULL, |
@@ -945,7 +959,7 @@ void cgit_print_pageheader(void) | |||
945 | ctx.qry.sha1, NULL); | 959 | ctx.qry.sha1, NULL); |
946 | cgit_log_link("log", NULL, hc("log"), ctx.qry.head, | 960 | cgit_log_link("log", NULL, hc("log"), ctx.qry.head, |
947 | NULL, ctx.qry.vpath, 0, NULL, NULL, | 961 | NULL, ctx.qry.vpath, 0, NULL, NULL, |
948 | ctx.qry.showmsg); | 962 | ctx.qry.showmsg, ctx.qry.follow); |
949 | cgit_tree_link("tree", NULL, hc("tree"), ctx.qry.head, | 963 | cgit_tree_link("tree", NULL, hc("tree"), ctx.qry.head, |
950 | ctx.qry.sha1, ctx.qry.vpath); | 964 | ctx.qry.sha1, ctx.qry.vpath); |
951 | cgit_commit_link("commit", NULL, hc("commit"), | 965 | cgit_commit_link("commit", NULL, hc("commit"), |
@@ -993,6 +1007,14 @@ void cgit_print_pageheader(void) | |||
993 | html("<div class='path'>"); | 1007 | html("<div class='path'>"); |
994 | html("path: "); | 1008 | html("path: "); |
995 | cgit_print_path_crumbs(ctx.qry.vpath); | 1009 | cgit_print_path_crumbs(ctx.qry.vpath); |
1010 | if (ctx.cfg.enable_follow_links && !strcmp(ctx.qry.page, "log")) { | ||
1011 | html(" ("); | ||
1012 | ctx.qry.follow = !ctx.qry.follow; | ||
1013 | cgit_self_link(ctx.qry.follow ? "follow" : "unfollow", | ||
1014 | NULL, NULL); | ||
1015 | ctx.qry.follow = !ctx.qry.follow; | ||
1016 | html(")"); | ||
1017 | } | ||
996 | html("</div>"); | 1018 | html("</div>"); |
997 | } | 1019 | } |
998 | html("<div class='content'>"); | 1020 | html("<div class='content'>"); |