From 51159a1058f3d3cfa60fc6cc61f9f8d5369f1195 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Espino?= Date: Thu, 18 Sep 2014 15:45:48 +0200 Subject: [PATCH] More robust loading buttons service --- app/coffee/modules/common/loading.coffee | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/app/coffee/modules/common/loading.coffee b/app/coffee/modules/common/loading.coffee index 46175764..a1d169af 100644 --- a/app/coffee/modules/common/loading.coffee +++ b/app/coffee/modules/common/loading.coffee @@ -23,14 +23,16 @@ module = angular.module("taigaCommon") class TgLoadingService extends taiga.Service start: (target) -> - target.data('loading-old-content', target.html()) - target.addClass('loading') - target.html("") + if not target.hasClass('loading') + target.data('loading-old-content', target.html()) + target.addClass('loading') + target.html("") finish: (target) -> - oldContent = target.data('loading-old-content') - target.data('loading-old-content', null) - target.html(oldContent) - target.removeClass('loading') + if target.hasClass('loading') + oldContent = target.data('loading-old-content') + target.data('loading-old-content', null) + target.html(oldContent) + target.removeClass('loading') module.service("$tgLoading", TgLoadingService)