mirror of
https://github.com/TracksApp/tracks.git
synced 2026-03-08 05:32:37 +01:00
Asynchronous autocompleter for tags. Closes #462
This commit is contained in:
parent
c3b308d228
commit
746066972c
9 changed files with 350 additions and 2 deletions
|
|
@ -4,8 +4,11 @@ class TodosController < ApplicationController
|
|||
|
||||
skip_before_filter :login_required, :only => [:index, :calendar]
|
||||
prepend_before_filter :login_or_feed_token_required, :only => [:index, :calendar]
|
||||
append_before_filter :init, :except => [ :destroy, :completed, :completed_archive, :check_deferred, :toggle_check, :toggle_star, :edit, :update, :create, :calendar ]
|
||||
append_before_filter :init, :except => [ :destroy, :completed,
|
||||
:completed_archive, :check_deferred, :toggle_check, :toggle_star,
|
||||
:edit, :update, :create, :calendar, :auto_complete_for_tag]
|
||||
append_before_filter :get_todo_from_params, :only => [ :edit, :toggle_check, :toggle_star, :show, :update, :destroy ]
|
||||
protect_from_forgery :except => [:auto_complete_for_tag]
|
||||
|
||||
session :off, :only => :index, :if => Proc.new { |req| is_feed_request(req) }
|
||||
|
||||
|
|
@ -502,7 +505,16 @@ class TodosController < ApplicationController
|
|||
render :action => 'calendar', :layout => false, :content_type => Mime::ICS
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def auto_complete_for_tag
|
||||
puts params.inspect
|
||||
@items = Tag.find(:all,
|
||||
:conditions => [ "name LIKE ?", '%' + params['tag_list'] + '%' ],
|
||||
:order => "name ASC",
|
||||
:limit => 10)
|
||||
render :inline => "<%= auto_complete_result(@items, :name) %>"
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue