Add spinner on change status/type/priority/severity selectors

stable
Jesús Espino 2014-10-16 19:44:43 +02:00 committed by David Barragán Merino
parent 752f14584a
commit 631af8d3a5
4 changed files with 51 additions and 12 deletions

View File

@ -186,7 +186,7 @@ module.directive("tgIssueStatusDisplay", IssueStatusDisplayDirective)
## Issue status button directive ## Issue status button directive
############################################################################# #############################################################################
IssueStatusButtonDirective = ($rootScope, $repo, $confirm) -> IssueStatusButtonDirective = ($rootScope, $repo, $confirm, $loading) ->
# Display the status of Issue and you can edit it. # Display the status of Issue and you can edit it.
# #
# Example: # Example:
@ -247,13 +247,19 @@ IssueStatusButtonDirective = ($rootScope, $repo, $confirm) ->
issue.status = target.data("status-id") issue.status = target.data("status-id")
$model.$setViewValue(issue) $model.$setViewValue(issue)
$scope.$apply()
onSuccess = -> onSuccess = ->
$confirm.notify("success") $confirm.notify("success")
$rootScope.$broadcast("history:reload") $rootScope.$broadcast("history:reload")
$loading.finish($el.find(".level-name"))
onError = -> onError = ->
$confirm.notify("error") $confirm.notify("error")
issue.revert() issue.revert()
$model.$setViewValue(issue) $model.$setViewValue(issue)
$loading.finish($el.find(".level-name"))
$loading.start($el.find(".level-name"))
$repo.save($model.$modelValue).then(onSuccess, onError) $repo.save($model.$modelValue).then(onSuccess, onError)
$scope.$watch $attrs.ngModel, (issue) -> $scope.$watch $attrs.ngModel, (issue) ->
@ -268,13 +274,13 @@ IssueStatusButtonDirective = ($rootScope, $repo, $confirm) ->
require: "ngModel" require: "ngModel"
} }
module.directive("tgIssueStatusButton", ["$rootScope", "$tgRepo", "$tgConfirm", IssueStatusButtonDirective]) module.directive("tgIssueStatusButton", ["$rootScope", "$tgRepo", "$tgConfirm", "$tgLoading", IssueStatusButtonDirective])
############################################################################# #############################################################################
## Issue type button directive ## Issue type button directive
############################################################################# #############################################################################
IssueTypeButtonDirective = ($rootScope, $repo, $confirm) -> IssueTypeButtonDirective = ($rootScope, $repo, $confirm, $loading) ->
# Display the type of Issue and you can edit it. # Display the type of Issue and you can edit it.
# #
# Example: # Example:
@ -335,13 +341,18 @@ IssueTypeButtonDirective = ($rootScope, $repo, $confirm) ->
issue.type = target.data("type-id") issue.type = target.data("type-id")
$model.$setViewValue(issue) $model.$setViewValue(issue)
$scope.$apply()
onSuccess = -> onSuccess = ->
$confirm.notify("success") $confirm.notify("success")
$rootScope.$broadcast("history:reload") $rootScope.$broadcast("history:reload")
$loading.finish($el.find(".level-name"))
onError = -> onError = ->
$confirm.notify("error") $confirm.notify("error")
issue.revert() issue.revert()
$model.$setViewValue(issue) $model.$setViewValue(issue)
$loading.finish($el.find(".level-name"))
$loading.start($el.find(".level-name"))
$repo.save($model.$modelValue).then(onSuccess, onError) $repo.save($model.$modelValue).then(onSuccess, onError)
$scope.$watch $attrs.ngModel, (issue) -> $scope.$watch $attrs.ngModel, (issue) ->
@ -356,14 +367,14 @@ IssueTypeButtonDirective = ($rootScope, $repo, $confirm) ->
require: "ngModel" require: "ngModel"
} }
module.directive("tgIssueTypeButton", ["$rootScope", "$tgRepo", "$tgConfirm", IssueTypeButtonDirective]) module.directive("tgIssueTypeButton", ["$rootScope", "$tgRepo", "$tgConfirm", "$tgLoading", IssueTypeButtonDirective])
############################################################################# #############################################################################
## Issue severity button directive ## Issue severity button directive
############################################################################# #############################################################################
IssueSeverityButtonDirective = ($rootScope, $repo, $confirm) -> IssueSeverityButtonDirective = ($rootScope, $repo, $confirm, $loading) ->
# Display the severity of Issue and you can edit it. # Display the severity of Issue and you can edit it.
# #
# Example: # Example:
@ -424,13 +435,18 @@ IssueSeverityButtonDirective = ($rootScope, $repo, $confirm) ->
issue.severity = target.data("severity-id") issue.severity = target.data("severity-id")
$model.$setViewValue(issue) $model.$setViewValue(issue)
$scope.$apply()
onSuccess = -> onSuccess = ->
$confirm.notify("success") $confirm.notify("success")
$rootScope.$broadcast("history:reload") $rootScope.$broadcast("history:reload")
$loading.finish($el.find(".level-name"))
onError = -> onError = ->
$confirm.notify("error") $confirm.notify("error")
issue.revert() issue.revert()
$model.$setViewValue(issue) $model.$setViewValue(issue)
$loading.finish($el.find(".level-name"))
$loading.start($el.find(".level-name"))
$repo.save($model.$modelValue).then(onSuccess, onError) $repo.save($model.$modelValue).then(onSuccess, onError)
$scope.$watch $attrs.ngModel, (issue) -> $scope.$watch $attrs.ngModel, (issue) ->
@ -445,14 +461,14 @@ IssueSeverityButtonDirective = ($rootScope, $repo, $confirm) ->
require: "ngModel" require: "ngModel"
} }
module.directive("tgIssueSeverityButton", ["$rootScope", "$tgRepo", "$tgConfirm", IssueSeverityButtonDirective]) module.directive("tgIssueSeverityButton", ["$rootScope", "$tgRepo", "$tgConfirm", "$tgLoading", IssueSeverityButtonDirective])
############################################################################# #############################################################################
## Issue priority button directive ## Issue priority button directive
############################################################################# #############################################################################
IssuePriorityButtonDirective = ($rootScope, $repo, $confirm) -> IssuePriorityButtonDirective = ($rootScope, $repo, $confirm, $loading) ->
# Display the priority of Issue and you can edit it. # Display the priority of Issue and you can edit it.
# #
# Example: # Example:
@ -513,13 +529,18 @@ IssuePriorityButtonDirective = ($rootScope, $repo, $confirm) ->
issue.priority = target.data("priority-id") issue.priority = target.data("priority-id")
$model.$setViewValue(issue) $model.$setViewValue(issue)
$scope.$apply()
onSuccess = -> onSuccess = ->
$confirm.notify("success") $confirm.notify("success")
$rootScope.$broadcast("history:reload") $rootScope.$broadcast("history:reload")
$loading.finish($el.find(".level-name"))
onError = -> onError = ->
$confirm.notify("error") $confirm.notify("error")
issue.revert() issue.revert()
$model.$setViewValue(issue) $model.$setViewValue(issue)
$loading.finish($el.find(".level-name"))
$loading.start($el.find(".level-name"))
$repo.save($model.$modelValue).then(onSuccess, onError) $repo.save($model.$modelValue).then(onSuccess, onError)
$scope.$watch $attrs.ngModel, (issue) -> $scope.$watch $attrs.ngModel, (issue) ->
@ -534,7 +555,7 @@ IssuePriorityButtonDirective = ($rootScope, $repo, $confirm) ->
require: "ngModel" require: "ngModel"
} }
module.directive("tgIssuePriorityButton", ["$rootScope", "$tgRepo", "$tgConfirm", IssuePriorityButtonDirective]) module.directive("tgIssuePriorityButton", ["$rootScope", "$tgRepo", "$tgConfirm", "$tgLoading", IssuePriorityButtonDirective])
############################################################################# #############################################################################

View File

@ -177,7 +177,7 @@ module.directive("tgTaskStatusDisplay", TaskStatusDisplayDirective)
## Task status button directive ## Task status button directive
############################################################################# #############################################################################
TaskStatusButtonDirective = ($rootScope, $repo, $confirm) -> TaskStatusButtonDirective = ($rootScope, $repo, $confirm, $loading) ->
# Display the status of Task and you can edit it. # Display the status of Task and you can edit it.
# #
# Example: # Example:
@ -238,13 +238,20 @@ TaskStatusButtonDirective = ($rootScope, $repo, $confirm) ->
task.status = target.data("status-id") task.status = target.data("status-id")
$model.$setViewValue(task) $model.$setViewValue(task)
$scope.$apply()
onSuccess = -> onSuccess = ->
$confirm.notify("success") $confirm.notify("success")
$rootScope.$broadcast("history:reload") $rootScope.$broadcast("history:reload")
$loading.finish($el.find(".level-name"))
onError = -> onError = ->
$confirm.notify("error") $confirm.notify("error")
task.revert() task.revert()
$model.$setViewValue(task) $model.$setViewValue(task)
$loading.finish($el.find(".level-name"))
$loading.start($el.find(".level-name"))
$repo.save($model.$modelValue).then(onSuccess, onError) $repo.save($model.$modelValue).then(onSuccess, onError)
$scope.$watch $attrs.ngModel, (task) -> $scope.$watch $attrs.ngModel, (task) ->
@ -259,7 +266,7 @@ TaskStatusButtonDirective = ($rootScope, $repo, $confirm) ->
require: "ngModel" require: "ngModel"
} }
module.directive("tgTaskStatusButton", ["$rootScope", "$tgRepo", "$tgConfirm", TaskStatusButtonDirective]) module.directive("tgTaskStatusButton", ["$rootScope", "$tgRepo", "$tgConfirm", "$tgLoading", TaskStatusButtonDirective])
TaskIsIocaineButtonDirective = ($rootscope, $tgrepo, $confirm, $loading) -> TaskIsIocaineButtonDirective = ($rootscope, $tgrepo, $confirm, $loading) ->

View File

@ -398,7 +398,7 @@ module.directive("tgUsEstimation", ["$rootScope", "$tgRepo", "$tgConfirm", UsEst
## User story status button directive ## User story status button directive
############################################################################# #############################################################################
UsStatusButtonDirective = ($rootScope, $repo, $confirm) -> UsStatusButtonDirective = ($rootScope, $repo, $confirm, $loading) ->
# Display the status of a US and you can edit it. # Display the status of a US and you can edit it.
# #
# Example: # Example:
@ -460,13 +460,20 @@ UsStatusButtonDirective = ($rootScope, $repo, $confirm) ->
us.status = target.data("status-id") us.status = target.data("status-id")
$model.$setViewValue(us) $model.$setViewValue(us)
$scope.$apply()
onSuccess = -> onSuccess = ->
$confirm.notify("success") $confirm.notify("success")
$rootScope.$broadcast("history:reload") $rootScope.$broadcast("history:reload")
$loading.finish($el.find(".level-name"))
onError = -> onError = ->
$confirm.notify("error") $confirm.notify("error")
us.revert() us.revert()
$model.$setViewValue(us) $model.$setViewValue(us)
$loading.finish($el.find(".level-name"))
$loading.start($el.find(".level-name"))
$repo.save($model.$modelValue).then(onSuccess, onError) $repo.save($model.$modelValue).then(onSuccess, onError)
$scope.$watch $attrs.ngModel, (us) -> $scope.$watch $attrs.ngModel, (us) ->
@ -481,7 +488,7 @@ UsStatusButtonDirective = ($rootScope, $repo, $confirm) ->
require: "ngModel" require: "ngModel"
} }
module.directive("tgUsStatusButton", ["$rootScope", "$tgRepo", "$tgConfirm", UsStatusButtonDirective]) module.directive("tgUsStatusButton", ["$rootScope", "$tgRepo", "$tgConfirm", "$tgLoading", UsStatusButtonDirective])
############################################################################# #############################################################################

View File

@ -259,6 +259,10 @@
.level-name { .level-name {
color: darken($whitish, 20%); color: darken($whitish, 20%);
float: right; float: right;
&.loading span {
@include animation (loading .5s linear);
@include animation (spin 1s linear infinite);
}
} }
} }