public
Fork of sr/git-wiki
Description: A wiki engine that uses a Git repository as its data store.
Homepage: http://atonie.org/2008/02/git-wiki
Clone URL: git://github.com/al3x/git-wiki.git
git-wiki / views / search.erb
100644 31 lines (25 sloc) 0.736 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<% if @grep.empty? %>
  <h1>No pages match</h1>
<% else %>
  <h1>Results for '<%= @search %>'</h1>
<% end %>
 
<div class="sub_nav">
  <div class="details">
    <%= @grep.size %> pages contain match<br />
    <%= @grep.map { |g| g[1].size }.inject { |acc, n| acc + n } %> results
  </div>
</div>
 
<div class="content">
  <% @grep.each do |sha, arr_match| %>
    <div class="search_result">
      <% (sha, file) = sha.split(':') %>
        <% arr_match.each do |line, match| %>
          <div class="match">
            <tt><%= match %></tt>
            <br />
            &mdash; <a href="/<%= file %>"><%= file %></a>, line <%= line %> (<%= $repo.object(sha).name %>)
          </div>
        <% end %>
    </div>
  <% end %>
</div>