[PATCH v2 1/1] ui: Change author name text to link to author's commits
Petr Vorel
petr.vorel at gmail.com
Mon Oct 22 22:38:37 CEST 2018
in commit list in Author columns in summary, refs and log pages.
Signed-off-by: Petr Vorel <petr.vorel at gmail.com>
---
ui-log.c | 2 +-
ui-refs.c | 6 +++---
ui-shared.c | 7 +++++++
ui-shared.h | 1 +
4 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/ui-log.c b/ui-log.c
index d696e20..3fdc2a2 100644
--- a/ui-log.c
+++ b/ui-log.c
@@ -242,7 +242,7 @@ static void print_commit(struct commit *commit, struct rev_info *revs)
show_commit_decorations(commit);
html("</td><td>");
cgit_open_filter(ctx.repo->email_filter, info->author_email, "log");
- html_txt(info->author);
+ cgit_author_link(info->author);
cgit_close_filter(ctx.repo->email_filter);
if (revs->graph) {
diff --git a/ui-refs.c b/ui-refs.c
index 2ec3858..174bfc3 100644
--- a/ui-refs.c
+++ b/ui-refs.c
@@ -70,7 +70,7 @@ static int print_branch(struct refinfo *ref)
cgit_commit_link(info->subject, NULL, NULL, name, NULL, NULL);
html("</td><td>");
cgit_open_filter(ctx.repo->email_filter, info->author_email, "refs");
- html_txt(info->author);
+ cgit_author_link(info->author);
cgit_close_filter(ctx.repo->email_filter);
html("</td><td colspan='2'>");
cgit_print_age(info->committer_date, info->committer_tz, -1);
@@ -116,12 +116,12 @@ static int print_tag(struct refinfo *ref)
if (info) {
if (info->tagger) {
cgit_open_filter(ctx.repo->email_filter, info->tagger_email, "refs");
- html_txt(info->tagger);
+ cgit_author_link(info->tagger);
cgit_close_filter(ctx.repo->email_filter);
}
} else if (ref->object->type == OBJ_COMMIT) {
cgit_open_filter(ctx.repo->email_filter, ref->commit->author_email, "refs");
- html_txt(ref->commit->author);
+ cgit_author_link(ref->commit->author);
cgit_close_filter(ctx.repo->email_filter);
}
html("</td><td colspan='2'>");
diff --git a/ui-shared.c b/ui-shared.c
index 739505a..dfe7d5a 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -294,6 +294,13 @@ static void reporevlink(const char *page, const char *name, const char *title,
html("</a>");
}
+void cgit_author_link(const char *name)
+{
+ cgit_log_link(name, NULL, NULL, NULL,
+ NULL, NULL, 0, "author", name,
+ 0, 0);
+}
+
void cgit_summary_link(const char *name, const char *title, const char *class,
const char *head)
{
diff --git a/ui-shared.h b/ui-shared.h
index 4d5978b..3e2a0bb 100644
--- a/ui-shared.h
+++ b/ui-shared.h
@@ -14,6 +14,7 @@ extern char *cgit_pageurl(const char *reponame, const char *pagename,
extern void cgit_add_clone_urls(void (*fn)(const char *));
+extern void cgit_author_link(const char *name);
extern void cgit_index_link(const char *name, const char *title,
const char *class, const char *pattern, const char *sort, int ofs, int always_root);
extern void cgit_summary_link(const char *name, const char *title,
--
2.19.1
More information about the CGit
mailing list