Implement themed diff page

This commit is contained in:
RunasSudo 2025-05-15 14:57:44 +10:00
parent 6fbf6cb4c7
commit 7f5688dc7e
Signed by: RunasSudo
GPG Key ID: 7234E476BF21C61A
5 changed files with 20 additions and 2 deletions

View File

@ -101,6 +101,7 @@ CGIT_OBJ_NAMES += themed/mincrypt_sha256.o
CGIT_THEMED_INPUTS += $(CGIT_PREFIX)themed/base.html CGIT_THEMED_INPUTS += $(CGIT_PREFIX)themed/base.html
CGIT_THEMED_INPUTS += $(CGIT_PREFIX)themed/index.html CGIT_THEMED_INPUTS += $(CGIT_PREFIX)themed/index.html
CGIT_THEMED_INPUTS += $(CGIT_PREFIX)themed/commit.html CGIT_THEMED_INPUTS += $(CGIT_PREFIX)themed/commit.html
CGIT_THEMED_INPUTS += $(CGIT_PREFIX)themed/diff.html
CGIT_THEMED_INPUTS += $(CGIT_PREFIX)themed/log.html CGIT_THEMED_INPUTS += $(CGIT_PREFIX)themed/log.html
CGIT_THEMED_INPUTS += $(CGIT_PREFIX)themed/refs.html CGIT_THEMED_INPUTS += $(CGIT_PREFIX)themed/refs.html
CGIT_THEMED_INPUTS += $(CGIT_PREFIX)themed/summary.html CGIT_THEMED_INPUTS += $(CGIT_PREFIX)themed/summary.html

3
cmd.c
View File

@ -85,7 +85,8 @@ static void commit_fn(void)
static void diff_fn(void) static void diff_fn(void)
{ {
cgit_print_diff(ctx.qry.oid, ctx.qry.oid2, ctx.qry.path, 1, 0); //cgit_print_diff(ctx.qry.oid, ctx.qry.oid2, ctx.qry.path, 1, 0);
cgit_print_diff_page();
} }
static void rawdiff_fn(void) static void rawdiff_fn(void)

View File

@ -55,7 +55,7 @@
</span> </span>
</div> </div>
</div> </div>
<div class="diff-panel"> <div class="diff-panel overflow-x-auto">
{# Diff panel #} {# Diff panel #}
{! cgit_print_diff(ctx.qry.oid, NULL, NULL, 0, 0); !} {! cgit_print_diff(ctx.qry.oid, NULL, NULL, 0, 0); !}
</div> </div>

15
themed/diff.html Normal file
View File

@ -0,0 +1,15 @@
{! #include "../ui-diff.h" !}
{% page cgit_print_diff_page %}
{! page_start(); !}
{! repo_header(); !}
<main class="max-w-[1280px] mx-auto py-4">{# Main content #}
{! repo_description_panel(); !}
{! repo_summary_bar(); !}
<div class="diff-panel overflow-x-auto">
{# Diff panel #}
{! cgit_print_diff(ctx.qry.oid, ctx.qry.oid2, ctx.qry.path, 0, 0); !}
</div>
</main>
{! page_end(); !}
{% endpage %}

View File

@ -5,6 +5,7 @@ extern void cgit_print_diff_ctrls(void);
extern void cgit_print_diff(const char *new_hex, const char *old_hex, extern void cgit_print_diff(const char *new_hex, const char *old_hex,
const char *prefix, int show_ctrls, int raw); const char *prefix, int show_ctrls, int raw);
extern void cgit_print_diff_page(void);
extern struct diff_filespec *cgit_get_current_old_file(void); extern struct diff_filespec *cgit_get_current_old_file(void);
extern struct diff_filespec *cgit_get_current_new_file(void); extern struct diff_filespec *cgit_get_current_new_file(void);