fixup preserve
This commit is contained in:
parent
836f4cd06d
commit
8f023f452d
@ -30,7 +30,7 @@
|
||||
<p class="text-lg font-semibold">{{ info->subject }}</p>
|
||||
</div>
|
||||
<div class="py-2">
|
||||
<a href="{! cgit_shared_repolink_url_with_delimiter("tree", ctx.qry.head, ctx.qry.vpath); !}id={{ oid_to_hex(&commit->object.oid) }}" 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>
|
||||
</div>
|
||||
</div>
|
||||
<div class="px-3 py-2 rounded-b-md bg-gray-50 flex gap-x-1 items-center">
|
||||
@ -43,14 +43,14 @@
|
||||
{! struct commit *parent = lookup_commit_reference(the_repository, &p->item->object.oid); !}
|
||||
{% if parent %}
|
||||
parent
|
||||
<a href="{! cgit_shared_repolink_url_with_delimiter("commit", ctx.qry.head, ctx.qry.vpath); !}id={{ oid_to_hex(&p->item->object.oid) }}" 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>
|
||||
·
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
commit
|
||||
<a href="{! cgit_shared_repolink_url_with_delimiter("commit", ctx.qry.head, ctx.qry.vpath); !}id={{ oid_to_hex(&commit->object.oid) }}" 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>
|
||||
</span>
|
||||
|
@ -29,19 +29,19 @@
|
||||
{% while (commit = get_revision(&rev)) != NULL %}
|
||||
{! struct commitinfo *info = cgit_parse_commit(commit); !}
|
||||
<div class="px-3 py-2 border-t border-gray-300">
|
||||
<div><a href="{! cgit_shared_repolink_url_with_delimiter("commit", ctx.qry.head, ctx.qry.vpath); !}id={{ oid_to_hex(&commit->object.oid) }}" 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">
|
||||
<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
|
||||
</div>
|
||||
</div>
|
||||
<div class="px-3 py-2 border-t border-gray-300 flex items-center">
|
||||
<a href="{! cgit_shared_repolink_url_with_delimiter("commit", ctx.qry.head, ctx.qry.vpath); !}id={{ oid_to_hex(&commit->object.oid) }}" class="text-sm font-mono text-gray-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="text-sm font-mono text-gray-500 hover:text-blue-600 hover:underline">
|
||||
{! short_commit_id(oid_to_hex(&commit->object.oid)); !}
|
||||
</a>
|
||||
</div>
|
||||
<div class="px-3 py-2 border-t border-gray-300 flex items-center">
|
||||
<a href="{! cgit_shared_repolink_url_with_delimiter("tree", ctx.qry.head, ctx.qry.vpath); !}id={{ oid_to_hex(&commit->object.oid) }}" class="text-gray-500 hover:text-blue-600">
|
||||
<a href="{! cgit_shared_reporevlink_url("tree", ctx.qry.head, oid_to_hex(&commit->object.oid), ctx.qry.vpath); !}" class="text-gray-500 hover:text-blue-600">
|
||||
{# Heroicons mini code-bracket #}
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="size-5"><path fill-rule="evenodd" d="M6.28 5.22a.75.75 0 0 1 0 1.06L2.56 10l3.72 3.72a.75.75 0 0 1-1.06 1.06L.97 10.53a.75.75 0 0 1 0-1.06l4.25-4.25a.75.75 0 0 1 1.06 0Zm7.44 0a.75.75 0 0 1 1.06 0l4.25 4.25a.75.75 0 0 1 0 1.06l-4.25 4.25a.75.75 0 0 1-1.06-1.06L17.44 10l-3.72-3.72a.75.75 0 0 1 0-1.06ZM11.377 2.011a.75.75 0 0 1 .612.867l-2.5 14.5a.75.75 0 0 1-1.478-.255l2.5-14.5a.75.75 0 0 1 .866-.612Z" clip-rule="evenodd" /></svg>
|
||||
</a>
|
||||
|
@ -43,7 +43,7 @@
|
||||
</div>
|
||||
{% if strcmp(name, ctx.qry.head) %}{# Only show compare button if not equal to current branch #}
|
||||
<div class="flex-1"></div>
|
||||
<a href="{! cgit_shared_repolink_url_with_delimiter("diff", ctx.qry.head, NULL); !}id={{ name|urlencode }}&id2={{ ctx.qry.head|urlencode }}" class="py-1.5 px-3 self-center text-gray-500 bg-gray-50 border border-gray-300 rounded-md hover:bg-gray-100">
|
||||
<a href="{! cgit_shared_reporevlink_url("diff", ctx.qry.head, name, NULL); !}&id2={{ ctx.qry.head|urlencode }}" class="py-1.5 px-3 self-center text-gray-500 bg-gray-50 border border-gray-300 rounded-md hover:bg-gray-100">
|
||||
Compare
|
||||
</a>
|
||||
{% endif %}
|
||||
|
@ -16,7 +16,11 @@
|
||||
<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_repolink_url("tree", ctx.qry.head, pathname); !}" class="hover:text-blue-600 hover:underline">{{ pathname }}</a></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 %}
|
||||
@ -50,10 +54,10 @@
|
||||
<div class="col-span-4 rounded-t-md bg-gray-50 px-3 py-2 flex gap-x-1">
|
||||
<img src="{! gravatar_url(info->author_email); !}?s=24">
|
||||
<span class="font-semibold">{{ info->author }}</span>
|
||||
<a href="{! cgit_shared_repolink_url_with_delimiter("commit", ctx.qry.head, ctx.qry.vpath); !}id={{ oid_to_hex(&commit->object.oid) }}" class="ml-2 text-gray-500 hover:text-blue-600 hover:underline">{{ info->subject }}</a>
|
||||
<a href="{! cgit_shared_reporevlink_url("commit", ctx.qry.head, oid_to_hex(&commit->object.oid), ctx.qry.vpath); !}" class="ml-2 text-gray-500 hover:text-blue-600 hover:underline">{{ info->subject }}</a>
|
||||
<div class="flex-1"></div>
|
||||
<span class="text-gray-500">
|
||||
<a href="{! cgit_shared_repolink_url_with_delimiter("commit", ctx.qry.head, ctx.qry.vpath); !}id={{ oid_to_hex(&commit->object.oid) }}" class="font-mono 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 hover:text-blue-600 hover:underline">
|
||||
{! short_commit_id(oid_to_hex(&commit->object.oid)); !}
|
||||
</a>
|
||||
·
|
||||
|
@ -4,7 +4,7 @@
|
||||
<div class="px-3">
|
||||
{# Breadcrumbs #}
|
||||
{# TODO: Make breadcrumbs hyperlinks #}
|
||||
<a href="{! cgit_shared_repolink_url(NULL, ctx.qry.head, NULL); !}" class="text-blue-500 hover:text-blue-600 hover:underline">{{ ctx.repo->name }}</a> / {{ ctx.qry.path }}
|
||||
<a href="{! cgit_shared_reporevlink_url(NULL, ctx.qry.head, ctx.qry.oid, NULL); !}" class="text-blue-500 hover:text-blue-600 hover:underline">{{ ctx.repo->name }}</a> / {{ ctx.qry.path }}
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
@ -37,7 +37,11 @@
|
||||
<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_repolink_url("tree", ctx.qry.head, 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 %}">
|
||||
<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); !}
|
||||
|
10
ui-shared.c
10
ui-shared.c
@ -381,6 +381,16 @@ static void reporevlink(const char *page, const char *name, const char *title,
|
||||
html("</a>");
|
||||
}
|
||||
|
||||
void cgit_shared_reporevlink_url(const char *page, const char *head, const char *rev, const char *path)
|
||||
{
|
||||
const char *delim = cgit_shared_repolink_url(page, head, path);
|
||||
if (rev && ctx.qry.head != NULL && strcmp(rev, ctx.qry.head)) {
|
||||
html(delim);
|
||||
html("id=");
|
||||
html_url_arg(rev);
|
||||
}
|
||||
}
|
||||
|
||||
void cgit_summary_link(const char *name, const char *title, const char *class,
|
||||
const char *head)
|
||||
{
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
extern const char *cgit_shared_repolink_url(const char *page, const char *head, const char *path);
|
||||
extern void cgit_shared_repolink_url_with_delimiter(const char *page, const char *head, const char *path);
|
||||
extern void cgit_shared_reporevlink_url(const char *page, const char *head, const char *rev, const char *path);
|
||||
extern void cgit_shared_site_url(const char *page, const char *search, const char *sort, int ofs, int always_root);
|
||||
|
||||
extern const char *cgit_httpscheme(void);
|
||||
|
Loading…
x
Reference in New Issue
Block a user