neocgit

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

commit 35149806e0fac52f8e296673907eec0bff218a10
parent 226030fe872d7f143a1d16fd2d4e86d8c4ab9102
Author: Ne02ptzero <louis@ne02ptzero.me>
Date:   Tue, 10 Jul 2018 08:57:19 +0200

NEW: Commit list, with link with tree

Signed-off-by: Ne02ptzero <louis@ne02ptzero.me>

Diffstat:
Mcgit.css | 36+++++++++++++++++++++++++++++++++---
Mui-log.c | 34+++++++++++++++++++++++-----------
Mui-shared.c | 3+++
3 files changed, 59 insertions(+), 14 deletions(-)

diff --git a/cgit.css b/cgit.css @@ -446,6 +446,7 @@ option:not(:checked) { padding: 0; margin: 0; padding-left: 16px; + list-style: none; } .commit ul .commit-info ul li { @@ -485,7 +486,7 @@ option:not(:checked) { font-size: 14px; } -.commit .copy { +.commit .copy, .commit-list .hash .tree { text-align: center; border: 1px solid #eee; border-radius: 3px; @@ -500,7 +501,7 @@ option:not(:checked) { margin-left: -1px; } -.commit .copy:hover { +.commit .copy:hover, .commit-list .hash .tree:hover { background: #e6e3e3; cursor: pointer; } @@ -519,7 +520,6 @@ option:not(:checked) { border-top: 1px solid #f0f0f0; } - .repo-tree table .tree-entry:hover { cursor: pointer; background: #fafafa; @@ -582,6 +582,36 @@ option:not(:checked) { padding: 32px; } +.commit-list-container { + padding: 10px 15px; +} + +.commit-list { + list-style: none; + padding: 0; + margin: 0; + padding: 16px; +} + +.commit-list .commit ul .commit-info { + width: calc(95% - 200px); + padding: 0; + margin: 0; +} + +.commit-list .commit { + padding: 10px 0px; + border-bottom: 1px solid #eee; +} + +.commit-list .hash { + width: 180px; +} + +.commit-list .hash input { + width: calc(100% - 100px); +} + div#cgit div.path { margin: 0px; padding: 5px 2em 2px 2em; diff --git a/ui-log.c b/ui-log.c @@ -204,8 +204,8 @@ static void print_commit(struct commit *commit, struct rev_info *revs) _html("<li class='commit-info'><ul>") { - _html("<li class='title'") { - htmlf("<a href='/%s/commit/>id=%s'>%s</a>", + _html("<li class='title'>") { + htmlf("<a href='/%s/commit/?id=%s'>%s</a>", ctx.repo->name, oid_to_hex(&commit->object.oid), info->subject); } _html("</li>"); @@ -213,17 +213,29 @@ static void print_commit(struct commit *commit, struct rev_info *revs) _html("<li class='author'>") { htmlf("%s authored ", info->author); cgit_print_age(info->author_date, info->author_tz, -1); + html(" ago"); } _html("</li>"); } _html("</ul></li>"); _html("<li class='hash'><ul>") { - html("<li><input type='text' value='"); - html_txt(oid_to_hex(&commit->object.oid)); - html("' readonly id='last-commit-value' /></li>"); - html("<li><span class='copy' " - "onclick=\"document.getElementById('last-commit-value')" - ".select(); document.execCommand('copy')\">" - "<i class='fa fa-copy'></i></span></li>"); + html("<li>"); { + htmlf("<input type='text' value='%s' readonly id='commit-hash-%s' />", + oid_to_hex(&commit->object.oid), oid_to_hex(&commit->object.oid)); + } html("</li>"); + + html("<li>"); { + htmlf("<span class='copy' " + "onclick=\"document.getElementById('commit-hash-%s')" + ".select(); document.execCommand('copy')\">" + "<i class='fa fa-copy'></i></span>", + oid_to_hex(&commit->object.oid)); + } html("</li>"); + + html("<li>"); { + htmlf("<a href='/%s/tree/?id=%s' class='tree'>" + "<i class='fa fa-folder'></i></a>", + ctx.repo->name, oid_to_hex(&commit->object.oid)); + } html("</li>"); } _html("</ul></li>"); } _html("</ul></li>"); @@ -551,8 +563,8 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern prepare_revision_walk(&rev); reset_revision_walk(); - html("<div class='commit-list-container'"); - html("<ul class='commit-list'"); + html("<div class='commit-list-container'>"); + html("<ul class='commit-list'>"); /* html("<tr class='nohover'>");*/ /*if (commit_graph)*/ diff --git a/ui-shared.c b/ui-shared.c @@ -1120,6 +1120,9 @@ void cgit_print_pageheader(void) } _html("</ul>"); } _html("</div>"); + if (strcmp("log", ctx.qry.page) == 0) + goto end; + _html("<div class='summary-last-commit'>") { _html("<div class='last-commit commit'>") { struct commit *commit;