Merge pull request #551 from taigaio/issue/2803/search-result-loading

add loader in the search result page
stable
Alejandro 2015-06-25 04:42:31 -07:00
commit 9836553d57
5 changed files with 29 additions and 5 deletions

View File

@ -98,7 +98,8 @@ configure = ($routeProvider, $locationProvider, $httpProvider, $provide, $tgEven
{
templateUrl: "search/search.html",
reloadOnSearch: false,
section: "search"
section: "search",
loader: true
}
)

View File

@ -36,3 +36,17 @@ class TgLoadingService extends taiga.Service
target.removeClass('loading')
module.service("$tgLoading", TgLoadingService)
LoadingDirective = ($loading) ->
link = ($scope, $el, attr) ->
$scope.$watch attr.tgLoading, (showLoading) =>
if showLoading
$loading.start($el)
else
$loading.finish($el)
return {
link:link
}
module.directive("tgLoading", ["$tgLoading", LoadingDirective])

View File

@ -69,7 +69,10 @@ class SearchController extends mixOf(taiga.Controller, taiga.PageMixin)
@scope.$watch "searchTerm", (term) =>
if term
loadSearchData(term)
@scope.loading = true
@.loadSearchData(term).then () =>
@scope.loading = false
loadFilters: ->
defered = @q.defer()

View File

@ -2,4 +2,5 @@ section.search-in
header
fieldset
input(type="text", placeholder="{{'SEARCH.PLACEHOLDER_SEARCH' | translate}}", ng-model="searchTerm")
a.icon.icon-search(href="", title="{{'SEARCH.TITLE_ACTION_SEARCH' | translate}}")
.icon-search-wrapper(tg-loading="loading")
a.icon.icon-search(href="", title="{{'SEARCH.TITLE_ACTION_SEARCH' | translate}}")

View File

@ -6,10 +6,15 @@
color: $gray-light;
}
}
.icon-search {
color: $gray-light;
.icon-search-wrapper {
position: absolute;
right: .7rem;
top: .7rem;
}
.icon-search {
color: $gray-light;
}
.loading-spinner {
margin-top: .1rem;
}
}