Compare commits
6 Commits
e06adbbeb9
...
2460441ce7
Author | SHA1 | Date | |
---|---|---|---|
2460441ce7 | |||
e1e3d501ce | |||
b486a93638 | |||
c5548f08e4 | |||
c262004043 | |||
4a7a591fe4 |
1
cgit.mk
1
cgit.mk
@ -99,6 +99,7 @@ CGIT_OBJ_NAMES += themed/themed.o
|
|||||||
CGIT_OBJ_NAMES += themed/mincrypt_sha256.o
|
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/tree_common.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/diff.html
|
||||||
|
@ -18,9 +18,9 @@
|
|||||||
{% block repo_header %}
|
{% block repo_header %}
|
||||||
<header class="bg-gray-50 border-b border-gray-300">{# Repo header #}
|
<header class="bg-gray-50 border-b border-gray-300">{# Repo header #}
|
||||||
<div class="max-w-[1280px] mx-auto py-4 flex gap-x-1">
|
<div class="max-w-[1280px] mx-auto py-4 flex gap-x-1">
|
||||||
{# Heroicons outline cube #}
|
{# Heroicons outline cube
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-6"><path stroke-linecap="round" stroke-linejoin="round" d="m21 7.5-9-5.25L3 7.5m18 0-9 5.25m9-5.25v9l-9 5.25M3 7.5l9 5.25M3 7.5v9l9 5.25m0-9v9" /></svg>
|
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-6"><path stroke-linecap="round" stroke-linejoin="round" d="m21 7.5-9-5.25L3 7.5m18 0-9 5.25m9-5.25v9l-9 5.25M3 7.5l9 5.25M3 7.5v9l9 5.25m0-9v9" /></svg>#}
|
||||||
<div class="text-lg"><a href="{{ cgit_rooturl()|attr }}" class="hover:text-blue-600 hover:underline">index</a> / <a href="{! cgit_shared_repolink_url(NULL, NULL, NULL); !}" class="font-semibold hover:text-blue-600 hover:underline">{{ ctx.repo->name }}</a></div>
|
<div class="text-lg"><a href="{{ cgit_rooturl()|attr }}" class="hover:text-blue-600 hover:underline">{{ ctx.cfg.root_title }}</a> / <a href="{! cgit_shared_repolink_url(NULL, NULL, NULL); !}" class="font-semibold hover:text-blue-600 hover:underline">{{ ctx.repo->name }}</a></div>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -27,7 +27,10 @@
|
|||||||
<div class="px-3 py-2 flex items-top">
|
<div class="px-3 py-2 flex items-top">
|
||||||
<div class="flex-1">
|
<div class="flex-1">
|
||||||
{# Description panel #}
|
{# Description panel #}
|
||||||
<p class="text-lg font-semibold">{{ info->subject }}</p>
|
<div class="text-lg font-semibold">{{ info->subject }}</div>
|
||||||
|
{% if info-> msg %}
|
||||||
|
<div class="text-gray-500 pt-1">{{ info->msg }}</div>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
<div class="py-2">
|
<div class="py-2">
|
||||||
<a href="{! cgit_shared_reporevlink_url("tree", ctx.qry.head, oid_to_hex(&commit->object.oid), ctx.qry.vpath); !}" class="p-2 text-sm text-white bg-blue-500 rounded-md hover:bg-blue-600">Browse Source</a>
|
<a href="{! cgit_shared_reporevlink_url("tree", ctx.qry.head, oid_to_hex(&commit->object.oid), ctx.qry.vpath); !}" class="p-2 text-sm text-white bg-blue-500 rounded-md hover:bg-blue-600">Browse Source</a>
|
||||||
@ -36,23 +39,19 @@
|
|||||||
<div class="px-3 py-2 rounded-b-md bg-gray-50 flex gap-x-1 items-center">
|
<div class="px-3 py-2 rounded-b-md bg-gray-50 flex gap-x-1 items-center">
|
||||||
<img src="{! gravatar_url(info->author_email); !}?s=24">
|
<img src="{! gravatar_url(info->author_email); !}?s=24">
|
||||||
<span class="font-semibold text-sm">{{ info->author }}</span>
|
<span class="font-semibold text-sm">{{ info->author }}</span>
|
||||||
<span class="font-gray-500 text-sm">{! cgit_print_age(info->committer_date, info->committer_tz, TM_WEEK * 2); !} ago</span>
|
<span class="text-gray-500 text-sm">{! cgit_print_age_themed(info->committer_date, info->committer_tz, TM_MONTH * 12); !}</span>
|
||||||
<div class="flex-1"></div>
|
<div class="flex-1"></div>
|
||||||
<span class="font-gray-500 text-sm">
|
<span class="text-gray-500 text-sm">
|
||||||
{% for struct commit_list *p = commit->parents; p; p = p->next %}
|
{% for struct commit_list *p = commit->parents; p; p = p->next %}
|
||||||
{! struct commit *parent = lookup_commit_reference(the_repository, &p->item->object.oid); !}
|
{! struct commit *parent = lookup_commit_reference(the_repository, &p->item->object.oid); !}
|
||||||
{% if parent %}
|
{% if parent %}
|
||||||
parent
|
parent
|
||||||
<a href="{! cgit_shared_reporevlink_url("commit", ctx.qry.head, oid_to_hex(&p->item->object.oid), ctx.qry.vpath); !}" class="font-mono text-blue-500 hover:text-blue-600 hover:underline">
|
<a href="{! cgit_shared_reporevlink_url("commit", ctx.qry.head, oid_to_hex(&p->item->object.oid), ctx.qry.vpath); !}" class="font-mono text-blue-500 hover:text-blue-600 hover:underline">{! short_commit_id(oid_to_hex(&p->item->object.oid)); !}</a>
|
||||||
{! short_commit_id(oid_to_hex(&p->item->object.oid)); !}
|
|
||||||
</a>
|
|
||||||
·
|
·
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
commit
|
commit
|
||||||
<a href="{! cgit_shared_reporevlink_url("commit", ctx.qry.head, oid_to_hex(&commit->object.oid), ctx.qry.vpath); !}" class="font-mono text-blue-500 hover:text-blue-600 hover:underline">
|
<a href="{! cgit_shared_reporevlink_url("commit", ctx.qry.head, oid_to_hex(&commit->object.oid), ctx.qry.vpath); !}" class="font-mono text-blue-500 hover:text-blue-600 hover:underline">{! short_commit_id(oid_to_hex(&commit->object.oid)); !}</a>
|
||||||
{! short_commit_id(oid_to_hex(&commit->object.oid)); !}
|
|
||||||
</a>
|
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -26,16 +26,16 @@
|
|||||||
{% for int i = 0; i < cgit_repolist.count; i++ %}
|
{% for int i = 0; i < cgit_repolist.count; i++ %}
|
||||||
{! ctx.repo = &cgit_repolist.repos[i]; !}
|
{! ctx.repo = &cgit_repolist.repos[i]; !}
|
||||||
{! if (!cgit_repolist_is_visible(ctx.repo)) { continue; } !}
|
{! if (!cgit_repolist_is_visible(ctx.repo)) { continue; } !}
|
||||||
<div{% if i > 0 %} class="border-t border-gray-300 pt-4 mt-4"{% endif %}>
|
<div{% if i > 0 %} class="border-t border-gray-300 pt-2 mt-2"{% endif %}>
|
||||||
{# Heroicons outline cube #}
|
{# Heroicons outline cube #}
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-6"><path stroke-linecap="round" stroke-linejoin="round" d="m21 7.5-9-5.25L3 7.5m18 0-9 5.25m9-5.25v9l-9 5.25M3 7.5l9 5.25M3 7.5v9l9 5.25m0-9v9" /></svg>
|
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-6"><path stroke-linecap="round" stroke-linejoin="round" d="m21 7.5-9-5.25L3 7.5m18 0-9 5.25m9-5.25v9l-9 5.25M3 7.5l9 5.25M3 7.5v9l9 5.25m0-9v9" /></svg>
|
||||||
</div>
|
</div>
|
||||||
<div class="{% if i > 0 %}border-t border-gray-300 pt-4 mt-4 {% endif %}pl-2">
|
<div class="{% if i > 0 %}border-t border-gray-300 pt-2 mt-2 {% endif %}pl-2">
|
||||||
{! char *repourl = cgit_repourl(ctx.repo->url); !}
|
{! char *repourl = cgit_repourl(ctx.repo->url); !}
|
||||||
<div><a href="{{ repourl|attr }}" class="text-lg font-semibold text-blue-500 hover:text-blue-600 hover:underline">{{ ctx.repo->name }}</a></div>
|
<div><a href="{{ repourl|attr }}" class="font-semibold text-blue-500 hover:text-blue-600 hover:underline">{{ ctx.repo->name }}</a></div>
|
||||||
{! free(repourl); !}
|
{! free(repourl); !}
|
||||||
<div class="text-gray-500">{{ ctx.repo->desc }}</div>
|
<div class="text-sm text-gray-500">{{ ctx.repo->desc }}</div>
|
||||||
<div class="text-gray-500">Updated {! cgit_repolist_print_modtime(ctx.repo); !} ago</div>
|
<div class="text-sm text-gray-500">Updated {! cgit_repolist_print_modtime(ctx.repo); !} ago</div>
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
<div><a href="{! cgit_shared_reporevlink_url("commit", ctx.qry.head, oid_to_hex(&commit->object.oid), ctx.qry.vpath); !}" class="hover:text-blue-600 hover:underline">{{ info->subject }}</a></div>
|
<div><a href="{! cgit_shared_reporevlink_url("commit", ctx.qry.head, oid_to_hex(&commit->object.oid), ctx.qry.vpath); !}" class="hover:text-blue-600 hover:underline">{{ info->subject }}</a></div>
|
||||||
<div class="mt-2 text-sm text-gray-500 flex gap-x-1 items-center">
|
<div class="mt-2 text-sm text-gray-500 flex gap-x-1 items-center">
|
||||||
<img src="{! gravatar_url(info->author_email); !}?s=16">
|
<img src="{! gravatar_url(info->author_email); !}?s=16">
|
||||||
{{ info->author }} committed {! cgit_print_age(info->committer_date, info->committer_tz, TM_WEEK * 2); !} ago
|
{{ info->author }} committed {! cgit_print_age_themed(info->committer_date, info->committer_tz, TM_MONTH * 12); !}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="px-3 py-2 border-t border-gray-300 flex items-center">
|
<div class="px-3 py-2 border-t border-gray-300 flex items-center">
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
<div><a href="{! cgit_shared_repolink_url(NULL, name, NULL); !}" class="text-blue-500 hover:text-blue-600 hover:underline">{{ name }}</a></div>
|
<div><a href="{! cgit_shared_repolink_url(NULL, name, NULL); !}" class="text-blue-500 hover:text-blue-600 hover:underline">{{ name }}</a></div>
|
||||||
{% if ref->object->type == OBJ_COMMIT %}
|
{% if ref->object->type == OBJ_COMMIT %}
|
||||||
<div class="text-sm text-gray-500 flex gap-x-1">
|
<div class="text-sm text-gray-500 flex gap-x-1">
|
||||||
{{ info->subject }} · Updated {! cgit_print_age(info->committer_date, info->committer_tz, -1); !} ago
|
{{ info->subject }} · Updated {! cgit_print_age_themed(info->committer_date, info->committer_tz, TM_MONTH * 12); !}
|
||||||
<img src="{! gravatar_url(info->author_email); !}?s=24" class="mt-[-0.2rem]">
|
<img src="{! gravatar_url(info->author_email); !}?s=24" class="mt-[-0.2rem]">
|
||||||
{{ info->author }}
|
{{ info->author }}
|
||||||
</div>
|
</div>
|
||||||
@ -86,7 +86,7 @@
|
|||||||
{% if info && (info->tagger_date > 0 || info->tagger) %}
|
{% if info && (info->tagger_date > 0 || info->tagger) %}
|
||||||
<div class="text-sm text-gray-500 flex gap-x-1">
|
<div class="text-sm text-gray-500 flex gap-x-1">
|
||||||
{% if info->tagger_date > 0 %}
|
{% if info->tagger_date > 0 %}
|
||||||
Updated {! cgit_print_age(info->tagger_date, info->tagger_tz, -1); !} ago
|
Updated {! cgit_print_age_themed(info->tagger_date, info->tagger_tz, TM_MONTH * 12); !}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if info->tagger %}
|
{% if info->tagger %}
|
||||||
<img src="{! gravatar_url(info->tagger_email); !}?s=24" class="mt-[-0.2rem]">
|
<img src="{! gravatar_url(info->tagger_email); !}?s=24" class="mt-[-0.2rem]">
|
||||||
@ -95,7 +95,7 @@
|
|||||||
</div>
|
</div>
|
||||||
{% elif ref->object->type == OBJ_COMMIT %}
|
{% elif ref->object->type == OBJ_COMMIT %}
|
||||||
<div class="text-sm text-gray-500 flex gap-x-1">
|
<div class="text-sm text-gray-500 flex gap-x-1">
|
||||||
Updated {! cgit_print_age(ref->commit->commit->date, 0, -1); !} ago
|
Updated {! cgit_print_age_themed(ref->commit->commit->date, 0, TM_MONTH * 12); !}
|
||||||
<img src="{! gravatar_url(ref->commit->author_email); !}?s=24" class="mt-[-0.2rem]">
|
<img src="{! gravatar_url(ref->commit->author_email); !}?s=24" class="mt-[-0.2rem]">
|
||||||
{{ ref->commit->author }}
|
{{ ref->commit->author }}
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,32 +1,8 @@
|
|||||||
{! #include "../ui-blob.h" !}
|
{! #include "../ui-blob.h" !}
|
||||||
|
|
||||||
{% block ls_item_impl(const struct object_id *oid, struct strbuf *base, const char *pathname, unsigned mode, void *cbdata) %}
|
|
||||||
{!
|
|
||||||
unsigned long size = 0;
|
|
||||||
if (!S_ISGITLINK(mode)) {
|
|
||||||
oid_object_info(the_repository, oid, &size);
|
|
||||||
}
|
|
||||||
!}
|
|
||||||
<div class="pl-3 pr-1 py-2 border-t border-gray-300">
|
|
||||||
{% if S_ISDIR(mode) %}
|
|
||||||
{# Heroicons solid folder #}
|
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" class="size-5 text-blue-400 mt-[0.1rem]"><path d="M19.5 21a3 3 0 0 0 3-3v-4.5a3 3 0 0 0-3-3h-15a3 3 0 0 0-3 3V18a3 3 0 0 0 3 3h15ZM1.5 10.146V6a3 3 0 0 1 3-3h5.379a2.25 2.25 0 0 1 1.59.659l2.122 2.121c.14.141.331.22.53.22H19.5a3 3 0 0 1 3 3v1.146A4.483 4.483 0 0 0 19.5 9h-15a4.483 4.483 0 0 0-3 1.146Z" /></svg>
|
|
||||||
{% else %}
|
|
||||||
{# Heroicons outline document #}
|
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-5 text-gray-500 mt-[0.1rem]"><path stroke-linecap="round" stroke-linejoin="round" d="M19.5 14.25v-2.625a3.375 3.375 0 0 0-3.375-3.375h-1.5A1.125 1.125 0 0 1 13.5 7.125v-1.5a3.375 3.375 0 0 0-3.375-3.375H8.25m2.25 0H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 0 0-9-9Z" /></svg>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
<div class="pr-3 py-2 border-t border-gray-300">
|
|
||||||
<a href="{! cgit_shared_reporevlink_url("tree", ctx.qry.head, ctx.qry.oid, pathname); !}" class="hover:text-blue-600 hover:underline">
|
|
||||||
{{ pathname }}
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
<div class="pr-3 py-2 border-t border-gray-300 text-gray-500 font-mono">{! cgit_print_filemode(mode); !}</div>
|
|
||||||
<div class="pr-3 py-2 border-t border-gray-300 text-gray-500 text-end">{% if !S_ISDIR(mode) %}{{ size|%ld }}{% endif %}</div>
|
|
||||||
{% endblock %}
|
|
||||||
{!
|
{!
|
||||||
int ls_item(const struct object_id *oid, struct strbuf *base, const char *pathname, unsigned mode, void *cbdata) {
|
int ls_item(const struct object_id *oid, struct strbuf *base, const char *pathname, unsigned mode, void *cbdata) {
|
||||||
ls_item_impl(oid, base, pathname, mode, cbdata);
|
tree_listing_item(oid, base, pathname, mode, true); /* from tree_common.html */
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
!}
|
!}
|
||||||
@ -63,7 +39,7 @@
|
|||||||
{! short_commit_id(oid_to_hex(&commit->object.oid)); !}
|
{! short_commit_id(oid_to_hex(&commit->object.oid)); !}
|
||||||
</a>
|
</a>
|
||||||
·
|
·
|
||||||
{! cgit_print_age(info->committer_date, info->committer_tz, TM_WEEK * 2); !} ago
|
{! cgit_print_age_themed(info->committer_date, info->committer_tz, TM_MONTH * 12); !}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
{! cgit_free_commitinfo(info); !}
|
{! cgit_free_commitinfo(info); !}
|
||||||
|
@ -17,35 +17,6 @@
|
|||||||
</nav>
|
</nav>
|
||||||
<div class="grid grid-cols-[auto_1fr_auto_auto] border border-gray-300 rounded-md mb-4">
|
<div class="grid grid-cols-[auto_1fr_auto_auto] border border-gray-300 rounded-md mb-4">
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block tree_content_directory_item(const struct object_id *oid, struct strbuf *base, const char *pathname, unsigned mode, int child_idx) %}
|
|
||||||
{# Directory listing entry #}
|
|
||||||
{!
|
|
||||||
unsigned long size = 0;
|
|
||||||
if (!S_ISGITLINK(mode)) {
|
|
||||||
oid_object_info(the_repository, oid, &size);
|
|
||||||
}
|
|
||||||
|
|
||||||
struct strbuf fullpath = STRBUF_INIT;
|
|
||||||
strbuf_addf(&fullpath, "%s%s", base->buf, pathname);
|
|
||||||
!}
|
|
||||||
<div class="pl-3 pr-1 py-2{% if child_idx > 0 %} border-t border-gray-300{% endif %}">
|
|
||||||
{% if S_ISDIR(mode) %}
|
|
||||||
{# Heroicons solid folder #}
|
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" class="size-5 text-blue-400 mt-[0.1rem]"><path d="M19.5 21a3 3 0 0 0 3-3v-4.5a3 3 0 0 0-3-3h-15a3 3 0 0 0-3 3V18a3 3 0 0 0 3 3h15ZM1.5 10.146V6a3 3 0 0 1 3-3h5.379a2.25 2.25 0 0 1 1.59.659l2.122 2.121c.14.141.331.22.53.22H19.5a3 3 0 0 1 3 3v1.146A4.483 4.483 0 0 0 19.5 9h-15a4.483 4.483 0 0 0-3 1.146Z" /></svg>
|
|
||||||
{% else %}
|
|
||||||
{# Heroicons outline document #}
|
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-5 text-gray-500 mt-[0.1rem]"><path stroke-linecap="round" stroke-linejoin="round" d="M19.5 14.25v-2.625a3.375 3.375 0 0 0-3.375-3.375h-1.5A1.125 1.125 0 0 1 13.5 7.125v-1.5a3.375 3.375 0 0 0-3.375-3.375H8.25m2.25 0H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 0 0-9-9Z" /></svg>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
<div class="pr-3 py-2{% if child_idx > 0 %} border-t border-gray-300{% endif %}">
|
|
||||||
<a href="{! cgit_shared_reporevlink_url("tree", ctx.qry.head, ctx.qry.oid, fullpath.buf); !}" class="hover:text-blue-600 hover:underline">
|
|
||||||
{{ pathname }}
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
<div class="pr-3 py-2{% if child_idx > 0 %} border-t border-gray-300{% endif %} text-gray-500 font-mono">{! cgit_print_filemode(mode); !}</div>
|
|
||||||
<div class="pr-3 py-2{% if child_idx > 0 %} border-t border-gray-300{% endif %} text-gray-500 text-end">{% if !S_ISDIR(mode) %}{{ size|%ld }}{% endif %}</div>
|
|
||||||
{! strbuf_release(&fullpath); !}
|
|
||||||
{% endblock %}
|
|
||||||
{% block tree_content_directory_footer %}
|
{% block tree_content_directory_footer %}
|
||||||
{# Footer for directory listing #}
|
{# Footer for directory listing #}
|
||||||
</div>
|
</div>
|
||||||
@ -112,8 +83,14 @@
|
|||||||
if (strcmp(walk_tree_ctx->match_path, buffer.buf)) {
|
if (strcmp(walk_tree_ctx->match_path, buffer.buf)) {
|
||||||
// Not the target path, so continue to walk the tree
|
// Not the target path, so continue to walk the tree
|
||||||
strbuf_release(&buffer);
|
strbuf_release(&buffer);
|
||||||
|
|
||||||
|
if (S_ISGITLINK(mode)) {
|
||||||
|
// Never recurse into submodules
|
||||||
|
return 0;
|
||||||
|
} else {
|
||||||
return READ_TREE_RECURSIVE;
|
return READ_TREE_RECURSIVE;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// This is the target path
|
// This is the target path
|
||||||
if (S_ISDIR(mode)) {
|
if (S_ISDIR(mode)) {
|
||||||
@ -140,7 +117,7 @@
|
|||||||
strbuf_addstr(&buffer, "/");
|
strbuf_addstr(&buffer, "/");
|
||||||
|
|
||||||
if (!strcmp(buffer.buf, base->buf)) {
|
if (!strcmp(buffer.buf, base->buf)) {
|
||||||
tree_content_directory_item(oid, base, pathname, mode, walk_tree_ctx->directory_child_idx);
|
tree_listing_item(oid, base, pathname, mode, walk_tree_ctx->directory_child_idx > 0);
|
||||||
walk_tree_ctx->directory_child_idx++;
|
walk_tree_ctx->directory_child_idx++;
|
||||||
}
|
}
|
||||||
strbuf_release(&buffer);
|
strbuf_release(&buffer);
|
||||||
|
49
themed/tree_common.html
Normal file
49
themed/tree_common.html
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
{% block tree_listing_item(const struct object_id *oid, struct strbuf *base, const char *pathname, unsigned mode, bool border_above) %}
|
||||||
|
{# Directory listing entry #}
|
||||||
|
{!
|
||||||
|
unsigned long size = 0;
|
||||||
|
if (!S_ISGITLINK(mode)) {
|
||||||
|
oid_object_info(the_repository, oid, &size);
|
||||||
|
}
|
||||||
|
|
||||||
|
struct strbuf fullpath = STRBUF_INIT;
|
||||||
|
strbuf_addf(&fullpath, "%s%s", base->buf, pathname);
|
||||||
|
!}
|
||||||
|
<div class="pl-3 pr-1 py-2{% if border_above %} border-t border-gray-300{% endif %}">
|
||||||
|
{# File icon #}
|
||||||
|
{% if S_ISGITLINK(mode) %}
|
||||||
|
{# Heroicons solid folder #}
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" class="size-5 text-gray-500 mt-[0.1rem]"><path d="M19.5 21a3 3 0 0 0 3-3v-4.5a3 3 0 0 0-3-3h-15a3 3 0 0 0-3 3V18a3 3 0 0 0 3 3h15ZM1.5 10.146V6a3 3 0 0 1 3-3h5.379a2.25 2.25 0 0 1 1.59.659l2.122 2.121c.14.141.331.22.53.22H19.5a3 3 0 0 1 3 3v1.146A4.483 4.483 0 0 0 19.5 9h-15a4.483 4.483 0 0 0-3 1.146Z" /></svg>
|
||||||
|
{% elif S_ISDIR(mode) %}
|
||||||
|
{# Heroicons solid folder #}
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" class="size-5 text-blue-400 mt-[0.1rem]"><path d="M19.5 21a3 3 0 0 0 3-3v-4.5a3 3 0 0 0-3-3h-15a3 3 0 0 0-3 3V18a3 3 0 0 0 3 3h15ZM1.5 10.146V6a3 3 0 0 1 3-3h5.379a2.25 2.25 0 0 1 1.59.659l2.122 2.121c.14.141.331.22.53.22H19.5a3 3 0 0 1 3 3v1.146A4.483 4.483 0 0 0 19.5 9h-15a4.483 4.483 0 0 0-3 1.146Z" /></svg>
|
||||||
|
{% elif S_ISLNK(mode) %}
|
||||||
|
{# Heroicons outline link #}
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-5 text-gray-500 mt-[0.1rem]"><path stroke-linecap="round" stroke-linejoin="round" d="M13.19 8.688a4.5 4.5 0 0 1 1.242 7.244l-4.5 4.5a4.5 4.5 0 0 1-6.364-6.364l1.757-1.757m13.35-.622 1.757-1.757a4.5 4.5 0 0 0-6.364-6.364l-4.5 4.5a4.5 4.5 0 0 0 1.242 7.244" /></svg>
|
||||||
|
{% else %}
|
||||||
|
{# Heroicons outline document #}
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-5 text-gray-500 mt-[0.1rem]"><path stroke-linecap="round" stroke-linejoin="round" d="M19.5 14.25v-2.625a3.375 3.375 0 0 0-3.375-3.375h-1.5A1.125 1.125 0 0 1 13.5 7.125v-1.5a3.375 3.375 0 0 0-3.375-3.375H8.25m2.25 0H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 0 0-9-9Z" /></svg>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
<div class="pr-3 py-2{% if border_above %} border-t border-gray-300{% endif %}">
|
||||||
|
{# File name and link #}
|
||||||
|
{% if S_ISGITLINK(mode) %}
|
||||||
|
{! cgit_submodule_link("ls-mod", fullpath.buf, pathname, oid_to_hex(oid)); !}
|
||||||
|
{% else %}
|
||||||
|
<a href="{! cgit_shared_reporevlink_url("tree", ctx.qry.head, ctx.qry.oid, fullpath.buf); !}" class="hover:text-blue-600 hover:underline">
|
||||||
|
{{ pathname }}
|
||||||
|
</a>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
<div class="pr-3 py-2{% if border_above %} border-t border-gray-300{% endif %} text-gray-500 font-mono">
|
||||||
|
{# Mode #}
|
||||||
|
{! cgit_print_filemode(mode); !}
|
||||||
|
</div>
|
||||||
|
<div class="pr-3 py-2{% if border_above %} border-t border-gray-300{% endif %} text-gray-500 text-end">
|
||||||
|
{# File size #}
|
||||||
|
{% if !S_ISGITLINK(mode) && !S_ISDIR(mode) && !S_ISLNK(mode) %}
|
||||||
|
{{ size|%ld }}
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
{! strbuf_release(&fullpath); !}
|
||||||
|
{% endblock %}
|
@ -118,7 +118,7 @@ static void print_dir_entry(const struct object_id *oid, const char *base,
|
|||||||
fullpath[strlen(fullpath) - 1] = 0;
|
fullpath[strlen(fullpath) - 1] = 0;
|
||||||
html(" <li>");
|
html(" <li>");
|
||||||
if (S_ISGITLINK(mode)) {
|
if (S_ISGITLINK(mode)) {
|
||||||
cgit_submodule_link(NULL, fullpath, oid_to_hex(oid));
|
cgit_submodule_link(NULL, fullpath, NULL, oid_to_hex(oid));
|
||||||
} else
|
} else
|
||||||
cgit_plain_link(path, NULL, NULL, ctx.qry.head, ctx.qry.oid,
|
cgit_plain_link(path, NULL, NULL, ctx.qry.head, ctx.qry.oid,
|
||||||
fullpath);
|
fullpath);
|
||||||
|
49
ui-shared.c
49
ui-shared.c
@ -675,7 +675,7 @@ static struct string_list_item *lookup_path(struct string_list *list,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void cgit_submodule_link(const char *class, char *path, const char *rev)
|
void cgit_submodule_link(const char *class, char *path, const char *display_name, const char *rev)
|
||||||
{
|
{
|
||||||
struct string_list *list;
|
struct string_list *list;
|
||||||
struct string_list_item *item;
|
struct string_list_item *item;
|
||||||
@ -710,14 +710,14 @@ void cgit_submodule_link(const char *class, char *path, const char *rev)
|
|||||||
html_attrf(ctx.repo->module_link, dir, rev);
|
html_attrf(ctx.repo->module_link, dir, rev);
|
||||||
}
|
}
|
||||||
html("'>");
|
html("'>");
|
||||||
html_txt(path);
|
html_txt(display_name ? display_name : path);
|
||||||
html("</a>");
|
html("</a>");
|
||||||
} else {
|
} else {
|
||||||
html("<span");
|
html("<span");
|
||||||
if (class)
|
if (class)
|
||||||
htmlf(" class='%s'", class);
|
htmlf(" class='%s'", class);
|
||||||
html(">");
|
html(">");
|
||||||
html_txt(path);
|
html_txt(display_name ? display_name : path);
|
||||||
html("</span>");
|
html("</span>");
|
||||||
}
|
}
|
||||||
html_txtf(" @ %.7s", rev);
|
html_txtf(" @ %.7s", rev);
|
||||||
@ -784,6 +784,49 @@ void cgit_print_age(time_t t, int tz, time_t max_relative)
|
|||||||
print_rel_date(t, tz, secs * 1.0 / TM_YEAR, "age-years", "years");
|
print_rel_date(t, tz, secs * 1.0 / TM_YEAR, "age-years", "years");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void cgit_print_age_themed(time_t t, int tz, time_t max_relative)
|
||||||
|
{
|
||||||
|
time_t now, secs;
|
||||||
|
|
||||||
|
if (!t)
|
||||||
|
return;
|
||||||
|
time(&now);
|
||||||
|
secs = now - t;
|
||||||
|
if (secs < 0)
|
||||||
|
secs = 0;
|
||||||
|
|
||||||
|
if (secs > max_relative && max_relative >= 0) {
|
||||||
|
html("<span title='");
|
||||||
|
html_attr(show_date(t, tz, cgit_date_mode(DATE_ISO8601)));
|
||||||
|
html("'>");
|
||||||
|
html_txt(show_date(t, tz, cgit_date_mode(DATE_SHORT)));
|
||||||
|
html("</span>");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (secs < TM_HOUR * 2) {
|
||||||
|
print_rel_date(t, tz, secs * 1.0 / TM_MIN, "age-mins", "minutes ago");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (secs < TM_DAY * 2) {
|
||||||
|
print_rel_date(t, tz, secs * 1.0 / TM_HOUR, "age-hours", "hours ago");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (secs < TM_WEEK * 2) {
|
||||||
|
print_rel_date(t, tz, secs * 1.0 / TM_DAY, "age-days", "days ago");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (secs < TM_MONTH * 2) {
|
||||||
|
print_rel_date(t, tz, secs * 1.0 / TM_WEEK, "age-weeks", "weeks ago");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (secs < TM_YEAR * 2) {
|
||||||
|
print_rel_date(t, tz, secs * 1.0 / TM_MONTH, "age-months", "months ago");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
print_rel_date(t, tz, secs * 1.0 / TM_YEAR, "age-years", "years ago");
|
||||||
|
}
|
||||||
|
|
||||||
void cgit_print_http_headers(void)
|
void cgit_print_http_headers(void)
|
||||||
{
|
{
|
||||||
if (ctx.env.no_http && !strcmp(ctx.env.no_http, "1"))
|
if (ctx.env.no_http && !strcmp(ctx.env.no_http, "1"))
|
||||||
|
@ -62,7 +62,7 @@ extern void cgit_stats_link(const char *name, const char *title,
|
|||||||
extern void cgit_object_link(struct object *obj);
|
extern void cgit_object_link(struct object *obj);
|
||||||
|
|
||||||
extern void cgit_submodule_link(const char *class, char *path,
|
extern void cgit_submodule_link(const char *class, char *path,
|
||||||
const char *rev);
|
const char *display_name, const char *rev);
|
||||||
|
|
||||||
extern void cgit_print_layout_start(void);
|
extern void cgit_print_layout_start(void);
|
||||||
extern void cgit_print_layout_end(void);
|
extern void cgit_print_layout_end(void);
|
||||||
@ -73,6 +73,7 @@ __attribute__((format (printf,1,0)))
|
|||||||
extern void cgit_vprint_error(const char *fmt, va_list ap);
|
extern void cgit_vprint_error(const char *fmt, va_list ap);
|
||||||
extern const struct date_mode cgit_date_mode(enum date_mode_type type);
|
extern const struct date_mode cgit_date_mode(enum date_mode_type type);
|
||||||
extern void cgit_print_age(time_t t, int tz, time_t max_relative);
|
extern void cgit_print_age(time_t t, int tz, time_t max_relative);
|
||||||
|
extern void cgit_print_age_themed(time_t t, int tz, time_t max_relative);
|
||||||
extern void cgit_print_http_headers(void);
|
extern void cgit_print_http_headers(void);
|
||||||
extern void cgit_redirect(const char *url, bool permanent);
|
extern void cgit_redirect(const char *url, bool permanent);
|
||||||
extern void cgit_print_docstart(void);
|
extern void cgit_print_docstart(void);
|
||||||
|
@ -240,7 +240,7 @@ static int ls_item(const struct object_id *oid, struct strbuf *base,
|
|||||||
cgit_print_filemode(mode);
|
cgit_print_filemode(mode);
|
||||||
html("</td><td>");
|
html("</td><td>");
|
||||||
if (S_ISGITLINK(mode)) {
|
if (S_ISGITLINK(mode)) {
|
||||||
cgit_submodule_link("ls-mod", fullpath.buf, oid_to_hex(oid));
|
cgit_submodule_link("ls-mod", fullpath.buf, NULL, oid_to_hex(oid));
|
||||||
} else if (S_ISDIR(mode)) {
|
} else if (S_ISDIR(mode)) {
|
||||||
write_tree_link(oid, name, walk_tree_ctx->curr_rev,
|
write_tree_link(oid, name, walk_tree_ctx->curr_rev,
|
||||||
&fullpath);
|
&fullpath);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user