Commit 1b715df10c47e1cf164188895a32c2968463b315
- Diff rendering mode:
- inline
- side by side
|   | |||
| 24 | 24 | def show | |
| 25 | 25 | unless params[:q].blank? | |
| 26 | 26 | @search = Ultrasphinx::Search.new({ | |
| 27 | :query => params[:q], :page => (params[:page] || 1) | ||
| 27 | :query => params[:q], :page => (params[:page] || 1), | ||
| 28 | :per_page => 30, | ||
| 28 | 29 | }) | |
| 29 | 30 | @search.run | |
| 30 | 31 | @results = @search.results |
|   | |||
| 20 | 20 | #++ | |
| 21 | 21 | %> | |
| 22 | 22 | ||
| 23 | <% hide_tips ||= false -%> | ||
| 24 | |||
| 23 | 25 | <div class="search_bar"> | |
| 24 | 26 | <% form_for :search, :url => search_path(:only_path => false, | |
| 25 | 27 | :host => GitoriousConfig["gitorious_host"], :protocol => "http"), | |
| … | … | ||
| 30 | 30 | <%= text_field_tag :q, params[:q], :class => "text search-field round-5" -%> | |
| 31 | 31 | <input type="submit" value="<%= t("views.searches.search") %>" class="search-submit round-5" /> | |
| 32 | 32 | </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> | ||
| 34 | 39 | <% end -%> | |
| 35 | 40 | </div> |
app/views/searches/show.html.erb
(41 / 7)
|   | |||
| 25 | 25 | <%= @page_title -%> | |
| 26 | 26 | </h1> | |
| 27 | 27 | ||
| 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 -%> | ||
| 29 | 34 | ||
| 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 | |||
| 30 | 70 | <div class="search_results"> | |
| 31 | 71 | <% if @search -%> | |
| 32 | |||
| 33 | 72 | <% if @results.empty? -%> | |
| 34 | 73 | <p><%= t("views.searches.no_results", :term => h(force_utf8(params[:q]))) %></p> | |
| 35 | 74 | <% else -%> | |
| … | … | ||
| 79 | 79 | <% end -%> | |
| 80 | 80 | <%= will_paginate(@search) -%> | |
| 81 | 81 | <% end -%> | |
| 82 | |||
| 83 | <p class="hint"> | ||
| 84 | <small><%= t("views.searches.found", :count => @search.total_entries, :time => @search.time) %></small> | ||
| 85 | </p> | ||
| 86 | |||
| 87 | 82 | <% end -%> | |
| 88 | 83 | </div> |
public/stylesheets/base.css
(4 / 0)
|   | |||
| 1898 | 1898 | margin: 0 10px 10px 10px; | |
| 1899 | 1899 | } | |
| 1900 | 1900 | ||
| 1901 | .search_time { | ||
| 1902 | float: right; | ||
| 1903 | } | ||
| 1904 | |||
| 1901 | 1905 | .search_results strong.highlight { | |
| 1902 | 1906 | background: #ff0; | |
| 1903 | 1907 | font-weight: normal; |

