neocgit

a more 'modern' version of cgit
Log | Files | Refs | Submodules | README | LICENSE | git clone https://git.ne02ptzero.me/git/neocgit

commit b0d3feba748338ebe3fe82a86361be7c85530660
parent afb66a4a4694b37629b1f8895e617059683a0cea
Author: Louis Solofrizzo <lsolofrizzo@online.net>
Date:   Sat, 29 Sep 2018 19:05:26 +0200

Menu: Menu is now more minimalist, with less space

Signed-off-by: Louis Solofrizzo <lsolofrizzo@online.net>

Diffstat:
Mcgit.css | 158+++++++++++++++++++++++++++++++++----------------------------------------------
Mui-repolist.c | 3---
Mui-shared.c | 123++++++++++++++++++-------------------------------------------------------------
Mui-summary.c | 2++
4 files changed, 95 insertions(+), 191 deletions(-)

diff --git a/cgit.css b/cgit.css @@ -49,93 +49,10 @@ option:not(:checked) { #header { width: 100%; - background: #2C3E50; - color: #D7DADB; padding: 0; margin: 0; -} - -#header ul { - display: inline-block; - list-style: none; - width: 100%; - padding: 4px 0; - margin: 0; -} - -#header ul li { - display: inline-block; - vertical-align: middle; -} - -#header ul img { - width: 30px; - height: auto; - padding-top: 2px; - float: left; -} - -#header ul .root-title { - font-size: 1.3em; - margin-right: 15px; - border-radius: 5px; - padding: 2px 8px; -} - -#header ul .root-title span { - display: inline-block; - float: left; - margin-top: 7px; - margin-left: 4px; - color: white; - font-weight: 600; -} - -#header ul .menu-button { - margin-left: 5px; - padding: 7px 8px; - border-radius: 5px; - font-weight: 600; - transition-duration: 0.3s; - transition-property: all; -} - -#header ul .menu-button:not(.active):hover, #header ul .root-title:hover { - background: #D7DADB33; - cursor: pointer; -} - -#header ul .active { - background: #D7DADB; - color: #2C3E50; - transition-property: color; -} - -#header ul .search { - float: right; - margin-top: 2px; - margin-right: 10px; -} - -#header ul .search input { - width: 200px; - height: 30px; - border: 0; - border-radius: 5px; - padding-left: 5px; - background: #D7DADB4D; - color: white; - transition-duration: 0.3s; - transition-property: all; -} - -#header ul .search input:hover { - background: #D7DADB66; -} - -#header ul .search input:focus { - background: white; - color: #2C3E50; + font-size: 1.5em; + font-family: monospace; } .sub-title { @@ -221,16 +138,16 @@ option:not(:checked) { .summary-header { height: 20%; - text-align: center; width: 100%; border-bottom: 1px solid #eee; - padding: 20px 0; + padding: 20px 20px; } .summary-header img { - height: 70px; + height: 35px; width: auto; - margin-bottom: -20px; + margin-bottom: -10px; + margin-right: 20px; } .summary-header h3 { @@ -242,6 +159,29 @@ option:not(:checked) { font-size: 1rem; } +.summary-header .repo-name { + font-size: 1.5em; + font-weight: bold; + margin-right: 20px; +} + +.summary-header .repo-desc { + margin-right: 20px; + font-family: monospace; +} + +.summary-header .repo-author { + margin-right: 20px; + font-style: italic; + font-size: 1em; +} + +.summary-menu .site-desc { + border-right: 0; + font-weight: bold; + color: black; +} + .summary-header .repo-url-container { border: 1px solid #e5e5e5; width: auto; @@ -252,6 +192,8 @@ option:not(:checked) { padding: 0; overflow: hidden; height: 28px; + float: right; + margin-right: 35px; } .summary-header .repo-url { @@ -311,18 +253,48 @@ option:not(:checked) { } .summary-menu { + padding: 0; +} + +.summary-menu ul { + padding: 0; + margin: 0; + height: 100%; + width: 100%; +} + +.summary-menu { display: inline-block; - text-align: center; width: 100%; border-bottom: 1px solid #eee; - padding: 7px 0; color: #707070; } .summary-menu li { display: inline-block; - margin-left: 8px; - margin-right: 8px; + margin: 0; + height: 100%; + padding: 10px 20px; + text-align: center; + border-right: 1px solid #eee; +} + +.summary-menu .path { + margin-left: 0; + margin-right: 0; + padding-right: 20px; + padding-left: 30px; + background: #0000001a; +} + +.summary-menu .separation { + border-left: 1px solid #eee; + color: white; + padding-right: 0; +} + +.summary-menu .path a { + font-weight: bold; } .summary-menu a { diff --git a/ui-repolist.c b/ui-repolist.c @@ -293,9 +293,6 @@ void cgit_print_repolist(void) else if (ctx.cfg.section_sort) sort_repolist("section"); - html("<h1 class='sub-title'>"); - html_txt(ctx.cfg.root_desc); - html("</h1>"); html("<ul class='repo-list'>"); for (i = 0; i < cgit_repolist.count; i++) { ctx.repo = &cgit_repolist.repos[i]; diff --git a/ui-shared.c b/ui-shared.c @@ -962,87 +962,32 @@ static void cgit_print_path_crumbs(char *path) static void print_header(void) { char *logo = NULL, *logo_link = NULL; + char *root_url = cgit_rooturl(); - html("<div id='header'>"); - html("<ul>"); - - html("<li class='root-title'>"); - html("<a href='"); - html_attr(cgit_rooturl()); - html("'>"); - - logo = ctx.cfg.logo; - logo_link = ctx.cfg.logo_link; - - if (logo && *logo) { - html("<img src='"); - html_attr(logo); - html("' alt='cgit logo'/>\n"); - } - - html("<span>"); - html_txt(ctx.cfg.root_title); - html("</span></a></li>"); - - html("<li class='menu-button active'>"); - html("Projects"); - html("</li>"); - - html("<li class='menu-button'>"); - html("Contribute"); - html("</li>"); - - char *current_url = cgit_currenturl(); - html("<li class='search'>"); - html("<form method='get' action='"); - if (ctx.repo) - { - htmlf("/%s/log/'>", ctx.repo->name); - htmlf("<input type='hidden' name='qt' value='grep' />"); - } - else - { - html_attr(current_url); - html("'>"); - } - html("<input type='text' name='q' placeholder='Search ..' />"); - html("</form>"); - html("</li>"); - - html("</ul>"); - html("</div>"); - - /* html("<td class='main'>");*/ -/* if (ctx.repo) {*/ - /*cgit_index_link("index", NULL, NULL, NULL, NULL, 0, 1);*/ - /*html(" : ");*/ - /*cgit_summary_link(ctx.repo->name, ctx.repo->name, NULL, NULL);*/ - /*if (ctx.env.authenticated) {*/ - /*html("</td><td class='form'>");*/ - /*html("<form method='get'>\n");*/ - /*cgit_add_hidden_formfields(0, 1, ctx.qry.page);*/ - /*html("<select name='h' onchange='this.form.submit();'>\n");*/ - /*for_each_branch_ref(print_branch_option, ctx.qry.head);*/ - /*if (ctx.repo->enable_remote_branches)*/ - /*for_each_remote_ref(print_branch_option, ctx.qry.head);*/ - /*html("</select> ");*/ - /*html("<input type='submit' value='switch'/>");*/ - /*html("</form>");*/ - /*}*/ - /*}*/ - /*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);<]*/ - /*}*/ - /*html("</td></tr></table>\n");*/ + _html("<div class='summary-menu'>") { + _html("<ul>") { + _html("<li class='path'>") { + htmlf("<a href='%s'>%s</a>", root_url, ctx.cfg.root_title); + if (ctx.repo) + { + htmlf(" / <a href='/%s'>%s</a>", ctx.repo->name, ctx.repo->name); + htmlf(" / %s", ctx.qry.page); + } + } _html("</li>"); + + if (ctx.repo) + { + HTML_LINK("<li><a href='" URL() "'>Summary</a></li>"); + HTML_LINK("<li><a href='" URL("log") "'>Commits (%d)</a></li>", cgit_count_commits()); + HTML_LINK("<li><a href='" URL("refs") "'>Branches (%d)</a></li>", cgit_count_branches()); + htmlf("<li><a href='#'>Releases (%d)</a></li>", cgit_count_tags()); + } + else + { + htmlf("<li class='site-desc'>%s</li>", ctx.cfg.root_desc); + } + } _html("</ul>"); + } _html("</div>"); } void cgit_print_pageheader(void) @@ -1057,24 +1002,12 @@ void cgit_print_pageheader(void) htmlf("<img src='/%s' />", ctx.repo->logo); else htmlf("<img src='%s' />", ctx.cfg.logo); - html("<br />"); - htmlf("<h3>%s</h3>", ctx.repo->name); - htmlf("<span>%s</span>", ctx.repo->desc); - htmlf("<h5>%s</h5>", ctx.repo->owner == NULL ? "" : ctx.repo->owner); + htmlf("<span class='repo-name'>%s</span>", ctx.repo->name); + htmlf("<span class='repo-desc'>%s</span>", ctx.repo->desc); + htmlf("<span class='repo-author'>%s</span>", ctx.repo->owner == NULL ? "" : ctx.repo->owner); cgit_add_clone_urls(NULL); } _html("</div>"); - _html("<div class='summary-menu'>") { - _html("<ul>") { - HTML_LINK("<li><a href='" URL() "'>Summary</a></li>"); - HTML_LINK("<li><a href='" URL("log") "'>Commits (%d)</a></li>", cgit_count_commits()); - HTML_LINK("<li><a href='" URL("refs") "'>Branches (%d)</a></li>", cgit_count_branches()); - htmlf("<li><a href='#'>Tags (%d)</a></li>", cgit_count_tags()); - html("<li><a href='#'>Readme</a></li>"); - HTML_LINK("<li><a href='" URL("diff") "'>Diff</a></li>"); - } _html("</ul>"); - } _html("</div>"); - if (strcmp("commit", ctx.qry.page) == 0) goto end; diff --git a/ui-summary.c b/ui-summary.c @@ -133,7 +133,9 @@ void cgit_print_repo_readme(char *path, bool layout) */ cgit_open_filter(ctx.repo->about_filter, filename); if (ref) + { cgit_print_file(filename, ref, 1); + } else html_include(filename); cgit_close_filter(ctx.repo->about_filter);