mirror of
https://github.com/TracksApp/tracks.git
synced 2026-01-15 05:38:52 +01:00
use twitter/typeahead for autocomplete. make go to project|context|tag work and show
project details in a popover
This commit is contained in:
parent
31386db3df
commit
c0edd1749c
19 changed files with 1924 additions and 187 deletions
|
|
@ -31,7 +31,9 @@ class ContextsController < ApplicationController
|
|||
headers['Content-Type']=Mime::TEXT.to_s
|
||||
render :action => 'index', :layout => false, :content_type => Mime::TEXT
|
||||
end
|
||||
format.autocomplete &render_autocomplete
|
||||
format.autocomplete do
|
||||
render :text => for_autocomplete(@all_contexts, params[:query] || params[:term])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -220,12 +222,6 @@ class ContextsController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
def render_autocomplete
|
||||
lambda do
|
||||
render :text => for_autocomplete(current_user.contexts, params[:term])
|
||||
end
|
||||
end
|
||||
|
||||
def feed_options
|
||||
Context.feed_options(current_user)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -685,12 +685,13 @@ class TodosController < ApplicationController
|
|||
|
||||
def tags
|
||||
# TODO: limit to current_user
|
||||
tags_beginning = Tag.where('name like ?', params[:term]+'%')
|
||||
tags_all = Tag.where('name like ?', '%'+params[:term]+'%')
|
||||
term = params[:query] || param[:term]
|
||||
tags_beginning = Tag.where('name like ?', term+'%')
|
||||
tags_all = Tag.where('name like ?', '%'+term+'%')
|
||||
tags_all= tags_all - tags_beginning
|
||||
|
||||
respond_to do |format|
|
||||
format.autocomplete { render :text => for_autocomplete(tags_beginning+tags_all, params[:term]) }
|
||||
format.autocomplete { render :text => for_autocomplete(tags_beginning+tags_all, term) }
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue