diff options
Diffstat (limited to 'ui-repolist.c')
-rw-r--r-- | ui-repolist.c | 66 |
1 files changed, 36 insertions, 30 deletions
diff --git a/ui-repolist.c b/ui-repolist.c index e5c6c20..4c86543 100644 --- a/ui-repolist.c +++ b/ui-repolist.c | |||
@@ -44,16 +44,19 @@ static void print_modtime(struct repoinfo *repo) | |||
44 | 44 | ||
45 | void cgit_print_repolist(struct cacheitem *item) | 45 | void cgit_print_repolist(struct cacheitem *item) |
46 | { | 46 | { |
47 | struct repoinfo *repo; | 47 | int i, columns = 4; |
48 | int i; | ||
49 | char *last_group = NULL; | 48 | char *last_group = NULL; |
50 | 49 | ||
50 | if (cgit_enable_index_links) | ||
51 | columns++; | ||
52 | |||
51 | cgit_print_docstart(cgit_root_title, item); | 53 | cgit_print_docstart(cgit_root_title, item); |
52 | cgit_print_pageheader(cgit_root_title, 0); | 54 | cgit_print_pageheader(cgit_root_title, 0); |
53 | 55 | ||
54 | html("<table class='list nowrap'>"); | 56 | html("<table class='list nowrap'>"); |
55 | if (cgit_index_header) { | 57 | if (cgit_index_header) { |
56 | html("<tr class='nohover'><td colspan='5' class='include-block'>"); | 58 | htmlf("<tr class='nohover'><td colspan='%d' class='include-block'>", |
59 | columns); | ||
57 | html_include(cgit_index_header); | 60 | html_include(cgit_index_header); |
58 | html("</td></tr>"); | 61 | html("</td></tr>"); |
59 | } | 62 | } |
@@ -61,42 +64,45 @@ void cgit_print_repolist(struct cacheitem *item) | |||
61 | "<th class='left'>Name</th>" | 64 | "<th class='left'>Name</th>" |
62 | "<th class='left'>Description</th>" | 65 | "<th class='left'>Description</th>" |
63 | "<th class='left'>Owner</th>" | 66 | "<th class='left'>Owner</th>" |
64 | "<th class='left'>Idle</th>" | 67 | "<th class='left'>Idle</th>"); |
65 | "<th>Links</th></tr>\n"); | 68 | if (cgit_enable_index_links) |
69 | html("<th>Links</th>"); | ||
70 | html("</tr>\n"); | ||
66 | 71 | ||
67 | for (i=0; i<cgit_repolist.count; i++) { | 72 | for (i=0; i<cgit_repolist.count; i++) { |
68 | repo = &cgit_repolist.repos[i]; | 73 | cgit_repo = &cgit_repolist.repos[i]; |
69 | if ((last_group == NULL && repo->group != NULL) || | 74 | if ((last_group == NULL && cgit_repo->group != NULL) || |
70 | (last_group != NULL && repo->group == NULL) || | 75 | (last_group != NULL && cgit_repo->group == NULL) || |
71 | (last_group != NULL && repo->group!= NULL && | 76 | (last_group != NULL && cgit_repo->group != NULL && |
72 | strcmp(repo->group, last_group))) { | 77 | strcmp(cgit_repo->group, last_group))) { |
73 | html("<tr class='nohover'><td colspan='4' class='repogroup'>"); | 78 | htmlf("<tr class='nohover'><td colspan='%d' class='repogroup'>", |
74 | html_txt(repo->group); | 79 | columns); |
80 | html_txt(cgit_repo->group); | ||
75 | html("</td></tr>"); | 81 | html("</td></tr>"); |
76 | last_group = repo->group; | 82 | last_group = cgit_repo->group; |
77 | } | 83 | } |
78 | htmlf("<tr><td class='%s'>", | 84 | htmlf("<tr><td class='%s'>", |
79 | repo->group ? "sublevel-repo" : "toplevel-repo"); | 85 | cgit_repo->group ? "sublevel-repo" : "toplevel-repo"); |
80 | html_link_open(cgit_repourl(repo->url), repo->desc, NULL); | 86 | html_link_open(cgit_repourl(cgit_repo->url), NULL, NULL); |
81 | html_txt(repo->name); | 87 | html_txt(cgit_repo->name); |
82 | html_link_close(); | 88 | html_link_close(); |
83 | html("</td><td>"); | 89 | html("</td><td>"); |
84 | html_ntxt(cgit_max_repodesc_len, repo->desc); | 90 | html_ntxt(cgit_max_repodesc_len, cgit_repo->desc); |
85 | html("</td><td>"); | ||
86 | html_txt(repo->owner); | ||
87 | html("</td><td>"); | 91 | html("</td><td>"); |
88 | print_modtime(repo); | 92 | html_txt(cgit_repo->owner); |
89 | html("</td><td>"); | 93 | html("</td><td>"); |
90 | html_link_open(cgit_repourl(repo->url), | 94 | print_modtime(cgit_repo); |
91 | "Summary", "button"); | 95 | html("</td>"); |
92 | html("S</a>"); | 96 | if (cgit_enable_index_links) { |
93 | html_link_open(cgit_pageurl(repo->name, "log", NULL), | 97 | html("<td>"); |
94 | "Log", "button"); | 98 | html_link_open(cgit_repourl(cgit_repo->url), |
95 | html("L</a>"); | 99 | NULL, "button"); |
96 | html_link_open(cgit_pageurl(repo->name, "tree", NULL), | 100 | html("summary</a>"); |
97 | "Files", "button"); | 101 | cgit_log_link("log", NULL, "button", NULL, NULL, NULL, 0); |
98 | html("F</a>"); | 102 | cgit_tree_link("tree", NULL, "button", NULL, NULL, NULL); |
99 | html("</td></tr>\n"); | 103 | html("</td>"); |
104 | } | ||
105 | html("</tr>\n"); | ||
100 | } | 106 | } |
101 | html("</table>"); | 107 | html("</table>"); |
102 | cgit_print_docend(); | 108 | cgit_print_docend(); |