mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
get algolia to pull app id and api key from settings file
This commit is contained in:
parent
cc1b9472b2
commit
2d55f080d6
3 changed files with 17 additions and 2 deletions
|
@ -99,7 +99,12 @@ module.exports =
|
|||
return res.send 500
|
||||
logger.log results:results, user_id:user_id, "rendering project list"
|
||||
viewModel = _buildListViewModel results.projects[0], results.projects[1], results.projects[2], results.tags[0], results.tags[1]
|
||||
viewModel.showUserDetailsArea = Settings?.algolia?.institutions?.app_id? and Settings?.algolia?.institutions?.api_key?
|
||||
if Settings?.algolia?.institutions?.app_id? and Settings?.algolia?.institutions?.api_key?
|
||||
viewModel.showUserDetailsArea = true
|
||||
viewModel.algolia_api_key = Settings.algolia.institutions.api_key
|
||||
viewModel.algolia_app_id = Settings.algolia.institutions.app_id
|
||||
else
|
||||
viewModel.showUserDetailsArea = false
|
||||
res.render 'project/list', viewModel
|
||||
timer.done()
|
||||
|
||||
|
|
|
@ -172,6 +172,16 @@ block content
|
|||
]
|
||||
};
|
||||
|
||||
- if (showUserDetailsArea)
|
||||
script
|
||||
window.algolia = {
|
||||
institutions:{
|
||||
app_id:'#{algolia_app_id}',
|
||||
api_key:'#{algolia_api_key}'
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
script(
|
||||
data-main=jsPath+'list.js?fingerprint='+fingerprint(jsPath + 'list.js'),
|
||||
baseurl=jsPath,
|
||||
|
|
|
@ -3,7 +3,7 @@ define ["libs/algolia", "libs/angular", "libs/angular-autocomplete/angular-autoc
|
|||
app = angular.module("userProfileInformationApp", ["autocomplete"])
|
||||
|
||||
app.factory "Institutions", ->
|
||||
new AlgoliaSearch("SK53GL4JLY", "1606ccef5b70ac44680b61e6b0285126").initIndex("institutions")
|
||||
new AlgoliaSearch(window.algolia.institutions.app_id, window.algolia.institutions.api_key).initIndex("institutions")
|
||||
|
||||
app.directive "focusInput", ($timeout) ->
|
||||
return (scope, element, attr) ->
|
||||
|
|
Loading…
Reference in a new issue