added a missing templates button back into templates index page

This commit is contained in:
Henry Oswald 2014-09-01 15:13:37 +01:00
parent 66e0785e59
commit f3c04feda7
2 changed files with 39 additions and 3 deletions

View file

@ -6,12 +6,12 @@ block vars
block content
.content.content-alt
.container
.row.template-page-header(ng-controller="SearchController")
.row.template-page-header
.col-md-2
h2
a(href="/templates") #{translate("templates")}
.col-md-8
.col-md-8(ng-controller="SearchController")
form.project-search.form-horizontal(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 template library....")
@ -21,7 +21,9 @@ block content
style="cursor: pointer;",
ng-show="searchQueryText.length > 0"
)
.col-md-12
.col-md-2(ng-controller="MissingTemplateController")
a.btn.btn-primary(ng-click="showMissingTemplateModal()") #{translate("missing_template_question")}
.col-md-12(ng-cloak)
ul.list-unstyled
li(ng-repeat='hit in hits')
.thumbnail.searchResult
@ -36,6 +38,7 @@ block content
.row
-each tag in tags
-if(tag.totalNumberOfTemplates > 0)
@ -57,3 +60,21 @@ block content
script(type="text/ng-template", id="missingTemplateModal")
.modal-header
button.close(
type="button"
data-dismiss="modal"
ng-click="cancel()"
) ×
h3 #{translate("missing_template_question")}
.modal-body #{translate("tell_us_about_the_template")}
.modal-footer
button.btn.btn-default(
ng-click="cancel()",
)
span #{translate("dismiss")}
button.btn.btn-info #{translate("email_us")}

View file

@ -22,6 +22,8 @@ define [
index = client.initIndex(window.sharelatex.algolia?.indexes?.templates)
return index
App.controller "SearchController", ($scope, algolia, _) ->
$scope.hits = []
@ -60,3 +62,16 @@ define [
else
hits = _.map response.hits, buildHitViewModel
updateHits hits
App.controller "MissingTemplateController", ($scope, $modal)->
$scope.showMissingTemplateModal = ->
$modal.open {
templateUrl: "missingTemplateModal"
controller:"MissingTemplateModalController"
}
App.controller "MissingTemplateModalController", ($scope, $modalInstance) ->
$scope.cancel = () ->
$modalInstance.dismiss()