author | Lars Hjemli <hjemli@gmail.com> | 2007-10-28 14:23:00 (UTC) |
---|---|---|
committer | Lars Hjemli <hjemli@gmail.com> | 2007-10-28 14:23:00 (UTC) |
commit | 68ca032dbe7379f78775fb03ef34a9ad2abc409f (patch) (unidiff) | |
tree | 2209ae312eb932bc61b41ae9c774f6cfcc3dd372 | |
parent | 6ec5f36f279a85f59db2851ab476d9acd0015770 (diff) | |
download | cgit-68ca032dbe7379f78775fb03ef34a9ad2abc409f.zip cgit-68ca032dbe7379f78775fb03ef34a9ad2abc409f.tar.gz cgit-68ca032dbe7379f78775fb03ef34a9ad2abc409f.tar.bz2 |
Teach log search about --grep, --author and --committer
This makes the log searching more explicit, using a dropdown box to specify
the commit field to match against.
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
-rw-r--r-- | cgit.c | 2 | ||||
-rw-r--r-- | cgit.css | 19 | ||||
-rw-r--r-- | cgit.h | 4 | ||||
-rw-r--r-- | shared.c | 3 | ||||
-rw-r--r-- | ui-log.c | 9 | ||||
-rw-r--r-- | ui-shared.c | 9 | ||||
-rw-r--r-- | ui-summary.c | 2 |
7 files changed, 39 insertions, 9 deletions
@@ -96,3 +96,3 @@ static void cgit_print_repo_page(struct cacheitem *item) | |||
96 | cgit_print_log(cgit_query_sha1, cgit_query_ofs, | 96 | cgit_print_log(cgit_query_sha1, cgit_query_ofs, |
97 | cgit_max_commit_count, cgit_query_search, | 97 | cgit_max_commit_count, cgit_query_grep, cgit_query_search, |
98 | cgit_query_path, 1); | 98 | cgit_query_path, 1); |
@@ -146,2 +146,10 @@ td#search form { | |||
146 | 146 | ||
147 | td#search select { | ||
148 | font-size: 9pt; | ||
149 | padding: 0px; | ||
150 | border: solid 1px #333; | ||
151 | color: #333; | ||
152 | background-color: #fff; | ||
153 | } | ||
154 | |||
147 | td#search input { | 155 | td#search input { |
@@ -149,3 +157,6 @@ td#search input { | |||
149 | padding: 0px; | 157 | padding: 0px; |
150 | width: 10em; | 158 | } |
159 | |||
160 | td#search input.txt { | ||
161 | width: 8em; | ||
151 | border: solid 1px #333; | 162 | border: solid 1px #333; |
@@ -155,2 +166,8 @@ td#search input { | |||
155 | 166 | ||
167 | td#search input.btn { | ||
168 | border: solid 1px #333; | ||
169 | color: #333; | ||
170 | background-color: #ccc; | ||
171 | } | ||
172 | |||
156 | div#summary { | 173 | div#summary { |
@@ -160,2 +160,3 @@ extern char *cgit_query_page; | |||
160 | extern char *cgit_query_search; | 160 | extern char *cgit_query_search; |
161 | extern char *cgit_query_grep; | ||
161 | extern char *cgit_query_head; | 162 | extern char *cgit_query_head; |
@@ -262,3 +263,4 @@ extern void cgit_print_repolist(struct cacheitem *item); | |||
262 | extern void cgit_print_summary(); | 263 | extern void cgit_print_summary(); |
263 | extern void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *path, int pager); | 264 | extern void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, |
265 | char *pattern, char *path, int pager); | ||
264 | extern void cgit_print_blob(struct cacheitem *item, const char *hex, char *path); | 266 | extern void cgit_print_blob(struct cacheitem *item, const char *hex, char *path); |
@@ -56,2 +56,3 @@ char *cgit_query_head = NULL; | |||
56 | char *cgit_query_search = NULL; | 56 | char *cgit_query_search = NULL; |
57 | char *cgit_query_grep = NULL; | ||
57 | char *cgit_query_sha1 = NULL; | 58 | char *cgit_query_sha1 = NULL; |
@@ -234,2 +235,4 @@ void cgit_querystring_cb(const char *name, const char *value) | |||
234 | cgit_parse_url(value); | 235 | cgit_parse_url(value); |
236 | } else if (!strcmp(name, "qt")) { | ||
237 | cgit_query_grep = xstrdup(value); | ||
235 | } else if (!strcmp(name, "q")) { | 238 | } else if (!strcmp(name, "q")) { |
@@ -53,3 +53,3 @@ void print_commit(struct commit *commit) | |||
53 | 53 | ||
54 | void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *path, int pager) | 54 | void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern, char *path, int pager) |
55 | { | 55 | { |
@@ -64,4 +64,7 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *path, i | |||
64 | 64 | ||
65 | if (grep) | 65 | if (grep && pattern && (!strcmp(grep, "grep") || |
66 | argv[argc++] = fmt("--grep=%s", grep); | 66 | !strcmp(grep, "author") || |
67 | !strcmp(grep, "committer"))) | ||
68 | argv[argc++] = fmt("--%s=%s", grep, pattern); | ||
69 | |||
67 | if (path) { | 70 | if (path) { |
diff --git a/ui-shared.c b/ui-shared.c index e4bb98f..45105dc 100644 --- a/ui-shared.c +++ b/ui-shared.c | |||
@@ -419,5 +419,10 @@ void cgit_print_pageheader(char *title, int show_search) | |||
419 | html_hidden("id2", cgit_query_sha2); | 419 | html_hidden("id2", cgit_query_sha2); |
420 | html("<input type='text' name='q' value='"); | 420 | html("<select name='qt'>"); |
421 | html_option("grep", "log msg", cgit_query_grep); | ||
422 | html_option("author", "author", cgit_query_grep); | ||
423 | html_option("committer", "committer", cgit_query_grep); | ||
424 | html("</select>"); | ||
425 | html("<input class='txt' type='text' name='q' value='"); | ||
421 | html_attr(cgit_query_search); | 426 | html_attr(cgit_query_search); |
422 | html("'/></form>"); | 427 | html("'/><input class='btn' type='submit' value='...'/></form>"); |
423 | } | 428 | } |
diff --git a/ui-summary.c b/ui-summary.c index 178e959..04a466a 100644 --- a/ui-summary.c +++ b/ui-summary.c | |||
@@ -238,3 +238,3 @@ void cgit_print_summary() | |||
238 | if (cgit_summary_log > 0) | 238 | if (cgit_summary_log > 0) |
239 | cgit_print_log(cgit_query_head, 0, cgit_summary_log, NULL, NULL, 0); | 239 | cgit_print_log(cgit_query_head, 0, cgit_summary_log, NULL, NULL, NULL, 0); |
240 | html("<table class='list nowrap'>"); | 240 | html("<table class='list nowrap'>"); |