summaryrefslogtreecommitdiffabout
authorJohan Herland <johan@herland.net>2010-06-09 23:09:36 (UTC)
committer Lars Hjemli <hjemli@gmail.com>2010-06-19 08:40:24 (UTC)
commit7fdff2460440c09d13fc76af3b75e85434e6f563 (patch) (unidiff)
tree2285bf24286d5ec6046a13b18599e0e00e63111d
parent685872b770be2af643d00365d5358e46687f7385 (diff)
downloadcgit-7fdff2460440c09d13fc76af3b75e85434e6f563.zip
cgit-7fdff2460440c09d13fc76af3b75e85434e6f563.tar.gz
cgit-7fdff2460440c09d13fc76af3b75e85434e6f563.tar.bz2
ui-shared: Preserve path limit in "tab bar" links
When using the "tab bar" in the pageheader to navigate between pages, any path limit in effect on the current page is forgotten in the link to the target page, even if the target page can interpret and use the path limit constructively. Instead, preserve the current page's path limit in the "tab bar" links to other pages, where the path limit is useful to the target page. Signed-off-by: Johan Herland <johan@herland.net> Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--ui-shared.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/ui-shared.c b/ui-shared.c
index 372b9e7..e991799 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -769,58 +769,59 @@ static void print_header(struct cgit_context *ctx)
769 html("</td><td class='sub right'>"); 769 html("</td><td class='sub right'>");
770 html_txt(ctx->repo->owner); 770 html_txt(ctx->repo->owner);
771 } else { 771 } else {
772 if (ctx->cfg.root_desc) 772 if (ctx->cfg.root_desc)
773 html_txt(ctx->cfg.root_desc); 773 html_txt(ctx->cfg.root_desc);
774 else if (ctx->cfg.index_info) 774 else if (ctx->cfg.index_info)
775 html_include(ctx->cfg.index_info); 775 html_include(ctx->cfg.index_info);
776 } 776 }
777 html("</td></tr></table>\n"); 777 html("</td></tr></table>\n");
778} 778}
779 779
780void cgit_print_pageheader(struct cgit_context *ctx) 780void cgit_print_pageheader(struct cgit_context *ctx)
781{ 781{
782 html("<div id='cgit'>"); 782 html("<div id='cgit'>");
783 if (!ctx->cfg.noheader) 783 if (!ctx->cfg.noheader)
784 print_header(ctx); 784 print_header(ctx);
785 785
786 html("<table class='tabs'><tr><td>\n"); 786 html("<table class='tabs'><tr><td>\n");
787 if (ctx->repo) { 787 if (ctx->repo) {
788 cgit_summary_link("summary", NULL, hc(ctx, "summary"), 788 cgit_summary_link("summary", NULL, hc(ctx, "summary"),
789 ctx->qry.head); 789 ctx->qry.head);
790 cgit_refs_link("refs", NULL, hc(ctx, "refs"), ctx->qry.head, 790 cgit_refs_link("refs", NULL, hc(ctx, "refs"), ctx->qry.head,
791 ctx->qry.sha1, NULL); 791 ctx->qry.sha1, NULL);
792 cgit_log_link("log", NULL, hc(ctx, "log"), ctx->qry.head, 792 cgit_log_link("log", NULL, hc(ctx, "log"), ctx->qry.head,
793 NULL, NULL, 0, NULL, NULL, ctx->qry.showmsg); 793 NULL, ctx->qry.vpath, 0, NULL, NULL,
794 ctx->qry.showmsg);
794 cgit_tree_link("tree", NULL, hc(ctx, "tree"), ctx->qry.head, 795 cgit_tree_link("tree", NULL, hc(ctx, "tree"), ctx->qry.head,
795 ctx->qry.sha1, NULL); 796 ctx->qry.sha1, ctx->qry.vpath);
796 cgit_commit_link("commit", NULL, hc(ctx, "commit"), 797 cgit_commit_link("commit", NULL, hc(ctx, "commit"),
797 ctx->qry.head, ctx->qry.sha1, NULL, 0); 798 ctx->qry.head, ctx->qry.sha1, ctx->qry.vpath, 0);
798 cgit_diff_link("diff", NULL, hc(ctx, "diff"), ctx->qry.head, 799 cgit_diff_link("diff", NULL, hc(ctx, "diff"), ctx->qry.head,
799 ctx->qry.sha1, ctx->qry.sha2, NULL, 0); 800 ctx->qry.sha1, ctx->qry.sha2, ctx->qry.vpath, 0);
800 if (ctx->repo->max_stats) 801 if (ctx->repo->max_stats)
801 cgit_stats_link("stats", NULL, hc(ctx, "stats"), 802 cgit_stats_link("stats", NULL, hc(ctx, "stats"),
802 ctx->qry.head, NULL); 803 ctx->qry.head, ctx->qry.vpath);
803 if (ctx->repo->readme) 804 if (ctx->repo->readme)
804 reporevlink("about", "about", NULL, 805 reporevlink("about", "about", NULL,
805 hc(ctx, "about"), ctx->qry.head, NULL, 806 hc(ctx, "about"), ctx->qry.head, NULL,
806 NULL); 807 NULL);
807 html("</td><td class='form'>"); 808 html("</td><td class='form'>");
808 html("<form class='right' method='get' action='"); 809 html("<form class='right' method='get' action='");
809 if (ctx->cfg.virtual_root) 810 if (ctx->cfg.virtual_root)
810 html_url_path(cgit_fileurl(ctx->qry.repo, "log", 811 html_url_path(cgit_fileurl(ctx->qry.repo, "log",
811 ctx->qry.vpath, NULL)); 812 ctx->qry.vpath, NULL));
812 html("'>\n"); 813 html("'>\n");
813 cgit_add_hidden_formfields(1, 0, "log"); 814 cgit_add_hidden_formfields(1, 0, "log");
814 html("<select name='qt'>\n"); 815 html("<select name='qt'>\n");
815 html_option("grep", "log msg", ctx->qry.grep); 816 html_option("grep", "log msg", ctx->qry.grep);
816 html_option("author", "author", ctx->qry.grep); 817 html_option("author", "author", ctx->qry.grep);
817 html_option("committer", "committer", ctx->qry.grep); 818 html_option("committer", "committer", ctx->qry.grep);
818 html("</select>\n"); 819 html("</select>\n");
819 html("<input class='txt' type='text' size='10' name='q' value='"); 820 html("<input class='txt' type='text' size='10' name='q' value='");
820 html_attr(ctx->qry.search); 821 html_attr(ctx->qry.search);
821 html("'/>\n"); 822 html("'/>\n");
822 html("<input type='submit' value='search'/>\n"); 823 html("<input type='submit' value='search'/>\n");
823 html("</form>\n"); 824 html("</form>\n");
824 } else { 825 } else {
825 site_link(NULL, "index", NULL, hc(ctx, "repolist"), NULL, 0); 826 site_link(NULL, "index", NULL, hc(ctx, "repolist"), NULL, 0);
826 if (ctx->cfg.root_readme) 827 if (ctx->cfg.root_readme)