More robust loading buttons service

stable
Jesús Espino 2014-09-18 15:45:48 +02:00
parent 69af98d3bf
commit 51159a1058
1 changed files with 9 additions and 7 deletions

View File

@ -23,11 +23,13 @@ module = angular.module("taigaCommon")
class TgLoadingService extends taiga.Service class TgLoadingService extends taiga.Service
start: (target) -> start: (target) ->
if not target.hasClass('loading')
target.data('loading-old-content', target.html()) target.data('loading-old-content', target.html())
target.addClass('loading') target.addClass('loading')
target.html("<span class='icon icon-spinner'></span>") target.html("<span class='icon icon-spinner'></span>")
finish: (target) -> finish: (target) ->
if target.hasClass('loading')
oldContent = target.data('loading-old-content') oldContent = target.data('loading-old-content')
target.data('loading-old-content', null) target.data('loading-old-content', null)
target.html(oldContent) target.html(oldContent)