change format of algolia settings

This commit is contained in:
Henry Oswald 2014-07-01 16:45:20 +01:00
parent 8f6dac77d0
commit 55d20e8abd
2 changed files with 11 additions and 6 deletions

View file

@ -85,10 +85,15 @@ html(itemscope, itemtype='http://schema.org/Product')
};
script.
window.sharelatex = {
algolia: !{JSON.stringify(settings.algolia)}
}
window.sharelatex = {}
- if (typeof(settings.algolia) != "undefined")
script.
window.sharelatex.algolia = {
app_id:'#{settings.algolia.app_id}',
api_key:'#{settings.algolia.read_only_api_key}',
indexes:!{JSON.stringify(settings.algolia.indexes)}
}
- if (typeof(settings.apis) != "undefined" && typeof(settings.apis.templates_api) != "undefined")
script.

View file

@ -17,9 +17,9 @@ define [
app.factory "algolia", ->
if window?.sharelatex?.algolia?.appId?
client = new AlgoliaSearch(window.sharelatex.algolia?.templates?.appId, window.sharelatex.algolia?.templates?.secret)
index = client.initIndex(window.sharelatex.algolia?.templates?.indexName)
if window?.sharelatex?.algolia?.app_id?
client = new AlgoliaSearch(window.sharelatex.algolia?.app_id, window.sharelatex.algolia?.api_key)
index = client.initIndex(window.sharelatex.algolia?.indexes?.templates)
return index
app.controller "SearchController", ($scope, algolia, _) ->