diff options
author | Jonathan Schoeffling <jonathan.schoeffling@lmco.com> | 2015-06-15 01:04:20 +0300 |
---|---|---|
committer | Michael Chmielewski <code@mikec.123mail.org> | 2015-10-29 05:34:39 +0300 |
commit | 5a5069969ce8e9184e36abbb7623bf474d5869e9 (patch) | |
tree | ad20f6d4f79b67a26a6237e95e37b1af42517970 /app/views/search | |
parent | 8c9e1df98eb45e3305ab5badc6727580e84d36e0 (diff) |
Add support for searching commit log messages
Include the log messages of recent commits in project-level search
results, providing functionality similar to 'git log --grep'.
Update repository model rspec tests to validate the output of
Repository#commits_with_log_matching.
Diffstat (limited to 'app/views/search')
-rw-r--r-- | app/views/search/_category.html.haml | 7 | ||||
-rw-r--r-- | app/views/search/results/_commits.html.haml | 32 |
2 files changed, 39 insertions, 0 deletions
diff --git a/app/views/search/_category.html.haml b/app/views/search/_category.html.haml index d637abfa76b..ef43f727d8b 100644 --- a/app/views/search/_category.html.haml +++ b/app/views/search/_category.html.haml @@ -42,6 +42,13 @@ Wiki %span.badge = @search_results.wiki_blobs_count + %li{class: ("active" if @scope == 'commits')} + = link_to search_filter_path(scope: 'commits') do + = icon('history fw') + %span + Commit Logs + %span.badge + = @search_results.commits_count - elsif @show_snippets %li{class: ("active" if @scope == 'snippet_blobs')} diff --git a/app/views/search/results/_commits.html.haml b/app/views/search/results/_commits.html.haml new file mode 100644 index 00000000000..8076174e59d --- /dev/null +++ b/app/views/search/results/_commits.html.haml @@ -0,0 +1,32 @@ +.search-result-row + .commits-row-title + %strong.str-truncated + = link_to commits.title, namespace_project_commit_path(@project.namespace, @project, commits.id), class: "commit_short_id" + + .pull-right + = link_to commits.short_id, namespace_project_commit_path(@project.namespace, @project, commits.id), class: "commit_short_id" + + .notes_count + - if @note_counts + - note_count = @note_counts.fetch(commits.id, 0) + - else + - notes = commits.notes + - note_count = notes.user.count + + - if note_count > 0 + %span.light + %i.fa.fa-comments + = note_count + + - if commits.description? + .commits-row-description + %pre + = preserve(gfm(escape_once(commits.description))) + + .commits-row-info + = commit_author_link(commits, avatar: true, size: 24) + authored + .committed_ago + #{time_ago_with_tooltip(commits.committed_date)} + = link_to_browse_code(@project, commits) + %br |