roughly styled template search results

clear button in template search also clears results
This commit is contained in:
Henry Oswald 2014-07-22 17:43:17 +01:00
parent 25ea01115a
commit c6ab4c4f7b
3 changed files with 18 additions and 6 deletions

View file

@ -3,12 +3,12 @@ extends ../layout
block content block content
.content.content-alt .content.content-alt
.container .container
.row.template-page-header .row.template-page-header(ng-controller="SearchController")
.col-md-2 .col-md-2
h2 h2
a(href="/templates") Templates a(href="/templates") Templates
.col-md-8(ng-controller="SearchController") .col-md-8
form.project-search.form-horizontal(role="form") form.project-search.form-horizontal(role="form")
.form-group.has-feedback.has-feedback-left.col-md-12 .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 template library....") input.form-control.col-md-12(type='text', ng-model='searchQueryText', ng-keyup='search()', placeholder="Search template library....")
@ -18,15 +18,17 @@ block content
style="cursor: pointer;", style="cursor: pointer;",
ng-show="searchQueryText.length > 0" ng-show="searchQueryText.length > 0"
) )
ul.unstyled .col-md-12
ul.list-unstyled
li(ng-repeat='hit in hits') li(ng-repeat='hit in hits')
.thumbnail.searchResult .thumbnail.searchResult
.row .row
a(ng-href='{{hit.url}}') a(ng-href='{{hit.url}}')
.col-md-3 .col-md-3
img(ng-src='{{hit.image_url}}') img(src="https://d1hk1zhcb5hn6i.cloudfront.net/52fb8c6f34a287a85245b493/v/0/pdf-converted-cache/style-thumbnail")
.col-md-9 //img(ng-src='{{hit.image_url}}')
h2(ng-bind-html='hit.name') .col-md-7
h1(ng-bind-html='hit.name')
p(ng-bind-html='hit.description') p(ng-bind-html='hit.description')

View file

@ -17,6 +17,8 @@ define [
App.factory "algolia", -> App.factory "algolia", ->
console.log window.sharelatex.algolia?.app_id, window.sharelatex.algolia?.api_key
if window?.sharelatex?.algolia?.app_id? if window?.sharelatex?.algolia?.app_id?
client = new AlgoliaSearch(window.sharelatex.algolia?.app_id, window.sharelatex.algolia?.api_key) client = new AlgoliaSearch(window.sharelatex.algolia?.app_id, window.sharelatex.algolia?.api_key)
index = client.initIndex(window.sharelatex.algolia?.indexes?.templates) index = client.initIndex(window.sharelatex.algolia?.indexes?.templates)
@ -27,6 +29,7 @@ define [
$scope.clearSearchText = -> $scope.clearSearchText = ->
$scope.searchQueryText = "" $scope.searchQueryText = ""
updateHits []
$scope.safeApply = (fn)-> $scope.safeApply = (fn)->
phase = $scope.$root.$$phase phase = $scope.$root.$$phase

View file

@ -40,4 +40,11 @@
.template-details-section { .template-details-section {
padding-bottom: 20px; padding-bottom: 20px;
}
.searchResult {
img {
max-width: 100%;
height: auto;
}
} }