diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/search_controller.rb | 4 | ||||
-rw-r--r-- | app/models/project.rb | 2 | ||||
-rw-r--r-- | app/views/search/index.html.erb | 22 |
3 files changed, 25 insertions, 3 deletions
diff --git a/app/controllers/search_controller.rb b/app/controllers/search_controller.rb index 3f80b18b0..e140878a9 100644 --- a/app/controllers/search_controller.rb +++ b/app/controllers/search_controller.rb @@ -23,6 +23,7 @@ class SearchController < ApplicationController @question.strip! @all_words = params[:all_words] ? params[:all_words].present? : true @titles_only = params[:titles_only] ? params[:titles_only].present? : false + @search_attachments = params[:attachments].presence || '0' # quick jump to an issue if (m = @question.match(/^#?(\d+)$/)) && (issue = Issue.visible.find_by_id(m[1].to_i)) @@ -55,7 +56,8 @@ class SearchController < ApplicationController fetcher = Redmine::Search::Fetcher.new( @question, User.current, @scope, projects_to_search, - :all_words => @all_words, :titles_only => @titles_only, :cache => params[:page].present? + :all_words => @all_words, :titles_only => @titles_only, :attachments => @search_attachments, + :cache => params[:page].present? ) if fetcher.tokens.present? diff --git a/app/models/project.rb b/app/models/project.rb index fa035b022..53613b097 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -64,7 +64,7 @@ class Project < ActiveRecord::Base :delete_permission => :manage_files acts_as_customizable - acts_as_searchable :columns => ['name', 'identifier', 'description'], :project_key => 'id', :permission => nil + acts_as_searchable :columns => ['name', 'identifier', 'description'], :project_key => "#{Project.table_name}.id", :permission => nil acts_as_event :title => Proc.new {|o| "#{l(:label_project)}: #{o.name}"}, :url => Proc.new {|o| {:controller => 'projects', :action => 'show', :id => o}}, :author => nil diff --git a/app/views/search/index.html.erb b/app/views/search/index.html.erb index 6bbe8d482..aaf08d369 100644 --- a/app/views/search/index.html.erb +++ b/app/views/search/index.html.erb @@ -17,9 +17,21 @@ <% end %> </p> +<fieldset class="collapsible collapsed"> + <legend onclick="toggleFieldset(this);"><%= l(:label_options) %></legend> + <div id="options-content" style="display:none;"> + <p> + <label><%= radio_button_tag 'attachments', '0', @search_attachments == '0' %> <%= l(:label_search_attachments_no) %></label> + <label><%= radio_button_tag 'attachments', '1', @search_attachments == '1' %> <%= l(:label_search_attachments_yes) %></label> + <label><%= radio_button_tag 'attachments', 'only', @search_attachments == 'only' %> <%= l(:label_search_attachments_only) %></label> + </p> + </div> +</fieldset> +<%= hidden_field_tag 'options', '', :id => 'show-options' %> + +</div> <p><%= submit_tag l(:button_submit) %></p> <% end %> -</div> <% if @results %> <div id="search-results-counts"> @@ -53,4 +65,12 @@ $("#search-types a").click(function(e){ $("#search-form").submit(); } }); + +$("#search-form").submit(function(){ + $("#show-options").val($("#options-content").is(":visible") ? '1' : '0'); +}); + +<% if params[:options] == '1' %> +toggleFieldset($("#options-content")); +<% end %> <% end %> |