Fix #175: Validate project value and revert modifications if cancel button is clicked

stable
David Barragán Merino 2014-08-20 12:39:02 +02:00
parent 1fae3c9e9a
commit 33d18a173c
5 changed files with 16 additions and 11 deletions

View File

@ -93,6 +93,7 @@ class ProjectValuesController extends mixOf(taiga.Controller, taiga.PageMixin)
module.controller("ProjectValuesController", ProjectValuesController)
#############################################################################
## Project values directive
#############################################################################
@ -228,8 +229,11 @@ ProjectValuesDirective = ($log, $repo, $confirm, $location, animationFrame) ->
event.preventDefault()
target = angular.element(event.currentTarget)
row = target.parents(".row.table-main")
row.hide()
row.siblings(".visualization").css("display": "flex")
value = target.scope().value
$scope.$apply ->
row.hide()
value.revert()
row.siblings(".visualization").css("display": "flex")
$el.on "click", ".delete-value", (event) ->
event.preventDefault()
@ -262,7 +266,8 @@ ProjectValuesDirective = ($log, $repo, $confirm, $location, animationFrame) ->
return {link:link}
module.directive("tgProjectValues", ["$log", "$tgRepo", "$tgConfirm", "$tgLocation", "animationFrame", ProjectValuesDirective])
module.directive("tgProjectValues", ["$log", "$tgRepo", "$tgConfirm", "$tgLocation", "animationFrame",
ProjectValuesDirective])
#############################################################################

View File

@ -8,8 +8,8 @@ section.project-values-table
div.project-values-settings
div.project-values-body
form.sortable
div(ng-repeat="value in values")
div.sortable
form(ng-repeat="value in values")
div.project-values-row.row.table-main.visualization
span.icon.icon-drag-v

View File

@ -7,8 +7,8 @@ section.colors-table
div.options-column
div.table-main
form.sortable
div(ng-repeat="value in values")
div.sortable
form(ng-repeat="value in values")
div.row.table-main.visualization
span.icon.icon-drag-v
div.color-column

View File

@ -6,8 +6,8 @@ section.colors-table
div.options-column
div.table-main
form.sortable
div(ng-repeat="value in values")
div.sortable
form(ng-repeat="value in values")
div.row.table-main.visualization
span.icon.icon-drag-v

View File

@ -8,8 +8,8 @@ section.colors-table
div.options-column
div.table-main
form.sortable
div(ng-repeat="value in values")
div.sortable
form(ng-repeat="value in values")
div.row.table-main.visualization
span.icon.icon-drag-v