You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.html.erb 3.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <h2><%= l(:label_search) %></h2>
  2. <%= form_tag({}, :method => :get, :id => 'search-form') do %>
  3. <div class="box">
  4. <%= label_tag "search-input", l(:description_search), :class => "hidden-for-sighted" %>
  5. <p><%= text_field_tag 'q', @question, :size => 60, :id => 'search-input',
  6. :data => {
  7. :auto_complete => true
  8. } %>
  9. <%= project_select_tag %>
  10. <%= hidden_field_tag 'all_words', '', :id => nil %>
  11. <label><%= check_box_tag 'all_words', 1, @all_words %> <%= l(:label_all_words) %></label>
  12. <%= hidden_field_tag 'titles_only', '', :id => nil %>
  13. <label><%= check_box_tag 'titles_only', 1, @titles_only %> <%= l(:label_search_titles_only) %></label>
  14. </p>
  15. <fieldset class="box">
  16. <legend><%= toggle_checkboxes_link('p#search-types input') %></legend>
  17. <p id="search-types">
  18. <% @object_types.each do |t| %>
  19. <label><%= check_box_tag t, 1, @scope.include?(t) %> <%= link_to type_label(t), "#" %></label>
  20. <% end %>
  21. </p>
  22. </fieldset>
  23. <fieldset class="collapsible collapsed">
  24. <legend onclick="toggleFieldset(this);" class="icon icon-collapsed"><%= l(:label_options) %></legend>
  25. <div id="options-content" style="display:none;">
  26. <p><label><%= check_box_tag 'open_issues', 1, @open_issues %> <%= l(:label_search_open_issues_only) %></label></p>
  27. <p>
  28. <label><%= radio_button_tag 'attachments', '0', @search_attachments == '0' %> <%= l(:label_search_attachments_no) %></label>
  29. <label><%= radio_button_tag 'attachments', '1', @search_attachments == '1' %> <%= l(:label_search_attachments_yes) %></label>
  30. <label><%= radio_button_tag 'attachments', 'only', @search_attachments == 'only' %> <%= l(:label_search_attachments_only) %></label>
  31. </p>
  32. <%= call_hook(:view_search_index_options_content_bottom) %>
  33. </div>
  34. </fieldset>
  35. <%= hidden_field_tag 'options', '', :id => 'show-options' %>
  36. </div>
  37. <p><%= submit_tag l(:label_search) %></p>
  38. <% end %>
  39. <% if @results %>
  40. <div id="search-results-counts">
  41. <%= render_results_by_type(@result_count_by_type) unless @scope.size == 1 %>
  42. </div>
  43. <h3><%= l(:label_result_plural) %> (<%= @result_count %>)</h3>
  44. <dl id="search-results">
  45. <% @results.each do |e| %>
  46. <dt class="<%= e.event_type %> icon icon-<%= e.event_type %>">
  47. <%= content_tag('span', e.project, :class => 'project') unless @project == e.project %>
  48. <%= link_to(highlight_tokens(e.event_title.truncate(255), @tokens), e.event_url) %>
  49. </dt>
  50. <dd><span class="description"><%= highlight_tokens(e.event_description, @tokens) %></span>
  51. <span class="author"><%= format_time(e.event_datetime) %></span></dd>
  52. <% end %>
  53. </dl>
  54. <% end %>
  55. <% if @result_pages %>
  56. <span class="pagination"><%= pagination_links_full @result_pages, @result_count, :per_page_links => false %></span>
  57. <% end %>
  58. <% html_title(l(:label_search)) -%>
  59. <%= javascript_tag do %>
  60. $("#search-types a").click(function(e){
  61. e.preventDefault();
  62. $("#search-types input[type=checkbox]").prop('checked', false);
  63. $(this).siblings("input[type=checkbox]").prop('checked', true);
  64. if ($("#search-input").val() != "") {
  65. $("#search-form").submit();
  66. }
  67. });
  68. $("#search-form").submit(function(){
  69. $("#show-options").val($("#options-content").is(":visible") ? '1' : '0');
  70. });
  71. <% if params[:options] == '1' %>
  72. toggleFieldset($("#options-content"));
  73. <% end %>
  74. <% end %>