author | Lars Hjemli <hjemli@gmail.com> | 2007-06-17 22:18:42 (UTC) |
---|---|---|
committer | Lars Hjemli <hjemli@gmail.com> | 2007-06-18 06:29:53 (UTC) |
commit | b8be028a309381b83abe924f5e8e01cf02b121a2 (patch) (unidiff) | |
tree | 669b8ac253e8cc1d8568723167764f5428ae5d83 /ui-shared.c | |
parent | 4a0be586662843382ecfa53af34a13b291312bc0 (diff) | |
download | cgit-b8be028a309381b83abe924f5e8e01cf02b121a2.zip cgit-b8be028a309381b83abe924f5e8e01cf02b121a2.tar.gz cgit-b8be028a309381b83abe924f5e8e01cf02b121a2.tar.bz2 |
Add more menuitems on repo pages
In an attempt to get better usability, a set of 'semistatic' menuitems
are added to the page header on all pages except the repository index.
The menuitems (summary, log, files, commit and diff) honours the current
branch and revision. To switch the current branch one can use the branch
links on the summary page.
The backlink to the repository index page is now available by clicking
the static page heading.
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
-rw-r--r-- | ui-shared.c | 35 |
1 files changed, 29 insertions, 6 deletions
diff --git a/ui-shared.c b/ui-shared.c index 15d8254..383b8ac 100644 --- a/ui-shared.c +++ b/ui-shared.c | |||
@@ -110,22 +110,26 @@ static char *repolink(char *title, char *class, char *page, char *head, | |||
110 | html("/"); | 110 | html("/"); |
111 | html_attr(cgit_repo->url); | 111 | html_attr(cgit_repo->url); |
112 | if (cgit_repo->url[strlen(cgit_repo->url) - 1] != '/') | 112 | if (cgit_repo->url[strlen(cgit_repo->url) - 1] != '/') |
113 | html("/"); | 113 | html("/"); |
114 | if (page) { | ||
114 | html(page); | 115 | html(page); |
115 | html("/"); | 116 | html("/"); |
116 | if (path) | 117 | if (path) |
117 | html_attr(path); | 118 | html_attr(path); |
119 | } | ||
118 | } else { | 120 | } else { |
119 | html(cgit_script_name); | 121 | html(cgit_script_name); |
120 | html("?url="); | 122 | html("?url="); |
121 | html_attr(cgit_repo->url); | 123 | html_attr(cgit_repo->url); |
122 | if (cgit_repo->url[strlen(cgit_repo->url) - 1] != '/') | 124 | if (cgit_repo->url[strlen(cgit_repo->url) - 1] != '/') |
123 | html("/"); | 125 | html("/"); |
126 | if (page) { | ||
124 | html(page); | 127 | html(page); |
125 | html("/"); | 128 | html("/"); |
126 | if (path) | 129 | if (path) |
127 | html_attr(path); | 130 | html_attr(path); |
131 | } | ||
128 | delim = "&"; | 132 | delim = "&"; |
129 | } | 133 | } |
130 | if (head && strcmp(head, cgit_repo->defbranch)) { | 134 | if (head && strcmp(head, cgit_repo->defbranch)) { |
131 | html(delim); | 135 | html(delim); |
@@ -278,21 +282,40 @@ void cgit_print_docend() | |||
278 | 282 | ||
279 | void cgit_print_pageheader(char *title, int show_search) | 283 | void cgit_print_pageheader(char *title, int show_search) |
280 | { | 284 | { |
281 | html("<table id='layout'>"); | 285 | html("<table id='layout'>"); |
282 | html("<tr><td id='header'>"); | 286 | html("<tr><td id='header'><a href='"); |
283 | html(cgit_root_title); | 287 | html_attr(cgit_rooturl()); |
284 | html("</td><td id='logo'>"); | 288 | html("'>"); |
289 | html_txt(cgit_root_title); | ||
290 | html("</a></td><td id='logo'>"); | ||
285 | html("<a href='"); | 291 | html("<a href='"); |
286 | html_attr(cgit_logo_link); | 292 | html_attr(cgit_logo_link); |
287 | htmlf("'><img src='%s' alt='logo'/></a>", cgit_logo); | 293 | htmlf("'><img src='%s' alt='logo'/></a>", cgit_logo); |
288 | html("</td></tr>"); | 294 | html("</td></tr>"); |
289 | html("<tr><td id='crumb'>"); | 295 | html("<tr><td id='crumb'>"); |
290 | htmlf("<a href='%s'>root</a>", cgit_rooturl()); | ||
291 | if (cgit_query_repo) { | 296 | if (cgit_query_repo) { |
292 | htmlf(" : <a href='%s'>", cgit_repourl(cgit_repo->url)); | ||
293 | html_txt(cgit_repo->name); | 297 | html_txt(cgit_repo->name); |
294 | htmlf("</a> : %s", title); | 298 | html(" ("); |
299 | html_txt(cgit_query_head); | ||
300 | html(") : "); | ||
301 | reporevlink(NULL, "summary", NULL, NULL, cgit_query_head, | ||
302 | NULL, NULL); | ||
303 | html(" "); | ||
304 | cgit_log_link("log", NULL, NULL, cgit_query_head, | ||
305 | cgit_query_sha1, cgit_query_path); | ||
306 | html(" "); | ||
307 | cgit_tree_link("files", NULL, NULL, cgit_query_head, | ||
308 | cgit_query_sha1, cgit_query_path); | ||
309 | html(" "); | ||
310 | cgit_commit_link("commit", NULL, NULL, cgit_query_head, | ||
311 | cgit_query_sha1); | ||
312 | html(" "); | ||
313 | cgit_diff_link("diff", NULL, NULL, cgit_query_head, | ||
314 | cgit_query_sha1, cgit_query_sha2, | ||
315 | cgit_query_path); | ||
316 | } else { | ||
317 | html_txt("Index of repositories"); | ||
295 | } | 318 | } |
296 | html("</td>"); | 319 | html("</td>"); |
297 | html("<td id='search'>"); | 320 | html("<td id='search'>"); |
298 | if (show_search) { | 321 | if (show_search) { |