diff --git a/app/modules/components/tips/tip.jade b/app/modules/components/tips/tip.jade index 6d9d3d0f..d84cdca1 100644 --- a/app/modules/components/tips/tip.jade +++ b/app/modules/components/tips/tip.jade @@ -1,9 +1,9 @@ -div.tip(ng-class="tip.color") +div.tip(ng-if="tipLoaded", ng-class="tip.color") p.title(translate="TIPS.TIPS_TITLE") p(translate="{{ tip.message }}") - div(ng-switch="tip.contentType", translate-cloak="{{ tip.message }}") + div(ng-switch="tip.contentType") p(ng-switch-when="icon") tg-svg(svg-icon="{{ tip.icon }}") span(ng-if="tip.icon == 'icon-upvote'") 5 @@ -13,3 +13,6 @@ div.tip(ng-class="tip.color") p.arrows(ng-switch-when="arrows") tg-svg(svg-icon="icon-arrow-left") tg-svg(svg-icon="icon-arrow-right") + +div.tip(ng-if="!tipLoaded") + p(translate="COMMON.LOADING") \ No newline at end of file diff --git a/app/modules/components/tips/tips.directive.coffee b/app/modules/components/tips/tips.directive.coffee index f3d3c808..9e91e15e 100644 --- a/app/modules/components/tips/tips.directive.coffee +++ b/app/modules/components/tips/tips.directive.coffee @@ -17,6 +17,8 @@ # File: components/tips/tips.directive.coffee ### +timeout = @.taiga.timeout + module = angular.module("taigaComponents") tipsDirective = (tgLoader, $translate) -> @@ -38,10 +40,19 @@ tipsDirective = (tgLoader, $translate) -> return Math.floor(Math.random() * size) + 1 link = (scope, el, attrs) -> + scope.tipLoaded = false + waitingTimeout = null + tgLoader.onStart () -> - loadTip() + waitingTimeout = timeout 1000, -> + loadTip() + + tgLoader.onEnd () -> + clearTimeout(waitingTimeout) + scope.tipLoaded = false loadTip = () -> + scope.tipLoaded = true tip = tips[randomInt(tips.length - 1)] scope.tip = { contentType: tip.contentType diff --git a/app/svg/sprite.svg b/app/svg/sprite.svg index 9d543033..500e8b10 100644 --- a/app/svg/sprite.svg +++ b/app/svg/sprite.svg @@ -462,15 +462,15 @@ - - - + + + - - - - - + + + + +