author | Lars Hjemli <hjemli@gmail.com> | 2008-05-03 08:37:02 (UTC) |
---|---|---|
committer | Lars Hjemli <hjemli@gmail.com> | 2008-05-03 08:37:02 (UTC) |
commit | 141f1c3eb657470e81bbf998f44f9723f9009def (patch) (unidiff) | |
tree | a591e720b4a532fc7f53e74d611bb63629c8c5dc | |
parent | e19683bedebc74593cb4c4518e47a334a5478e1e (diff) | |
download | cgit-141f1c3eb657470e81bbf998f44f9723f9009def.zip cgit-141f1c3eb657470e81bbf998f44f9723f9009def.tar.gz cgit-141f1c3eb657470e81bbf998f44f9723f9009def.tar.bz2 |
Add cgit_index_link() function with support for offset
This function will be used to build a pager in ui-repolist.
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
-rw-r--r-- | ui-shared.c | 22 | ||||
-rw-r--r-- | ui-shared.h | 2 |
2 files changed, 19 insertions, 5 deletions
diff --git a/ui-shared.c b/ui-shared.c index d08ede9..f366354 100644 --- a/ui-shared.c +++ b/ui-shared.c | |||
@@ -116,3 +116,3 @@ char *cgit_currurl() | |||
116 | 116 | ||
117 | static void site_url(char *page, char *search) | 117 | static void site_url(char *page, char *search, int ofs) |
118 | { | 118 | { |
@@ -135,2 +135,7 @@ static void site_url(char *page, char *search) | |||
135 | html_attr(search); | 135 | html_attr(search); |
136 | delim = "&"; | ||
137 | } | ||
138 | if (ofs) { | ||
139 | html(delim); | ||
140 | htmlf("ofs=%d", ofs); | ||
136 | } | 141 | } |
@@ -139,3 +144,3 @@ static void site_url(char *page, char *search) | |||
139 | static void site_link(char *page, char *name, char *title, char *class, | 144 | static void site_link(char *page, char *name, char *title, char *class, |
140 | char *search) | 145 | char *search, int ofs) |
141 | { | 146 | { |
@@ -153,3 +158,3 @@ static void site_link(char *page, char *name, char *title, char *class, | |||
153 | html(" href='"); | 158 | html(" href='"); |
154 | site_url(page, search); | 159 | site_url(page, search, ofs); |
155 | html("'>"); | 160 | html("'>"); |
@@ -159,2 +164,8 @@ static void site_link(char *page, char *name, char *title, char *class, | |||
159 | 164 | ||
165 | void cgit_index_link(char *name, char *title, char *class, char *pattern, | ||
166 | int ofs) | ||
167 | { | ||
168 | site_link(NULL, name, title, class, pattern, ofs); | ||
169 | } | ||
170 | |||
160 | static char *repolink(char *title, char *class, char *page, char *head, | 171 | static char *repolink(char *title, char *class, char *page, char *head, |
@@ -598,5 +609,6 @@ void cgit_print_pageheader(struct cgit_context *ctx) | |||
598 | } else { | 609 | } else { |
599 | site_link(NULL, "index", NULL, hc(cmd, "repolist"), NULL); | 610 | site_link(NULL, "index", NULL, hc(cmd, "repolist"), NULL, 0); |
600 | if (ctx->cfg.root_readme) | 611 | if (ctx->cfg.root_readme) |
601 | site_link("about", "about", NULL, hc(cmd, "about"), NULL); | 612 | site_link("about", "about", NULL, hc(cmd, "about"), |
613 | NULL, 0); | ||
602 | html("</td><td class='form'>"); | 614 | html("</td><td class='form'>"); |
diff --git a/ui-shared.h b/ui-shared.h index 76c2b1f..3005d30 100644 --- a/ui-shared.h +++ b/ui-shared.h | |||
@@ -9,2 +9,4 @@ extern char *cgit_pageurl(const char *reponame, const char *pagename, | |||
9 | 9 | ||
10 | extern void cgit_index_link(char *name, char *title, char *class, | ||
11 | char *pattern, int ofs); | ||
10 | extern void cgit_tree_link(char *name, char *title, char *class, char *head, | 12 | extern void cgit_tree_link(char *name, char *title, char *class, char *head, |