From 6b4803d87fc957d0a779ebedc39e8499af1b7733 Mon Sep 17 00:00:00 2001 From: Steve Coast Date: Sat, 7 Apr 2007 18:21:12 +0000 Subject: [PATCH] search done --- app/controllers/site_controller.rb | 5 ++++- app/views/site/index.rhtml | 10 ++++++---- app/views/site/search.rhtml | 24 ++++++++++++++++++++++++ config/routes.rb | 1 + 4 files changed, 35 insertions(+), 5 deletions(-) create mode 100644 app/views/site/search.rhtml diff --git a/app/controllers/site_controller.rb b/app/controllers/site_controller.rb index f4ccd3c74..58a009a3b 100644 --- a/app/controllers/site_controller.rb +++ b/app/controllers/site_controller.rb @@ -1,7 +1,10 @@ class SiteController < ApplicationController before_filter :authorize_web before_filter :require_user, :only => [:edit] - def index + + def search + @tags = WayTag.find(:all, :conditions => ["match(v) against (?)", params[:query][:query].to_s] ) end + end diff --git a/app/views/site/index.rhtml b/app/views/site/index.rhtml index 670f10a20..78623603a 100644 --- a/app/views/site/index.rhtml +++ b/app/views/site/index.rhtml @@ -1,8 +1,10 @@ + +
-
- - -
+ <%= start_form_tag :controller => 'site', :action => 'search' %> + <%= text_field 'query', 'query'%> + <%= submit_tag 'Search' %> + <%= end_form_tag %>
diff --git a/app/views/site/search.rhtml b/app/views/site/search.rhtml new file mode 100644 index 000000000..4c7f38d99 --- /dev/null +++ b/app/views/site/search.rhtml @@ -0,0 +1,24 @@ +

Search results

+fixme postcodes and geonames + +<%= start_form_tag :controller => 'site', :action => 'search' %> +<%= text_field 'query', 'query'%> +<%= submit_tag 'Search' %> +<%= end_form_tag %> + + + + <% @tags.each do |tag| %> + + + + <% end %> +
+ <%= link_to tag.v, :controller => 'site', :action => 'goto_way', :id => tag.id %> (k:<%= tag.k %>)
+ + Way <%= tag.id %> (<%= tag.way.timestamp %>) + <%= link_to 'Map', :controller => 'site', :action => 'goto_way', :id => tag.id %> - + <%= link_to 'API', :controller => 'way', :action => 'rest', :id => tag.id %> +

+
+
diff --git a/config/routes.rb b/config/routes.rb index 1a3d2f85d..b34948a6c 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -30,6 +30,7 @@ ActionController::Routing::Routes.draw do |map| map.connect '/', :controller => 'site', :action => 'index' map.connect '/index.html', :controller => 'site', :action => 'index' map.connect '/edit.html', :controller => 'site', :action => 'edit' + map.connect '/search.html', :controller => 'site', :action => 'search' map.connect '/login.html', :controller => 'user', :action => 'login' map.connect '/logout.html', :controller => 'user', :action => 'logout' map.connect '/create-account.html', :controller => 'user', :action => 'new' -- 2.43.2