implement synapse autocomplete controller function to make the results distinct. fixes #139
This commit is contained in:
parent
6ed19db3ec
commit
f714212423
2 changed files with 14 additions and 1 deletions
|
@ -61,6 +61,9 @@ function nodeDoubleClickHandler(node, e) {
|
||||||
|
|
||||||
}//doubleClickNodeHandler
|
}//doubleClickNodeHandler
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Returns a boolean saying if the node was double clicked in our understanding of the word
|
||||||
|
*/
|
||||||
function nodeWasDoubleClicked() {
|
function nodeWasDoubleClicked() {
|
||||||
//grab the timestamp of the click
|
//grab the timestamp of the click
|
||||||
var storedTime = MetamapsModel.lastNodeClick;
|
var storedTime = MetamapsModel.lastNodeClick;
|
||||||
|
|
|
@ -5,7 +5,17 @@ class SynapsesController < ApplicationController
|
||||||
|
|
||||||
respond_to :html, :js, :json
|
respond_to :html, :js, :json
|
||||||
|
|
||||||
autocomplete :synapse, :desc, :full => true
|
def autocomplete_synapse_desc
|
||||||
|
term = params[:term]
|
||||||
|
if term && !term.empty?
|
||||||
|
items = Synapse.select('DISTINCT "desc"').
|
||||||
|
where('LOWER("desc") like ?', term.downcase + '%').
|
||||||
|
limit(10).order('"desc"')
|
||||||
|
else
|
||||||
|
items = {}
|
||||||
|
end
|
||||||
|
render :json => json_for_autocomplete(items, :desc)
|
||||||
|
end
|
||||||
|
|
||||||
# GET synapses
|
# GET synapses
|
||||||
# or GET users/:user_id/synapses
|
# or GET users/:user_id/synapses
|
||||||
|
|
Loading…
Reference in a new issue