aboutsummaryrefslogtreecommitdiffstats
path: root/ui-shared.c
diff options
context:
space:
mode:
authorGravatar Lars Hjemli <hjemli@gmail.com>2012-01-04 01:06:58 (JST)
committerGravatar Lars Hjemli <hjemli@gmail.com>2012-01-04 01:06:58 (JST)
commit04254fa903701943bd45a479a952cc213a5b112a (patch)
tree5ae865f0cae8505cb54d3360baa256fc684e3bbc /ui-shared.c
parentd96d2c98ebc4c2d3765f5b35c4142e0e828a421b (diff)
parentf2ced535e9f2c2ada7f184735a07a1190a9d810f (diff)
downloadcgit-04254fa903701943bd45a479a952cc213a5b112a.zip
cgit-04254fa903701943bd45a479a952cc213a5b112a.tar.gz
Merge branch 'stable'
Diffstat (limited to 'ui-shared.c')
-rw-r--r--ui-shared.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/ui-shared.c b/ui-shared.c
index 5aa9119..85c2096 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -133,7 +133,7 @@ char *cgit_currurl()
133 return fmt("%s/", ctx.cfg.virtual_root); 133 return fmt("%s/", ctx.cfg.virtual_root);
134} 134}
135 135
136static void site_url(const char *page, const char *search, int ofs) 136static void site_url(const char *page, const char *search, const char *sort, int ofs)
137{ 137{
138 char *delim = "?"; 138 char *delim = "?";
139 139
@@ -154,6 +154,12 @@ static void site_url(const char *page, const char *search, int ofs)
154 html_attr(search); 154 html_attr(search);
155 delim = "&"; 155 delim = "&";
156 } 156 }
157 if (sort) {
158 html(delim);
159 html("s=");
160 html_attr(sort);
161 delim = "&";
162 }
157 if (ofs) { 163 if (ofs) {
158 html(delim); 164 html(delim);
159 htmlf("ofs=%d", ofs); 165 htmlf("ofs=%d", ofs);
@@ -161,7 +167,7 @@ static void site_url(const char *page, const char *search, int ofs)
161} 167}
162 168
163static void site_link(const char *page, const char *name, const char *title, 169static void site_link(const char *page, const char *name, const char *title,
164 const char *class, const char *search, int ofs) 170 const char *class, const char *search, const char *sort, int ofs)
165{ 171{
166 html("<a"); 172 html("<a");
167 if (title) { 173 if (title) {
@@ -175,16 +181,16 @@ static void site_link(const char *page, const char *name, const char *title,
175 html("'"); 181 html("'");
176 } 182 }
177 html(" href='"); 183 html(" href='");
178 site_url(page, search, ofs); 184 site_url(page, search, sort, ofs);
179 html("'>"); 185 html("'>");
180 html_txt(name); 186 html_txt(name);
181 html("</a>"); 187 html("</a>");
182} 188}
183 189
184void cgit_index_link(const char *name, const char *title, const char *class, 190void cgit_index_link(const char *name, const char *title, const char *class,
185 const char *pattern, int ofs) 191 const char *pattern, const char *sort, int ofs)
186{ 192{
187 site_link(NULL, name, title, class, pattern, ofs); 193 site_link(NULL, name, title, class, pattern, sort, ofs);
188} 194}
189 195
190static char *repolink(const char *title, const char *class, const char *page, 196static char *repolink(const char *title, const char *class, const char *page,
@@ -428,7 +434,7 @@ void cgit_self_link(char *name, const char *title, const char *class,
428 struct cgit_context *ctx) 434 struct cgit_context *ctx)
429{ 435{
430 if (!strcmp(ctx->qry.page, "repolist")) 436 if (!strcmp(ctx->qry.page, "repolist"))
431 return cgit_index_link(name, title, class, ctx->qry.search, 437 return cgit_index_link(name, title, class, ctx->qry.search, ctx->qry.sort,
432 ctx->qry.ofs); 438 ctx->qry.ofs);
433 else if (!strcmp(ctx->qry.page, "summary")) 439 else if (!strcmp(ctx->qry.page, "summary"))
434 return cgit_summary_link(name, title, class, ctx->qry.head); 440 return cgit_summary_link(name, title, class, ctx->qry.head);
@@ -782,7 +788,7 @@ static void print_header(struct cgit_context *ctx)
782 788
783 html("<td class='main'>"); 789 html("<td class='main'>");
784 if (ctx->repo) { 790 if (ctx->repo) {
785 cgit_index_link("index", NULL, NULL, NULL, 0); 791 cgit_index_link("index", NULL, NULL, NULL, NULL, 0);
786 html(" : "); 792 html(" : ");
787 cgit_summary_link(ctx->repo->name, ctx->repo->name, NULL, NULL); 793 cgit_summary_link(ctx->repo->name, ctx->repo->name, NULL, NULL);
788 html("</td><td class='form'>"); 794 html("</td><td class='form'>");
@@ -858,10 +864,10 @@ void cgit_print_pageheader(struct cgit_context *ctx)
858 html("<input type='submit' value='search'/>\n"); 864 html("<input type='submit' value='search'/>\n");
859 html("</form>\n"); 865 html("</form>\n");
860 } else { 866 } else {
861 site_link(NULL, "index", NULL, hc(ctx, "repolist"), NULL, 0); 867 site_link(NULL, "index", NULL, hc(ctx, "repolist"), NULL, NULL, 0);
862 if (ctx->cfg.root_readme) 868 if (ctx->cfg.root_readme)
863 site_link("about", "about", NULL, hc(ctx, "about"), 869 site_link("about", "about", NULL, hc(ctx, "about"),
864 NULL, 0); 870 NULL, NULL, 0);
865 html("</td><td class='form'>"); 871 html("</td><td class='form'>");
866 html("<form method='get' action='"); 872 html("<form method='get' action='");
867 html_attr(cgit_rooturl()); 873 html_attr(cgit_rooturl());