switch autocomplete plugin to typeahead library

This commit is contained in:
r888888888
2013-06-06 17:47:28 -07:00
parent 17cfb5f3fc
commit a0e6b20dd0
6 changed files with 45 additions and 52 deletions

View File

@@ -14,16 +14,14 @@
Danbooru.Pool.initialize_add_to_pool_link = function() {
$("#add-to-pool-dialog").dialog({autoOpen: false});
$("#c-pool-elements #a-new input[type=text]").autocomplete({
source: function(req, resp) {
$.getJSON(
"/pools.json?search[is_active]=true&search[name_matches]=" + req.term,
function(data) {
resp(data.map(function(x) {return x.name.replace(/_/g, " ");}));
}
);
},
minLength: 2,
$("#c-pool-elements #a-new input[type=text]").typeahead({
name: "pools",
remote: "/pools.json?search[is_active]=true&search[name_matches]=%QUERY",
limit: 10,
valueKey: "name",
template: function(context) {
return "<p>" + context.name.replace(/_/g, " ") + "</p>";
}
});
$("#pool").click(function(e) {