diff options
-rw-r--r-- | ui-log.c | 22 | ||||
-rw-r--r-- | ui-refs.c | 40 | ||||
-rw-r--r-- | ui-repolist.c | 10 | ||||
-rw-r--r-- | ui-shared.c | 240 | ||||
-rw-r--r-- | ui-summary.c | 16 |
5 files changed, 189 insertions, 139 deletions
@@ -63,30 +63,30 @@ void show_commit_decorations(struct commit *commit) while (deco) { if (!prefixcmp(deco->name, "refs/heads/")) { strncpy(buf, deco->name + 11, sizeof(buf) - 1); - cgit_log_link(buf, NULL, "branch-deco", buf, NULL, + cgit_log_link(buf, NULL, "label label-info", buf, NULL, ctx.qry.vpath, 0, NULL, NULL, ctx.qry.showmsg); } else if (!prefixcmp(deco->name, "tag: refs/tags/")) { strncpy(buf, deco->name + 15, sizeof(buf) - 1); - cgit_tag_link(buf, NULL, "tag-deco", ctx.qry.head, buf); + cgit_tag_link(buf, NULL, "label label-success", ctx.qry.head, buf); } else if (!prefixcmp(deco->name, "refs/tags/")) { strncpy(buf, deco->name + 10, sizeof(buf) - 1); - cgit_tag_link(buf, NULL, "tag-deco", ctx.qry.head, buf); + cgit_tag_link(buf, NULL, "label label-success", ctx.qry.head, buf); } else if (!prefixcmp(deco->name, "refs/remotes/")) { if (!ctx.repo->enable_remote_branches) goto next; strncpy(buf, deco->name + 13, sizeof(buf) - 1); - cgit_log_link(buf, NULL, "remote-deco", NULL, + cgit_log_link(buf, NULL, "label label-inverse", NULL, sha1_to_hex(commit->object.sha1), ctx.qry.vpath, 0, NULL, NULL, ctx.qry.showmsg); } else { strncpy(buf, deco->name, sizeof(buf) - 1); - cgit_commit_link(buf, NULL, "deco", ctx.qry.head, + cgit_commit_link(buf, NULL, "label", ctx.qry.head, sha1_to_hex(commit->object.sha1), ctx.qry.vpath, 0); } @@ -364,8 +364,8 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern if (commit_graph) html("<th></th>"); else - html("<th class='left'>Age</th>"); - html("<th class='left'>Commit message"); + html("<th class='left span2'>Age</th>"); + html("<th class='left span6'>Commit message"); if (pager) { html(" ("); cgit_log_link(ctx.qry.showmsg ? "Collapse" : "Expand", NULL, @@ -374,15 +374,15 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern ctx.qry.search, ctx.qry.showmsg ? 0 : 1); html(")"); } - html("</th><th class='left'>Author</th>"); + html("</th><th class='left span2'>Author</th>"); if (commit_graph) - html("<th class='left'>Age</th>"); + html("<th class='left span2'>Age</th>"); if (ctx.repo->enable_log_filecount) { - html("<th class='left'>Files</th>"); + html("<th class='left span1'>Files</th>"); columns++; } if (ctx.repo->enable_log_linecount) { - html("<th class='left'>Lines</th>"); + html("<th class='left span1'>Lines</th>"); columns++; } html("</tr>\n"); @@ -79,7 +79,7 @@ static int print_branch(struct refinfo *ref) cgit_commit_link(info->subject, NULL, NULL, name, NULL, NULL, 0); html("</td><td>"); html_txt(info->author); - html("</td><td colspan='2'>"); + html("</td><td>"); cgit_print_age(info->commit->date, -1, NULL); } else { html("</td><td></td><td>"); @@ -91,10 +91,10 @@ static int print_branch(struct refinfo *ref) static void print_tag_header() { - html("<tr class='nohover'><th class='left'>Tag</th>" - "<th class='left'>Download</th>" - "<th class='left'>Author</th>" - "<th class='left' colspan='2'>Age</th></tr>\n"); + html("<tr class='nohover'><th class='left span1'>Tag</th>" + "<th class='left span7'>Download</th>" + "<th class='left span2'>Author</th>" + "<th class='left span2'>Age</th></tr>\n"); header = 1; } @@ -144,7 +144,7 @@ static int print_tag(struct refinfo *ref) html("</td><td>"); if (info->tagger) html(info->tagger); - html("</td><td colspan='2'>"); + html("</td><td>"); if (info->tagger_date > 0) cgit_print_age(info->tagger_date, -1, NULL); html("</td></tr>\n"); @@ -181,10 +181,10 @@ void cgit_print_branches(int maxcount) struct reflist list; int i; - html("<tr class='nohover'><th class='left'>Branch</th>" - "<th class='left'>Commit message</th>" - "<th class='left'>Author</th>" - "<th class='left' colspan='2'>Age</th></tr>\n"); + html("<tr class='nohover'><th class='left span2'>Branch</th>" + "<th class='left span6'>Commit message</th>" + "<th class='left span2'>Author</th>" + "<th class='left span2'>Age</th></tr>\n"); list.refs = NULL; list.alloc = list.count = 0; @@ -218,6 +218,9 @@ void cgit_print_tags(int maxcount) for_each_tag_ref(cgit_refs_cb, &list); if (list.count == 0) return; + + html("<h2>Tags</h2>"); + html("<table summary='repository info' class='table table-striped'>"); qsort(list.refs, list.count, sizeof(*list.refs), cmp_tag_age); if (!maxcount) maxcount = list.count; @@ -229,21 +232,24 @@ void cgit_print_tags(int maxcount) if (maxcount < list.count) print_refs_link("tags"); + html("</table>"); } void cgit_print_refs() { - - html("<table class='list nowrap'>"); - - if (ctx.qry.path && !strncmp(ctx.qry.path, "heads", 5)) + if (ctx.qry.path && !strncmp(ctx.qry.path, "heads", 5)) { + html("<h2>Branches</h2>\n"); + html("<table class='list nowrap table'>"); cgit_print_branches(0); + html("</table>"); + } else if (ctx.qry.path && !strncmp(ctx.qry.path, "tags", 4)) cgit_print_tags(0); else { + html("<h2>Branches</h2>\n"); + html("<table class='list nowrap table'>"); cgit_print_branches(0); - html("<tr class='nohover'><td colspan='4'> </td></tr>"); - cgit_print_tags(0); + html("</table>"); + cgit_print_tags(0); } - html("</table>"); } diff --git a/ui-repolist.c b/ui-repolist.c index dead1bf..cf64460 100644 --- a/ui-repolist.c +++ b/ui-repolist.c @@ -115,7 +115,6 @@ void print_header(int columns) html("<tr class='nohover'>"); print_sort_header("Name", "name"); print_sort_header("Description", "desc"); - print_sort_header("Owner", "owner"); print_sort_header("Idle", "idle"); if (ctx.cfg.enable_index_links) html("<th class='left'>Links</th>"); @@ -217,7 +216,6 @@ struct sortcolumn sortcolumn[] = { {"section", sort_section}, {"name", sort_name}, {"desc", sort_desc}, - {"owner", sort_owner}, {"idle", sort_idle}, {NULL, NULL} }; @@ -260,7 +258,7 @@ void cgit_print_repolist() else if (ctx.cfg.section_sort) sort_repolist("section"); - html("<table summary='repository list' class='list nowrap'>"); + html("<table summary='repository list' class='table table-condensed table-striped table-hover'>"); for (i=0; i<cgit_repolist.count; i++) { ctx.repo = &cgit_repolist.repos[i]; if (!(is_match(ctx.repo) && is_in_url(ctx.repo))) @@ -280,10 +278,10 @@ void cgit_print_repolist() (last_section != NULL && section == NULL) || (last_section != NULL && section != NULL && strcmp(section, last_section)))) { - htmlf("<tr class='nohover'><td colspan='%d' class='reposection'>", + htmlf("<tr class='nohover'><th colspan='%d' class='reposection'>", columns); html_txt(section); - html("</td></tr>"); + html("</th></tr>"); last_section = section; } htmlf("<tr><td class='%s'>", @@ -294,8 +292,6 @@ void cgit_print_repolist() html_ntxt(ctx.cfg.max_repodesc_len, ctx.repo->desc); html_link_close(); html("</td><td>"); - html_txt(ctx.repo->owner); - html("</td><td>"); print_modtime(ctx.repo); html("</td>"); if (ctx.cfg.enable_index_links) { diff --git a/ui-shared.c b/ui-shared.c index 75b97a1..6ed1bd4 100644 --- a/ui-shared.c +++ b/ui-shared.c @@ -11,8 +11,7 @@ #include "html.h" const char cgit_doctype[] = -"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n" -" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n"; + "<!DOCTYPE html>\n"; static char *http_date(time_t t) { @@ -198,7 +197,7 @@ static char *repolink(const char *title, const char *class, const char *page, { char *delim = "?"; - html("<a"); + html(" <a"); if (title) { html(" title='"); html_attr(title); @@ -686,7 +685,7 @@ void cgit_print_docstart(struct cgit_context *ctx) fmt("h=%s", ctx->qry.head))); html("' type='application/atom+xml'/>\n"); } - if (ctx->cfg.head_include) + if (ctx->cfg.head_include) html_include(ctx->cfg.head_include); html("</head>\n"); html("<body>\n"); @@ -803,147 +802,190 @@ static void cgit_print_path_crumbs(struct cgit_context *ctx, char *path) char *old_path = ctx->qry.path; char *p = path, *q, *end = path + strlen(path); + html("<ul class='breadcrumb'>"); + html("<li>"); + ctx->qry.path = NULL; cgit_self_link("root", NULL, NULL, ctx); + ctx->qry.path = p = path; while (p < end) { if (!(q = strchr(p, '/'))) q = end; *q = '\0'; - html_txt("/"); + html(" <span class='divider'>/</span></li><li>"); cgit_self_link(p, NULL, NULL, ctx); if (q < end) *q = '/'; p = q + 1; } + html("</li></ul>"); ctx->qry.path = old_path; } static void print_header(struct cgit_context *ctx) { - char *logo = NULL, *logo_link = NULL; + /* char *logo = NULL, *logo_link = NULL; */ - html("<table id='header'>\n"); - html("<tr>\n"); + html("<div class='navbar'>\n"); + html("<div class='navbar-inner'>\n"); - if (ctx->repo && ctx->repo->logo && *ctx->repo->logo) - logo = ctx->repo->logo; - else - logo = ctx->cfg.logo; - if (ctx->repo && ctx->repo->logo_link && *ctx->repo->logo_link) - logo_link = ctx->repo->logo_link; - else - logo_link = ctx->cfg.logo_link; - if (logo && *logo) { - html("<td class='logo' rowspan='2'><a href='"); - if (logo_link && *logo_link) - html_attr(logo_link); - else - html_attr(cgit_rooturl()); - html("'><img src='"); - html_attr(logo); - html("' alt='cgit logo'/></a></td>\n"); - } + html("<a class='brand' href='http://code.ryuslash.org/'>"); + html_txt("ryuslash/code"); + html("</a>"); - html("<td class='main'>"); - if (ctx->repo) { - cgit_index_link("index", NULL, NULL, NULL, NULL, 0); - html(" : "); - cgit_summary_link(ctx->repo->name, ctx->repo->name, NULL, NULL); - html("</td><td class='form'>"); - html("<form method='get' action=''>\n"); + if (ctx->repo) { + html("<form method='get' action='' class='navbar-form pull-right'>\n"); cgit_add_hidden_formfields(0, 1, ctx->qry.page); - html("<select name='h' onchange='this.form.submit();'>\n"); + html("<select class='input-small' name='h' onchange='this.form.submit();'>\n"); for_each_branch_ref(print_branch_option, ctx->qry.head); html("</select> "); - html("<input type='submit' name='' value='switch'/>"); + html("<input class='btn' type='submit' name='' value='switch'/>"); html("</form>"); - } else - html_txt(ctx->cfg.root_title); - html("</td></tr>\n"); + } - html("<tr><td class='sub'>"); - if (ctx->repo) { - html_txt(ctx->repo->desc); - html("</td><td class='sub right'>"); - html_txt(ctx->repo->owner); - } else { - if (ctx->cfg.root_desc) - html_txt(ctx->cfg.root_desc); - else if (ctx->cfg.index_info) - html_include(ctx->cfg.index_info); - } - html("</td></tr></table>\n"); -} + html("</div>\n"); + html("</div>\n"); -void cgit_print_pageheader(struct cgit_context *ctx) -{ - html("<div id='cgit'>"); - if (!ctx->cfg.noheader) - print_header(ctx); - - html("<table class='tabs'><tr><td>\n"); - if (ctx->repo) { - cgit_summary_link("summary", NULL, hc(ctx, "summary"), - ctx->qry.head); - cgit_refs_link("refs", NULL, hc(ctx, "refs"), ctx->qry.head, - ctx->qry.sha1, NULL); - cgit_log_link("log", NULL, hc(ctx, "log"), ctx->qry.head, - NULL, ctx->qry.vpath, 0, NULL, NULL, - ctx->qry.showmsg); - cgit_tree_link("tree", NULL, hc(ctx, "tree"), ctx->qry.head, - ctx->qry.sha1, ctx->qry.vpath); - cgit_commit_link("commit", NULL, hc(ctx, "commit"), - ctx->qry.head, ctx->qry.sha1, ctx->qry.vpath, 0); - cgit_diff_link("diff", NULL, hc(ctx, "diff"), ctx->qry.head, - ctx->qry.sha1, ctx->qry.sha2, ctx->qry.vpath, 0); - if (ctx->repo->max_stats) - cgit_stats_link("stats", NULL, hc(ctx, "stats"), - ctx->qry.head, ctx->qry.vpath); - if (ctx->repo->readme) - reporevlink("about", "about", NULL, - hc(ctx, "about"), ctx->qry.head, NULL, - NULL); - html("</td><td class='form'>"); - html("<form class='right' method='get' action='"); + if (ctx->repo) { + html("<form class='form-inline pull-right' method='get' action='"); if (ctx->cfg.virtual_root) html_url_path(cgit_fileurl(ctx->qry.repo, "log", - ctx->qry.vpath, NULL)); + ctx->qry.vpath, NULL)); html("'>\n"); cgit_add_hidden_formfields(1, 0, "log"); - html("<select name='qt'>\n"); + html("<select class='input-small' name='qt'>\n"); html_option("grep", "log msg", ctx->qry.grep); html_option("author", "author", ctx->qry.grep); html_option("committer", "committer", ctx->qry.grep); html_option("range", "range", ctx->qry.grep); html("</select>\n"); - html("<input class='txt' type='text' size='10' name='q' value='"); + html("<input class='input-small' type='text' size='10' name='q' value='"); html_attr(ctx->qry.search); html("'/>\n"); - html("<input type='submit' value='search'/>\n"); + html("<input class='btn' type='submit' value='search'/>\n"); html("</form>\n"); - } else { - site_link(NULL, "index", NULL, hc(ctx, "repolist"), NULL, NULL, 0); - if (ctx->cfg.root_readme) - site_link("about", "about", NULL, hc(ctx, "about"), - NULL, NULL, 0); - html("</td><td class='form'>"); - html("<form method='get' action='"); + } + else { + html("<form class='form-inline pull-right' method='get' action='"); html_attr(cgit_rooturl()); html("'>\n"); - html("<input type='text' name='q' size='10' value='"); + html("<input class='small-input' type='text' name='q' size='10' value='"); html_attr(ctx->qry.search); html("'/>\n"); - html("<input type='submit' value='search'/>\n"); + html("<input class='btn' type='submit' value='search'/>\n"); html("</form>"); + } + + html("<h1 class='page-header'>"); + if (ctx->repo) + html_txt(ctx->repo->name); + else + html_txt(ctx->cfg.root_title); + + html(" <small>"); + if (ctx->repo) + html_txt(ctx->repo->desc); + else if (ctx->cfg.root_desc) + html_txt(ctx->cfg.root_desc); + html("</small>"); + html("</h1>"); + + /* if (ctx->repo && ctx->repo->logo && *ctx->repo->logo) */ + /* logo = ctx->repo->logo; */ + /* else */ + /* logo = ctx->cfg.logo; */ + /* if (ctx->repo && ctx->repo->logo_link && *ctx->repo->logo_link) */ + /* logo_link = ctx->repo->logo_link; */ + /* else */ + /* logo_link = ctx->cfg.logo_link; */ + /* if (logo && *logo) { */ + /* html("<td class='logo' rowspan='2'><a href='"); */ + /* if (logo_link && *logo_link) */ + /* html_attr(logo_link); */ + /* else */ + /* html_attr(cgit_rooturl()); */ + /* html("'><img src='"); */ + /* html_attr(logo); */ + /* html("' alt='cgit logo'/></a></td>\n"); */ + /* } */ +} + +void cgit_print_pageheader(struct cgit_context *ctx) +{ + html("<div id='cgit' class='container'>"); + if (!ctx->cfg.noheader) + print_header(ctx); + + html("<ul class='nav nav-tabs'>"); + if (ctx->repo) { + htmlf("<li class='%s'>", hc(ctx, "summary")); + cgit_summary_link("summary", NULL, NULL, ctx->qry.head); + html("</li>"); + + htmlf("<li class='%s'>", hc(ctx, "refs")); + cgit_refs_link("refs", NULL, NULL, ctx->qry.head, ctx->qry.sha1, + NULL); + html("</li>"); + + htmlf("<li class='%s'>", hc(ctx, "log")); + cgit_log_link("log", NULL, NULL, ctx->qry.head, NULL, + ctx->qry.vpath, 0, NULL, NULL, ctx->qry.showmsg); + html("</li>"); + + htmlf("<li class='%s'>", hc(ctx, "tree")); + cgit_tree_link("tree", NULL, NULL, ctx->qry.head, ctx->qry.sha1, + ctx->qry.vpath); + html("</li>"); + + htmlf("<li class='%s'>", hc(ctx, "commit")); + cgit_commit_link("commit", NULL, NULL, ctx->qry.head, + ctx->qry.sha1, ctx->qry.vpath, 0); + html("</li>"); + + htmlf("<li class='%s'>", hc(ctx, "diff")); + cgit_diff_link("diff", NULL, NULL, ctx->qry.head, ctx->qry.sha1, + ctx->qry.sha2, ctx->qry.vpath, 0); + html("</li>"); + + if (ctx->repo->max_stats) { + htmlf("<li class='%s'>", hc(ctx, "stats")); + cgit_stats_link("stats", NULL, NULL, ctx->qry.head, + ctx->qry.vpath); + html("</li>"); + } + + if (ctx->repo->readme) { + htmlf("<li class='%s'>", hc(ctx, "about")); + reporevlink("about", "about", NULL, NULL, ctx->qry.head, + NULL, NULL); + html("</li>"); + } + } + else { + htmlf("<li class='%s'>", hc(ctx, "repolist")); + site_link(NULL, "index", NULL, NULL, NULL, NULL, 0); + html("</li>"); + + if (ctx->cfg.root_readme) { + htmlf("<li class='%s'>", hc(ctx, "about")); + site_link("about", "about", NULL, NULL, NULL, NULL, 0); + html("</li>"); + } + } + html("</ul>"); + + + html("<table class='tabs'><tr><td>\n"); + if (ctx->repo) { + html("</td><td class='form'>"); + } else { + html("</td><td class='form'>"); } html("</td></tr></table>\n"); - if (ctx->qry.vpath) { - html("<div class='path'>"); - html("path: "); + if (ctx->qry.vpath) cgit_print_path_crumbs(ctx, ctx->qry.vpath); - html("</div>"); - } + html("<div class='content'>"); } diff --git a/ui-summary.c b/ui-summary.c index b4fdd57..1de6610 100644 --- a/ui-summary.c +++ b/ui-summary.c @@ -20,7 +20,6 @@ static void print_url(char *base, char *suffix) if (!base || !*base) return; if (urls++ == 0) { - html("<tr class='nohover'><td colspan='4'> </td></tr>"); html("<tr><th class='left' colspan='4'>Clone</th></tr>\n"); } if (suffix && *suffix) @@ -52,15 +51,22 @@ static void print_urls(char *txt, char *suffix) void cgit_print_summary() { - html("<table summary='repository info' class='list nowrap'>"); + html("<h2>Branches</h2>"); + html("<table summary='repository info' class='table table-striped'>"); cgit_print_branches(ctx.cfg.summary_branches); - html("<tr class='nohover'><td colspan='4'> </td></tr>"); + html("</table>"); + cgit_print_tags(ctx.cfg.summary_tags); + if (ctx.cfg.summary_log > 0) { - html("<tr class='nohover'><td colspan='4'> </td></tr>"); + html("<h2>Log</h2>"); + html("<table summary='repository info' class='table table-striped'>"); cgit_print_log(ctx.qry.head, 0, ctx.cfg.summary_log, NULL, - NULL, NULL, 0, 0, 0); + NULL, NULL, 0, 0, 0); + html("</table>"); } + + html("<table summary='repository info' class='table table-striped'>"); if (ctx.repo->clone_url) print_urls(expand_macros(ctx.repo->clone_url), NULL); else if (ctx.cfg.clone_prefix) |