mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-16 23:30:12 +01:00
Autocomplete lists should be based on "q" parameter
If you don't filter server-side, the user sees the full list until another character is entered.
This commit is contained in:
parent
9ccd6d11d8
commit
c79d1c964a
4 changed files with 6 additions and 5 deletions
|
|
@ -124,8 +124,9 @@ class ApplicationController < ActionController::Base
|
|||
end
|
||||
|
||||
|
||||
def for_autocomplete(coll)
|
||||
coll.map {|item| "#{item.name}|#{item.id}"}.join("\n")
|
||||
def for_autocomplete(coll, substr)
|
||||
filtered = coll.find_all{|item| item.name.downcase.include? substr.downcase}
|
||||
return filtered.map {|item| "#{item.name}|#{item.id}"}.join("\n")
|
||||
end
|
||||
|
||||
# Uses RedCloth to transform text using either Textile or Markdown Need to
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue