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,29 +9,32 @@ 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")
.row
form.project-search.form-horizontal.col-md-9(role="form")
.form-group.has-feedback.has-feedback-left.col-md-12
input.form-control.col-md-12(type='text', ng-model='searchQueryText', ng-keyup='search()', placeholder="Search help library....")
i.fa.fa-search.form-control-feedback-left
i.fa.fa-times.form-control-feedback(
ng-click="clearSearchText()",
style="cursor: pointer;",
ng-show="searchQueryText.length > 0"
)
.col-md-2
a.btn.btn-primary(ng-click="showMissingTemplateModal()") #{translate("missing_page")}
.row .col-xs-9.page
.col-md-12(ng-cloak) - if(typeof(settings.algolia) != "undefined" && typeof(settings.algolia.indexes) != "undefined" && typeof(settings.algolia.indexes.wiki) != "undefined")
ul.list-unstyled span(ng-controller="SearchWikiController")
li(ng-repeat='hit in hits') .row
.searchResult.thumbnail form.project-search.form-horizontal.col-md-9(role="form")
.row .form-group.has-feedback.has-feedback-left.col-md-12
.col-md-12 input.form-control.col-md-12(type='text', ng-model='searchQueryText', ng-keyup='search()', placeholder="Search help library....")
a(ng-href='{{hit.url}}') i.fa.fa-search.form-control-feedback-left
span(ng-bind-html='hit.name') i.fa.fa-times.form-control-feedback(
ng-click="clearSearchText()",
style="cursor: pointer;",
ng-show="searchQueryText.length > 0"
)
.col-md-2
a.btn.btn-primary(ng-click="showMissingTemplateModal()") #{translate("missing_page")}
.row
.col-md-12(ng-cloak)
ul.list-unstyled
li(ng-repeat='hit in hits')
.searchResult.thumbnail
.row
.col-md-12
a(ng-href='{{hit.url}}')
span(ng-bind-html='hit.name')
.card(ng-non-bindable) .card(ng-non-bindable)
.page-header .page-header

View file

@ -3,9 +3,10 @@ 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)
return index index = client.initIndex(window.sharelatex.algolia?.indexes?.wiki)
return index
App.controller "SearchWikiController", ($scope, algoliawiki, _) -> App.controller "SearchWikiController", ($scope, algoliawiki, _) ->
algolia = algoliawiki algolia = algoliawiki