mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Make other Algolia clients use the common factory.
This commit is contained in:
parent
bf67fedc73
commit
fb7c437098
2 changed files with 6 additions and 18 deletions
|
@ -1,15 +1,9 @@
|
|||
define [
|
||||
"base"
|
||||
"services/algolia-search"
|
||||
], (App) ->
|
||||
|
||||
App.factory "algoliawiki", ->
|
||||
if window.sharelatex?.algolia? and window.sharelatex.algolia?.indexes?.wiki?
|
||||
client = new AlgoliaSearch(window.sharelatex.algolia?.app_id, window.sharelatex.algolia?.api_key)
|
||||
index = client.initIndex(window.sharelatex.algolia?.indexes?.wiki)
|
||||
return index
|
||||
|
||||
App.controller "SearchWikiController", ($scope, algoliawiki, _, $modal) ->
|
||||
algolia = algoliawiki
|
||||
App.controller "SearchWikiController", ($scope, algoliaSearch, _, $modal) ->
|
||||
$scope.hits = []
|
||||
|
||||
$scope.clearSearchText = ->
|
||||
|
@ -54,7 +48,7 @@ define [
|
|||
updateHits []
|
||||
return
|
||||
|
||||
algolia.search query, (err, response)->
|
||||
algoliaSearch.searchWiki query, (err, response)->
|
||||
if response.hits.length == 0
|
||||
updateHits []
|
||||
else
|
||||
|
|
|
@ -1,15 +1,9 @@
|
|||
define [
|
||||
"base"
|
||||
"services/algolia-search"
|
||||
], (App) ->
|
||||
|
||||
App.factory "algoliawiki", ->
|
||||
if window.sharelatex?.algolia? and window.sharelatex.algolia?.indexes?.wiki?
|
||||
client = new AlgoliaSearch(window.sharelatex.algolia?.app_id, window.sharelatex.algolia?.api_key)
|
||||
index = client.initIndex(window.sharelatex.algolia?.indexes?.wiki)
|
||||
return index
|
||||
|
||||
App.controller "SearchWikiController", ($scope, algoliawiki, _) ->
|
||||
algolia = algoliawiki
|
||||
App.controller "SearchWikiController", ($scope, algoliaSearch, _) ->
|
||||
$scope.hits = []
|
||||
|
||||
$scope.clearSearchText = ->
|
||||
|
@ -54,7 +48,7 @@ define [
|
|||
updateHits []
|
||||
return
|
||||
|
||||
algolia.search query, (err, response)->
|
||||
algoliaSearch.searchWiki query, (err, response)->
|
||||
if response.hits.length == 0
|
||||
updateHits []
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue