Add search parameters to cgit_log_link
This makes the [prev] and [next] links work correctly on search results. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Cette révision appartient à :
Parent
df203a293e
révision
51140311bb
3
cgit.h
3
cgit.h
@ -238,7 +238,8 @@ extern const char *cgit_repobasename(const char *reponame);
|
|||||||
extern void cgit_tree_link(char *name, char *title, char *class, char *head,
|
extern void cgit_tree_link(char *name, char *title, char *class, char *head,
|
||||||
char *rev, char *path);
|
char *rev, char *path);
|
||||||
extern void cgit_log_link(char *name, char *title, char *class, char *head,
|
extern void cgit_log_link(char *name, char *title, char *class, char *head,
|
||||||
char *rev, char *path, int ofs);
|
char *rev, char *path, int ofs, char *grep,
|
||||||
|
char *pattern);
|
||||||
extern void cgit_commit_link(char *name, char *title, char *class, char *head,
|
extern void cgit_commit_link(char *name, char *title, char *class, char *head,
|
||||||
char *rev);
|
char *rev);
|
||||||
extern void cgit_refs_link(char *name, char *title, char *class, char *head,
|
extern void cgit_refs_link(char *name, char *title, char *class, char *head,
|
||||||
|
6
ui-log.c
6
ui-log.c
@ -118,13 +118,15 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern
|
|||||||
if (ofs > 0) {
|
if (ofs > 0) {
|
||||||
cgit_log_link("[prev]", NULL, NULL, cgit_query_head,
|
cgit_log_link("[prev]", NULL, NULL, cgit_query_head,
|
||||||
cgit_query_sha1, cgit_query_path,
|
cgit_query_sha1, cgit_query_path,
|
||||||
ofs - cnt);
|
ofs - cnt, cgit_query_grep,
|
||||||
|
cgit_query_search);
|
||||||
html(" ");
|
html(" ");
|
||||||
}
|
}
|
||||||
if ((commit = get_revision(&rev)) != NULL) {
|
if ((commit = get_revision(&rev)) != NULL) {
|
||||||
cgit_log_link("[next]", NULL, NULL, cgit_query_head,
|
cgit_log_link("[next]", NULL, NULL, cgit_query_head,
|
||||||
cgit_query_sha1, cgit_query_path,
|
cgit_query_sha1, cgit_query_path,
|
||||||
ofs + cnt);
|
ofs + cnt, cgit_query_grep,
|
||||||
|
cgit_query_search);
|
||||||
}
|
}
|
||||||
html("</div>");
|
html("</div>");
|
||||||
}
|
}
|
||||||
|
@ -98,7 +98,8 @@ void cgit_print_repolist(struct cacheitem *item)
|
|||||||
html_link_open(cgit_repourl(cgit_repo->url),
|
html_link_open(cgit_repourl(cgit_repo->url),
|
||||||
NULL, "button");
|
NULL, "button");
|
||||||
html("summary</a>");
|
html("summary</a>");
|
||||||
cgit_log_link("log", NULL, "button", NULL, NULL, NULL, 0);
|
cgit_log_link("log", NULL, "button", NULL, NULL, NULL,
|
||||||
|
0, NULL, NULL);
|
||||||
cgit_tree_link("tree", NULL, "button", NULL, NULL, NULL);
|
cgit_tree_link("tree", NULL, "button", NULL, NULL, NULL);
|
||||||
html("</td>");
|
html("</td>");
|
||||||
}
|
}
|
||||||
|
13
ui-shared.c
13
ui-shared.c
@ -194,7 +194,7 @@ void cgit_tree_link(char *name, char *title, char *class, char *head,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void cgit_log_link(char *name, char *title, char *class, char *head,
|
void cgit_log_link(char *name, char *title, char *class, char *head,
|
||||||
char *rev, char *path, int ofs)
|
char *rev, char *path, int ofs, char *grep, char *pattern)
|
||||||
{
|
{
|
||||||
char *delim;
|
char *delim;
|
||||||
|
|
||||||
@ -205,6 +205,15 @@ void cgit_log_link(char *name, char *title, char *class, char *head,
|
|||||||
html_attr(rev);
|
html_attr(rev);
|
||||||
delim = "&";
|
delim = "&";
|
||||||
}
|
}
|
||||||
|
if (grep && pattern) {
|
||||||
|
html(delim);
|
||||||
|
html("qt=");
|
||||||
|
html_attr(grep);
|
||||||
|
delim = "&";
|
||||||
|
html(delim);
|
||||||
|
html("q=");
|
||||||
|
html_attr(pattern);
|
||||||
|
}
|
||||||
if (ofs > 0) {
|
if (ofs > 0) {
|
||||||
html(delim);
|
html(delim);
|
||||||
html("ofs=");
|
html("ofs=");
|
||||||
@ -461,7 +470,7 @@ void cgit_print_pageheader(char *title, int show_search)
|
|||||||
reporevlink(NULL, "summary", NULL, "menu", cgit_query_head,
|
reporevlink(NULL, "summary", NULL, "menu", cgit_query_head,
|
||||||
NULL, NULL);
|
NULL, NULL);
|
||||||
cgit_log_link("log", NULL, "menu", cgit_query_head,
|
cgit_log_link("log", NULL, "menu", cgit_query_head,
|
||||||
cgit_query_sha1, cgit_query_path, 0);
|
cgit_query_sha1, cgit_query_path, 0, NULL, NULL);
|
||||||
cgit_tree_link("tree", NULL, "menu", cgit_query_head,
|
cgit_tree_link("tree", NULL, "menu", cgit_query_head,
|
||||||
cgit_query_sha1, NULL);
|
cgit_query_sha1, NULL);
|
||||||
cgit_commit_link("commit", NULL, "menu", cgit_query_head,
|
cgit_commit_link("commit", NULL, "menu", cgit_query_head,
|
||||||
|
@ -56,7 +56,7 @@ static int print_branch(struct refinfo *ref)
|
|||||||
if (!info)
|
if (!info)
|
||||||
return 1;
|
return 1;
|
||||||
html("<tr><td>");
|
html("<tr><td>");
|
||||||
cgit_log_link(name, NULL, NULL, name, NULL, NULL, 0);
|
cgit_log_link(name, NULL, NULL, name, NULL, NULL, 0, NULL, NULL);
|
||||||
html("</td><td>");
|
html("</td><td>");
|
||||||
|
|
||||||
if (ref->object->type == OBJ_COMMIT) {
|
if (ref->object->type == OBJ_COMMIT) {
|
||||||
|
@ -100,7 +100,7 @@ static int ls_item(const unsigned char *sha1, const char *base, int baselen,
|
|||||||
|
|
||||||
html("<td>");
|
html("<td>");
|
||||||
cgit_log_link("log", NULL, "button", cgit_query_head, curr_rev,
|
cgit_log_link("log", NULL, "button", cgit_query_head, curr_rev,
|
||||||
fullpath, 0);
|
fullpath, 0, NULL, NULL);
|
||||||
html("</td></tr>\n");
|
html("</td></tr>\n");
|
||||||
free(name);
|
free(name);
|
||||||
return 0;
|
return 0;
|
||||||
|
Chargement…
Référencer dans un nouveau ticket
Block a user