diff options
Diffstat (limited to 'ui-shared.c')
-rw-r--r-- | ui-shared.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/ui-shared.c b/ui-shared.c index 838437c..ff03cb2 100644 --- a/ui-shared.c +++ b/ui-shared.c | |||
@@ -147,14 +147,14 @@ const char *cgit_repobasename(const char *reponame) | |||
147 | return rvbuf; | 147 | return rvbuf; |
148 | } | 148 | } |
149 | 149 | ||
150 | static void site_url(const char *page, const char *search, const char *sort, int ofs) | 150 | static void site_url(const char *page, const char *search, const char *sort, int ofs, int always_root) |
151 | { | 151 | { |
152 | char *delim = "?"; | 152 | char *delim = "?"; |
153 | 153 | ||
154 | if (!page) | 154 | if (always_root || page) |
155 | html_attr(cgit_currenturl()); | ||
156 | else | ||
157 | html_attr(cgit_rooturl()); | 155 | html_attr(cgit_rooturl()); |
156 | else | ||
157 | html_attr(cgit_currenturl()); | ||
158 | 158 | ||
159 | if (page) { | 159 | if (page) { |
160 | htmlf("?p=%s", page); | 160 | htmlf("?p=%s", page); |
@@ -179,7 +179,7 @@ static void site_url(const char *page, const char *search, const char *sort, int | |||
179 | } | 179 | } |
180 | 180 | ||
181 | static void site_link(const char *page, const char *name, const char *title, | 181 | static void site_link(const char *page, const char *name, const char *title, |
182 | const char *class, const char *search, const char *sort, int ofs) | 182 | const char *class, const char *search, const char *sort, int ofs, int always_root) |
183 | { | 183 | { |
184 | html("<a"); | 184 | html("<a"); |
185 | if (title) { | 185 | if (title) { |
@@ -193,16 +193,16 @@ static void site_link(const char *page, const char *name, const char *title, | |||
193 | html("'"); | 193 | html("'"); |
194 | } | 194 | } |
195 | html(" href='"); | 195 | html(" href='"); |
196 | site_url(page, search, sort, ofs); | 196 | site_url(page, search, sort, ofs, always_root); |
197 | html("'>"); | 197 | html("'>"); |
198 | html_txt(name); | 198 | html_txt(name); |
199 | html("</a>"); | 199 | html("</a>"); |
200 | } | 200 | } |
201 | 201 | ||
202 | void cgit_index_link(const char *name, const char *title, const char *class, | 202 | void cgit_index_link(const char *name, const char *title, const char *class, |
203 | const char *pattern, const char *sort, int ofs) | 203 | const char *pattern, const char *sort, int ofs, int always_root) |
204 | { | 204 | { |
205 | site_link(NULL, name, title, class, pattern, sort, ofs); | 205 | site_link(NULL, name, title, class, pattern, sort, ofs, always_root); |
206 | } | 206 | } |
207 | 207 | ||
208 | static char *repolink(const char *title, const char *class, const char *page, | 208 | static char *repolink(const char *title, const char *class, const char *page, |
@@ -446,7 +446,7 @@ static void cgit_self_link(char *name, const char *title, const char *class) | |||
446 | { | 446 | { |
447 | if (!strcmp(ctx.qry.page, "repolist")) | 447 | if (!strcmp(ctx.qry.page, "repolist")) |
448 | cgit_index_link(name, title, class, ctx.qry.search, ctx.qry.sort, | 448 | cgit_index_link(name, title, class, ctx.qry.search, ctx.qry.sort, |
449 | ctx.qry.ofs); | 449 | ctx.qry.ofs, 1); |
450 | else if (!strcmp(ctx.qry.page, "summary")) | 450 | else if (!strcmp(ctx.qry.page, "summary")) |
451 | cgit_summary_link(name, title, class, ctx.qry.head); | 451 | cgit_summary_link(name, title, class, ctx.qry.head); |
452 | else if (!strcmp(ctx.qry.page, "tag")) | 452 | else if (!strcmp(ctx.qry.page, "tag")) |
@@ -875,7 +875,7 @@ static void print_header(void) | |||
875 | 875 | ||
876 | html("<td class='main'>"); | 876 | html("<td class='main'>"); |
877 | if (ctx.repo) { | 877 | if (ctx.repo) { |
878 | cgit_index_link("index", NULL, NULL, NULL, NULL, 0); | 878 | cgit_index_link("index", NULL, NULL, NULL, NULL, 0, 1); |
879 | html(" : "); | 879 | html(" : "); |
880 | cgit_summary_link(ctx.repo->name, ctx.repo->name, NULL, NULL); | 880 | cgit_summary_link(ctx.repo->name, ctx.repo->name, NULL, NULL); |
881 | if (ctx.env.authenticated) { | 881 | if (ctx.env.authenticated) { |
@@ -953,10 +953,10 @@ void cgit_print_pageheader(void) | |||
953 | html("<input type='submit' value='search'/>\n"); | 953 | html("<input type='submit' value='search'/>\n"); |
954 | html("</form>\n"); | 954 | html("</form>\n"); |
955 | } else if (ctx.env.authenticated) { | 955 | } else if (ctx.env.authenticated) { |
956 | site_link(NULL, "index", NULL, hc("repolist"), NULL, NULL, 0); | 956 | site_link(NULL, "index", NULL, hc("repolist"), NULL, NULL, 0, 1); |
957 | if (ctx.cfg.root_readme) | 957 | if (ctx.cfg.root_readme) |
958 | site_link("about", "about", NULL, hc("about"), | 958 | site_link("about", "about", NULL, hc("about"), |
959 | NULL, NULL, 0); | 959 | NULL, NULL, 0, 1); |
960 | html("</td><td class='form'>"); | 960 | html("</td><td class='form'>"); |
961 | html("<form method='get' action='"); | 961 | html("<form method='get' action='"); |
962 | html_attr(cgit_currenturl()); | 962 | html_attr(cgit_currenturl()); |