]> git.openstreetmap.org Git - rails.git/commitdiff
search done
authorSteve Coast <steve@asklater.com>
Sat, 7 Apr 2007 18:21:12 +0000 (18:21 +0000)
committerSteve Coast <steve@asklater.com>
Sat, 7 Apr 2007 18:21:12 +0000 (18:21 +0000)
app/controllers/site_controller.rb
app/views/site/index.rhtml
app/views/site/search.rhtml [new file with mode: 0644]
config/routes.rb

index f4ccd3c742cc7e1ebb9fd1e56a98d7ae2ce86a62..58a009a3b81a4e2a98f844ebc5e784aa500d3cf3 100644 (file)
@@ -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
index 670f10a207558fe8d3e82ddc8a66c8850d6f1bb7..78623603a23b201c8219b57b6b45e82e3b1e8370 100644 (file)
@@ -1,8 +1,10 @@
+
+
 <div id="geocoder">
-  <form action="/search.html">
-    <input type="text" name="query" value="" size="60">
-    <input type="submit" value="Search">
-  </form>
+  <%= start_form_tag :controller => 'site', :action => 'search' %>
+  <%= text_field 'query', 'query'%>
+  <%= submit_tag 'Search' %>
+  <%= end_form_tag %>
 </div>
 
 
diff --git a/app/views/site/search.rhtml b/app/views/site/search.rhtml
new file mode 100644 (file)
index 0000000..4c7f38d
--- /dev/null
@@ -0,0 +1,24 @@
+<h2>Search results</h5>
+fixme postcodes and geonames
+
+<%= start_form_tag :controller => 'site', :action => 'search' %>
+<%= text_field 'query', 'query'%>
+<%= submit_tag 'Search' %>
+<%= end_form_tag %>
+
+
+<table border="0"> 
+  <% @tags.each do |tag| %>
+  <tr>
+    <td>
+      <%= link_to tag.v, :controller => 'site', :action => 'goto_way', :id => tag.id %> (k:<%= tag.k %>)<br>
+      <font size="-2" color="green">
+        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 %>
+        <br /><br/ >
+      </font>
+    </td>
+  </tr>
+  <% end %>
+</table>
index 1a3d2f85d6432251af90ebafb66b72b723474f92..b34948a6c770ad2417ad5b062829b5a403f04db6 100644 (file)
@@ -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'