diff options
| author | hukl <contact@smyck.org> | 2009-06-10 23:21:39 +0200 |
|---|---|---|
| committer | hukl <contact@smyck.org> | 2009-06-10 23:21:39 +0200 |
| commit | 9c5108ffab6828562c5a976ddb92ac0ec459a9a3 (patch) | |
| tree | 267099b94b50395ed629460d26f4e5641619de08 /app/controllers/admin_controller.rb | |
| parent | 45e067f1108748067b727a53e7826cebbb429792 (diff) | |
added basic ajax search interface. lots of css / js improvements needed but it seems to work quite okay for now. more on that tomorrow
Diffstat (limited to 'app/controllers/admin_controller.rb')
| -rw-r--r-- | app/controllers/admin_controller.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index 55c66cf..8d7d2ea 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb | |||
| @@ -12,4 +12,19 @@ class AdminController < ApplicationController | |||
| 12 | ) | 12 | ) |
| 13 | end | 13 | end |
| 14 | 14 | ||
| 15 | def search | ||
| 16 | @results = Node.search params[:search_term] | ||
| 17 | |||
| 18 | respond_to do |format| | ||
| 19 | format.html | ||
| 20 | format.js do | ||
| 21 | render( :json => @results.map do |node| | ||
| 22 | {:id => node.id, :title => node.title} | ||
| 23 | end | ||
| 24 | ) | ||
| 25 | |||
| 26 | end | ||
| 27 | end | ||
| 28 | end | ||
| 29 | |||
| 15 | end | 30 | end |
