Author: assaf
Date: Wed Jun 25 11:38:10 2008
New Revision: 671622
URL: http://svn.apache.org/viewvc?rev=671622&view=rev
Log:
Added Ferret search for tasks.
Added:
ode/sandbox/singleshot/config/ferret_server.yml
ode/sandbox/singleshot/script/ferret_server (with props)
Modified:
ode/sandbox/singleshot/app/controllers/tasks_controller.rb
ode/sandbox/singleshot/app/models/task.rb
ode/sandbox/singleshot/config/environment.rb
ode/sandbox/singleshot/config/initializers/libs.rb
ode/sandbox/singleshot/config/routes.rb
Modified: ode/sandbox/singleshot/app/controllers/tasks_controller.rb
URL:
http://svn.apache.org/viewvc/ode/sandbox/singleshot/app/controllers/tasks_controller.rb?rev=671622&r1=671621&r2=671622&view=diff
==============================================================================
--- ode/sandbox/singleshot/app/controllers/tasks_controller.rb (original)
+++ ode/sandbox/singleshot/app/controllers/tasks_controller.rb Wed Jun 25
11:38:10 2008
@@ -1,6 +1,6 @@
class TasksController < ApplicationController
- access_key_authentication :only=>[:index, :completed, :following, :show]
+ access_key_authentication :only=>[:search, :completed, :following, :show]
verify :params=>:task, :only=>:update, :render=>{:text=>'Missing task',
:status=>:bad_request}
before_filter :set_task, :only=>[:show, :update, :complete, :destroy]
@@ -53,6 +53,17 @@
end
end
+ def search
+ @query = @title = params['query'] || ''
+ [EMAIL PROTECTED] = { Mime::HTML=>search_url('query'=>@query)
+ # Mime::ATOM=>formatted_tasks_url(:format=>:atom,
:access_key=>authenticated.access_key),
+ # Mime::ICS=>formatted_tasks_url(:format=>:ics,
:access_key=>authenticated.access_key) }
+ ids = Task.find_id_by_contents(@query).last.map { |h| h[:id] }
+ @tasks = Task.for_stakeholder(authenticated).with_stakeholders.find(:all,
:conditions=>{ :id=>ids })
+ render :action=>'following'
+ end
+
+
def show
@title = @task.title
@alternate = { Mime::HTML=>task_url(@task),
@@ -70,8 +81,6 @@
end
end
-
-
def update
# TODO: rescue ActiveRecord::ReadOnlyRecord
@task.modify_by(authenticated).update_attributes!(params[:task])
Modified: ode/sandbox/singleshot/app/models/task.rb
URL:
http://svn.apache.org/viewvc/ode/sandbox/singleshot/app/models/task.rb?rev=671622&r1=671621&r2=671622&view=diff
==============================================================================
--- ode/sandbox/singleshot/app/models/task.rb (original)
+++ ode/sandbox/singleshot/app/models/task.rb Wed Jun 25 11:38:10 2008
@@ -27,6 +27,8 @@
class Task < ActiveRecord::Base
+ acts_as_ferret
+
def initialize(attributes = {}) #:nodoc:
super
self.description ||= ''
Modified: ode/sandbox/singleshot/config/environment.rb
URL:
http://svn.apache.org/viewvc/ode/sandbox/singleshot/config/environment.rb?rev=671622&r1=671621&r2=671622&view=diff
==============================================================================
--- ode/sandbox/singleshot/config/environment.rb (original)
+++ ode/sandbox/singleshot/config/environment.rb Wed Jun 25 11:38:10 2008
@@ -26,9 +26,9 @@
# config.gem "bj"
# config.gem "hpricot", :version => '0.6', :source =>
"http://code.whytheluckystiff.net"
# config.gem "aws-s3", :lib => "aws/s3"
- config.gem 'rest-open-uri', :version=>'1.0.0'
- config.gem 'rmagick' # Required by sparklines
- config.gem 'sparklines', :version=>'0.5.1'
+ config.gem 'rest-open-uri', :version=>'1.0.0'
+ config.gem 'sparklines', :version=>'0.5.1'
+ config.gem 'acts_as_ferret', :version=>'0.4.3'
# Only load the plugins named here, in the order given. By default, all
plugins
# in vendor/plugins are loaded in alphabetical order.
Added: ode/sandbox/singleshot/config/ferret_server.yml
URL:
http://svn.apache.org/viewvc/ode/sandbox/singleshot/config/ferret_server.yml?rev=671622&view=auto
==============================================================================
--- ode/sandbox/singleshot/config/ferret_server.yml (added)
+++ ode/sandbox/singleshot/config/ferret_server.yml Wed Jun 25 11:38:10 2008
@@ -0,0 +1,23 @@
+# configuration for the acts_as_ferret DRb server
+# host: where to reach the DRb server (used by application processes to
contact the server)
+# port: which port the server should listen on
+# pid_file: location of the server's pid file (relative to RAILS_ROOT)
+# log_file: log file (default: RAILS_ROOT/log/ferret_server.log
+# log_level: log level for the server's logger
+production:
+ host: localhost
+ port: 9010
+ pid_file: log/ferret.pid
+ log_file: log/ferret_server.log
+ log_level: warn
+
+# aaf won't try to use the DRb server in environments that are not
+# configured here.
+#development:
+# host: localhost
+# port: 9010
+# pid_file: log/ferret.pid
+#test:
+# host: localhost
+# port: 9009
+# pid_file: log/ferret.pid
Modified: ode/sandbox/singleshot/config/initializers/libs.rb
URL:
http://svn.apache.org/viewvc/ode/sandbox/singleshot/config/initializers/libs.rb?rev=671622&r1=671621&r2=671622&view=diff
==============================================================================
--- ode/sandbox/singleshot/config/initializers/libs.rb (original)
+++ ode/sandbox/singleshot/config/initializers/libs.rb Wed Jun 25 11:38:10 2008
@@ -1,4 +1,5 @@
require 'rest-open-uri'
+require 'acts_as_ferret'
require File.join(Rails.root, 'lib/patches')
require File.join(Rails.root, 'lib/extensions')
require File.join(Rails.root, 'lib/singleshot')
Modified: ode/sandbox/singleshot/config/routes.rb
URL:
http://svn.apache.org/viewvc/ode/sandbox/singleshot/config/routes.rb?rev=671622&r1=671621&r2=671622&view=diff
==============================================================================
--- ode/sandbox/singleshot/config/routes.rb (original)
+++ ode/sandbox/singleshot/config/routes.rb Wed Jun 25 11:38:10 2008
@@ -12,6 +12,7 @@
opts.activity 'activity.:format', :name_prefix=>'formatted_task_'
end
end
+ map.search '/search', :controller=>'tasks', :action=>'search'
map.with_options :controller=>'activity', :action=>'index' do |opts|
opts.activity '/activity'
opts.formatted_activity '/activity.:format'
Added: ode/sandbox/singleshot/script/ferret_server
URL:
http://svn.apache.org/viewvc/ode/sandbox/singleshot/script/ferret_server?rev=671622&view=auto
==============================================================================
--- ode/sandbox/singleshot/script/ferret_server (added)
+++ ode/sandbox/singleshot/script/ferret_server Wed Jun 25 11:38:10 2008
@@ -0,0 +1,10 @@
+#!/usr/bin/env ruby
+
+begin
+ require File.join(File.dirname(__FILE__),
'../vendor/plugins/acts_as_ferret/lib/server_manager')
+rescue LoadError
+ # try the gem
+ require 'rubygems'
+ gem 'acts_as_ferret'
+ require 'server_manager'
+end
Propchange: ode/sandbox/singleshot/script/ferret_server
------------------------------------------------------------------------------
svn:executable = *