Commit 1b715df10c47e1cf164188895a32c2968463b315

Display some advanced search tips on the search page
  
2424 def show
2525 unless params[:q].blank?
2626 @search = Ultrasphinx::Search.new({
27 :query => params[:q], :page => (params[:page] || 1)
27 :query => params[:q], :page => (params[:page] || 1),
28 :per_page => 30,
2829 })
2930 @search.run
3031 @results = @search.results
  
2020#++
2121%>
2222
23<% hide_tips ||= false -%>
24
2325<div class="search_bar">
2426<% form_for :search, :url => search_path(:only_path => false,
2527 :host => GitoriousConfig["gitorious_host"], :protocol => "http"),
3030 <%= text_field_tag :q, params[:q], :class => "text search-field round-5" -%>
3131 <input type="submit" value="<%= t("views.searches.search") %>" class="search-submit round-5" />
3232</p>
33<p class="hint search-hint"><%= t("views.searches.hint") %></p>
33<p class="hint search-hint">
34 <%= t("views.searches.hint") %>
35 <% unless hide_tips -%>
36 - <small><a href="#advanced" onclick="$('search_help').toggle()">Advanced search tips</a></small>
37 <% end -%>
38</p>
3439<% end -%>
3540</div>
  
2525 <%= @page_title -%>
2626</h1>
2727
28<%= render :partial => "search_box" -%>
28<% if @search -%>
29 <p class="hint search_time">
30 <small><%= t("views.searches.found", :count => @search.total_entries,
31 :time => @search.time) %></small>
32 </p>
33<% end -%>
2934
35<%= render :partial => "search_box", :locals => {:hide_tips => false} -%>
36
37<div id="search_help" style="display:none">
38<% help_box(:left) do -%>
39 <p>
40 Any combination of the following keys can be used to narrow down
41 the search results, simply type <code>key:text</code> into the search field
42 to search for <em>text</em> within the scope of the <em>key</em> described below:
43 </p>
44 <h5>Projects</h5>
45 <ul>
46 <li><code>title</code>: Project title</li>
47 <li><code>description</code>: Project description</li>
48 <li><code>slug</code>: Project slug</li>
49 <li><code>category</code>: Project category</li>
50 <li><code>user</code>: Project creator username</li>
51 </ul>
52 <h5>Repositories</h5>
53 <ul>
54 <li><code>name</code>: Repository name</li>
55 <li><code>description</code>: Repository description</li>
56 </ul>
57 <h5>Comments</h5>
58 <ul>
59 <li><code>body</code>: Comment body</li>
60 <li><code>commented_by</code>: Comment creator username</li>
61 </ul>
62 <h5>Merge Requests</h5>
63 <ul>
64 <li><code>proposal</code>: Merge request proposal body</li>
65 <li><code>proposed_by</code>: Merge request creator username</li>
66 </ul>
67<% end -%>
68</div>
69
3070<div class="search_results">
3171<% if @search -%>
32
3372 <% if @results.empty? -%>
3473 <p><%= t("views.searches.no_results", :term => h(force_utf8(params[:q]))) %></p>
3574 <% else -%>
7979 <% end -%>
8080 <%= will_paginate(@search) -%>
8181 <% end -%>
82
83 <p class="hint">
84 <small><%= t("views.searches.found", :count => @search.total_entries, :time => @search.time) %></small>
85 </p>
86
8782<% end -%>
8883</div>
  
18981898 margin: 0 10px 10px 10px;
18991899}
19001900
1901.search_time {
1902 float: right;
1903}
1904
19011905.search_results strong.highlight {
19021906 background: #ff0;
19031907 font-weight: normal;