Don't break jQuery-UI autocomplete with algolia's

This commit is contained in:
Rob 2016-04-21 11:21:11 -07:00
parent 3edb4612b4
commit 9fec6f6613
5 changed files with 11 additions and 5 deletions

View file

@ -61,7 +61,7 @@ module.exports = class ConvertToTeacherAccountView extends RootView
@$('#other-education-level-checkbox').attr('checked', !!otherLevel) @$('#other-education-level-checkbox').attr('checked', !!otherLevel)
@$('#other-education-level-input').val(otherLevel) @$('#other-education-level-input').val(otherLevel)
$("#organization-control").autocomplete({hint: false}, [ $("#organization-control").algolia_autocomplete({hint: false}, [
source: (query, callback) -> source: (query, callback) ->
algolia.schoolsIndex.search(query, { hitsPerPage: 5, aroundLatLngViaIP: false }).then (answer) -> algolia.schoolsIndex.search(query, { hitsPerPage: 5, aroundLatLngViaIP: false }).then (answer) ->
callback answer.hits callback answer.hits

View file

@ -60,7 +60,7 @@ module.exports = class CreateTeacherAccountView extends RootView
@$('#other-education-level-checkbox').attr('checked', !!otherLevel) @$('#other-education-level-checkbox').attr('checked', !!otherLevel)
@$('#other-education-level-input').val(otherLevel) @$('#other-education-level-input').val(otherLevel)
$("#organization-control").autocomplete({hint: false}, [ $("#organization-control").algolia_autocomplete({hint: false}, [
source: (query, callback) -> source: (query, callback) ->
algolia.schoolsIndex.search(query, { hitsPerPage: 5, aroundLatLngViaIP: false }).then (answer) -> algolia.schoolsIndex.search(query, { hitsPerPage: 5, aroundLatLngViaIP: false }).then (answer) ->
callback answer.hits callback answer.hits

View file

@ -63,7 +63,7 @@ module.exports = class RequestQuoteView extends RootView
@$('#other-education-level-checkbox').attr('checked', !!otherLevel) @$('#other-education-level-checkbox').attr('checked', !!otherLevel)
@$('#other-education-level-input').val(otherLevel) @$('#other-education-level-input').val(otherLevel)
$("#organization-control").autocomplete({hint: false}, [ $("#organization-control").algolia_autocomplete({hint: false}, [
source: (query, callback) -> source: (query, callback) ->
algolia.schoolsIndex.search(query, { hitsPerPage: 5, aroundLatLngViaIP: false }).then (answer) -> algolia.schoolsIndex.search(query, { hitsPerPage: 5, aroundLatLngViaIP: false }).then (answer) ->
callback answer.hits callback answer.hits

View file

@ -51,12 +51,16 @@
"lscache": "~1.0.5", "lscache": "~1.0.5",
"esper.js": "http://files.codecombat.com/esper.tar.gz", "esper.js": "http://files.codecombat.com/esper.tar.gz",
"algoliasearch": "^3.13.1", "algoliasearch": "^3.13.1",
"algolia-autocomplete.js": "^1.17.0" "algolia-autocomplete.js": "^1.17.0",
"algolia-autocomplete-no-conflict": "1.0.0"
}, },
"overrides": { "overrides": {
"algolia-autocomplete.js": { "algolia-autocomplete.js": {
"main": "dist/autocomplete.jquery.js" "main": "dist/autocomplete.jquery.js"
}, },
"algolia-autocomplete-no-conflict": {
"main": "no-conflict.js"
},
"backbone": { "backbone": {
"main": "backbone.js" "main": "backbone.js"
}, },

View file

@ -165,7 +165,9 @@ exports.config =
'vendor/scripts/async.js' 'vendor/scripts/async.js'
'vendor/scripts/jquery-ui-1.11.1.js.custom.js' 'vendor/scripts/jquery-ui-1.11.1.js.custom.js'
] ]
after: [
'bower_components/algolia-autocomplete-no-conflict/no-conflict.js'
]
stylesheets: stylesheets:
defaultExtension: 'sass' defaultExtension: 'sass'
joinTo: joinTo: