don't show search bar in templates if its not configured

This commit is contained in:
Henry Oswald 2016-03-24 09:52:19 +00:00
parent 6a4e13d3c8
commit ce2cfeaa5b
2 changed files with 29 additions and 25 deletions

View file

@ -9,7 +9,10 @@ block content
.row .row
.col-xs-3.contents(ng-non-bindable) .col-xs-3.contents(ng-non-bindable)
| !{contents.content} | !{contents.content}
.col-xs-9.page(ng-controller="SearchWikiController")
.col-xs-9.page
- if(typeof(settings.algolia) != "undefined" && typeof(settings.algolia.indexes) != "undefined" && typeof(settings.algolia.indexes.wiki) != "undefined")
span(ng-controller="SearchWikiController")
.row .row
form.project-search.form-horizontal.col-md-9(role="form") form.project-search.form-horizontal.col-md-9(role="form")
.form-group.has-feedback.has-feedback-left.col-md-12 .form-group.has-feedback.has-feedback-left.col-md-12

View file

@ -3,8 +3,9 @@ define [
], (App) -> ], (App) ->
App.factory "algoliawiki", -> App.factory "algoliawiki", ->
client = new AlgoliaSearch("SK53GL4JLY", "e398f35d3074fde57ca6d6c88d8be37c") if window.sharelatex?.algolia? and window.sharelatex.algolia?.indexes?.wiki?
index = client.initIndex("lean-wiki-index") client = new AlgoliaSearch(window.sharelatex.algolia?.app_id, window.sharelatex.algolia?.api_key)
index = client.initIndex(window.sharelatex.algolia?.indexes?.wiki)
return index return index
App.controller "SearchWikiController", ($scope, algoliawiki, _) -> App.controller "SearchWikiController", ($scope, algoliawiki, _) ->