author | Lars Hjemli <hjemli@gmail.com> | 2007-05-20 22:14:28 (UTC) |
---|---|---|
committer | Lars Hjemli <hjemli@gmail.com> | 2007-05-20 22:14:28 (UTC) |
commit | 0b8b6a317654dce2aa8c7ec5bf55717f624af14f (patch) (unidiff) | |
tree | b70074d13e56ac8e1e9162e13be554802e46e8ba /ui-repolist.c | |
parent | 271ac5a7e6b5b67f54fdd16e8542aa282f1c7140 (diff) | |
download | cgit-0b8b6a317654dce2aa8c7ec5bf55717f624af14f.zip cgit-0b8b6a317654dce2aa8c7ec5bf55717f624af14f.tar.gz cgit-0b8b6a317654dce2aa8c7ec5bf55717f624af14f.tar.bz2 |
Make frontpage friendlier
This is an attempt to make the index page more usable by changing how
repo groups and repo links are displayed.
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
-rw-r--r-- | ui-repolist.c | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/ui-repolist.c b/ui-repolist.c index 33e3e7f..f5e087f 100644 --- a/ui-repolist.c +++ b/ui-repolist.c | |||
@@ -1,68 +1,66 @@ | |||
1 | /* ui-repolist.c: functions for generating the repolist page | 1 | /* ui-repolist.c: functions for generating the repolist page |
2 | * | 2 | * |
3 | * Copyright (C) 2006 Lars Hjemli | 3 | * Copyright (C) 2006 Lars Hjemli |
4 | * | 4 | * |
5 | * Licensed under GNU General Public License v2 | 5 | * Licensed under GNU General Public License v2 |
6 | * (see COPYING for full license text) | 6 | * (see COPYING for full license text) |
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include "cgit.h" | 9 | #include "cgit.h" |
10 | 10 | ||
11 | void cgit_print_repolist(struct cacheitem *item) | 11 | void cgit_print_repolist(struct cacheitem *item) |
12 | { | 12 | { |
13 | struct repoinfo *repo; | 13 | struct repoinfo *repo; |
14 | int i; | 14 | int i; |
15 | char *last_group = NULL; | 15 | char *last_group = NULL; |
16 | 16 | ||
17 | cgit_print_docstart(cgit_root_title, item); | 17 | cgit_print_docstart(cgit_root_title, item); |
18 | cgit_print_pageheader(cgit_root_title, 0); | 18 | cgit_print_pageheader(cgit_root_title, 0); |
19 | 19 | ||
20 | html("<table class='list nowrap'>"); | 20 | html("<table class='list nowrap'>"); |
21 | if (cgit_index_header) { | 21 | if (cgit_index_header) { |
22 | html("<tr class='nohover'><td colspan='4' class='include-block'>"); | 22 | html("<tr class='nohover'><td colspan='4' class='include-block'>"); |
23 | html_include(cgit_index_header); | 23 | html_include(cgit_index_header); |
24 | html("</td></tr>"); | 24 | html("</td></tr>"); |
25 | } | 25 | } |
26 | html("<tr class='nohover'>" | 26 | html("<tr class='nohover'>" |
27 | "<th class='left'>Name</th>" | 27 | "<th class='left'>Name</th>" |
28 | "<th class='left'>Description</th>" | 28 | "<th class='left'>Description</th>" |
29 | "<th class='left'>Owner</th>" | 29 | "<th class='left'>Owner</th>" |
30 | "<th class='left'>Links</th></tr>\n"); | 30 | "<th>Links</th></tr>\n"); |
31 | 31 | ||
32 | for (i=0; i<cgit_repolist.count; i++) { | 32 | for (i=0; i<cgit_repolist.count; i++) { |
33 | repo = &cgit_repolist.repos[i]; | 33 | repo = &cgit_repolist.repos[i]; |
34 | if ((last_group == NULL && repo->group != NULL) || | 34 | if ((last_group == NULL && repo->group != NULL) || |
35 | (last_group != NULL && repo->group == NULL) || | 35 | (last_group != NULL && repo->group == NULL) || |
36 | (last_group != NULL && repo->group!= NULL && | 36 | (last_group != NULL && repo->group!= NULL && |
37 | strcmp(repo->group, last_group))) { | 37 | strcmp(repo->group, last_group))) { |
38 | html("<tr class='nohover'><td colspan='4' class='repogroup'>"); | 38 | html("<tr class='nohover'><td colspan='4' class='repogroup'>"); |
39 | html_txt(repo->group); | 39 | html_txt(repo->group); |
40 | html("</td></tr>"); | 40 | html("</td></tr>"); |
41 | last_group = repo->group; | 41 | last_group = repo->group; |
42 | } | 42 | } |
43 | html("<tr><td>"); | 43 | htmlf("<tr><td class='%s'>", |
44 | html_link_open(cgit_repourl(repo->url), NULL, NULL); | 44 | repo->group ? "sublevel-repo" : "toplevel-repo"); |
45 | html_link_open(cgit_repourl(repo->url), repo->desc, NULL); | ||
45 | html_txt(repo->name); | 46 | html_txt(repo->name); |
46 | html_link_close(); | 47 | html_link_close(); |
47 | html("</td><td>"); | 48 | html("</td><td>"); |
48 | html_ntxt(cgit_max_repodesc_len, repo->desc); | 49 | html_ntxt(cgit_max_repodesc_len, repo->desc); |
49 | html("</td><td>"); | 50 | html("</td><td>"); |
50 | html_txt(repo->owner); | 51 | html_txt(repo->owner); |
51 | html("</td><td>"); | 52 | html("</td><td>"); |
52 | html_link_open(cgit_pageurl(repo->name, "commit", NULL), | 53 | html_link_open(cgit_repourl(repo->url), |
53 | "Commit: display last commit", NULL); | 54 | "Summary", "button"); |
54 | html("C</a> "); | 55 | html("S</a>"); |
55 | html_link_open(cgit_pageurl(repo->name, "diff", NULL), | ||
56 | "Diff: see changes introduced by last commit", NULL); | ||
57 | html("D</a> "); | ||
58 | html_link_open(cgit_pageurl(repo->name, "log", NULL), | 56 | html_link_open(cgit_pageurl(repo->name, "log", NULL), |
59 | "Log: show history of the main branch", NULL); | 57 | "Log", "button"); |
60 | html("L</a> "); | 58 | html("L</a>"); |
61 | html_link_open(cgit_pageurl(repo->name, "tree", NULL), | 59 | html_link_open(cgit_pageurl(repo->name, "tree", NULL), |
62 | "Tree: browse the files in the main branch", NULL); | 60 | "Files", "button"); |
63 | html("T</a>"); | 61 | html("F</a>"); |
64 | html("</td></tr>\n"); | 62 | html("</td></tr>\n"); |
65 | } | 63 | } |
66 | html("</table>"); | 64 | html("</table>"); |
67 | cgit_print_docend(); | 65 | cgit_print_docend(); |
68 | } | 66 | } |