adds search to tracks. you can search now on todos, projects and notes. This patch was contributed by Jeffrey Gipson. Thanks Jeffrey!

git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@853 a4c988fc-2ded-0310-b66e-134b36920a42
This commit is contained in:
lrbalt 2008-05-22 08:33:15 +00:00
parent 6a42901514
commit 6136efdb7f
15 changed files with 407 additions and 322 deletions

View file

@ -0,0 +1,27 @@
class SearchController < ApplicationController
helper :todos, :application, :notes, :projects
def results
@source_view = params['_source_view'] || 'search'
@page_title = "TRACKS::Search Results for #{params[:search]}"
terms = '%' + params[:search] + '%'
@found_todos = current_user.todos.find(:all, :conditions => ["todos.description LIKE ? OR todos.notes LIKE ?", terms, terms], :include => [:tags, :project, :context])
@found_projects = current_user.projects.find(:all, :conditions => ["name LIKE ? or description LIKE ?", terms, terms])
@found_notes = current_user.notes.find(:all, :conditions => ["body LIKE ?", terms])
@count = @found_todos.size + @found_projects.size + @found_notes.size
init_not_done_counts(['project'])
init_project_hidden_todo_counts(['project'])
end
def index
@page_title = "TRACKS::Search"
end
def init
@source_view = params['_source_view'] || 'search'
end
end