From 307e85287c583e559f45b1ab79f54d42d89770a5 Mon Sep 17 00:00:00 2001 From: Hans de Graaff Date: Wed, 10 Dec 2008 21:30:43 +0100 Subject: [PATCH] OpenSearch support. This implements #804. --- app/controllers/integrations_controller.rb | 10 ++++++++++ app/views/integrations/search_plugin.rxml | 14 ++++++++++++++ app/views/layouts/standard.html.erb | 3 +++ config/routes.rb | 1 + 4 files changed, 28 insertions(+) create mode 100644 app/views/integrations/search_plugin.rxml diff --git a/app/controllers/integrations_controller.rb b/app/controllers/integrations_controller.rb index 1b071c1e..26f5f99d 100644 --- a/app/controllers/integrations_controller.rb +++ b/app/controllers/integrations_controller.rb @@ -1,5 +1,7 @@ class IntegrationsController < ApplicationController + skip_before_filter :login_required, :only => :search_plugin + def index @page_title = 'TRACKS::Integrations' end @@ -22,4 +24,12 @@ class IntegrationsController < ApplicationController context = current_user.contexts.find params[:context_id] render :partial => 'applescript2', :locals => { :context => context } end + + def search_plugin + @icon_data = [File.open(RAILS_ROOT + '/public/images/done.png').read]. + pack('m').gsub(/\n/, '') + + render :layout => false + end + end diff --git a/app/views/integrations/search_plugin.rxml b/app/views/integrations/search_plugin.rxml new file mode 100644 index 00000000..f0c8b256 --- /dev/null +++ b/app/views/integrations/search_plugin.rxml @@ -0,0 +1,14 @@ +xml.instruct! + +xml.OpenSearchDescription 'xmlns' => "http://a9.com/-/spec/opensearch/1.1/" do + + xml.ShortName Tracks + xml.Description 'Search in Tracks' + xml.InputEncoding 'UTF-8' + xml.Image("data:image/x-icon;base64," + @icon_data, + 'width' => '16', 'height' => '16') + xml.Url 'type' => 'text/html', 'method' => 'GET', + 'template' => url_for(:controller => 'search', :action => 'results', + :only_path => false) + '?search={searchTerms}' +end + diff --git a/app/views/layouts/standard.html.erb b/app/views/layouts/standard.html.erb index 82a9dc75..ba511e16 100644 --- a/app/views/layouts/standard.html.erb +++ b/app/views/layouts/standard.html.erb @@ -19,6 +19,9 @@ <%= auto_discovery_link_tag(:rss, {:controller => "todos", :action => "index", :format => 'rss', :token => "#{current_user.token}"}, {:title => "RSS feed of next actions"}) %> +