From 5e3f91d02475dda3236ceb5763853cc72b23e904 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Espino?= Date: Fri, 29 Aug 2014 14:12:56 +0200 Subject: [PATCH] Adding loading to add bulk of uss --- app/coffee/modules/common/lightboxes.coffee | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/coffee/modules/common/lightboxes.coffee b/app/coffee/modules/common/lightboxes.coffee index 71a8a7fa..10db775f 100644 --- a/app/coffee/modules/common/lightboxes.coffee +++ b/app/coffee/modules/common/lightboxes.coffee @@ -262,7 +262,7 @@ module.directive("tgLbCreateEditUserstory", [ ## Creare Bulk Userstories Lightbox Directive ############################################################################# -CreateBulkUserstoriesDirective = ($repo, $rs, $rootscope, lightboxService) -> +CreateBulkUserstoriesDirective = ($repo, $rs, $rootscope, lightboxService, $loading) -> link = ($scope, $el, attrs) -> $scope.$on "usform:bulk", (ctx, projectId, status) -> $scope.new = { @@ -281,12 +281,18 @@ CreateBulkUserstoriesDirective = ($repo, $rs, $rootscope, lightboxService) -> if not form.validate() return + target = angular.element(event.currentTarget) + + $loading.start(target) + promise = $rs.userstories.bulkCreate($scope.new.projectId, $scope.new.statusId, $scope.new.bulk) promise.then (result) -> + $loading.finish(target) $rootscope.$broadcast("usform:bulk:success", result) lightboxService.close($el) promise.then null, (data) -> + $loading.finish(target) form.setErrors(data) if data._error_message $confirm.notify("error", data._error_message) @@ -301,6 +307,7 @@ module.directive("tgLbCreateBulkUserstories", [ "$tgResources", "$rootScope", "lightboxService", + "$tgLoading", CreateBulkUserstoriesDirective ])