Don't reload values on new value added and removed unnecesary code
parent
323342e013
commit
3b96ef1778
|
@ -149,15 +149,7 @@ ProjectValuesDirective = ($log, $repo, $confirm, $location, animationFrame) ->
|
||||||
if focus
|
if focus
|
||||||
$(".new-value input").focus()
|
$(".new-value input").focus()
|
||||||
|
|
||||||
submit = debounce 2000, =>
|
saveValue = (target) ->
|
||||||
promise = $repo.save($scope.project)
|
|
||||||
promise.then ->
|
|
||||||
$confirm.notify("success")
|
|
||||||
|
|
||||||
promise.then null, (data) ->
|
|
||||||
$confirm.notify("error", data._error_message)
|
|
||||||
|
|
||||||
saveValue = debounce 2000, (target) ->
|
|
||||||
form = target.parents("form").checksley()
|
form = target.parents("form").checksley()
|
||||||
return if not form.validate()
|
return if not form.validate()
|
||||||
|
|
||||||
|
@ -180,14 +172,6 @@ ProjectValuesDirective = ($log, $repo, $confirm, $location, animationFrame) ->
|
||||||
value.revert()
|
value.revert()
|
||||||
row.siblings(".visualization").removeClass('hidden')
|
row.siblings(".visualization").removeClass('hidden')
|
||||||
|
|
||||||
$el.on "submit", "form", (event) ->
|
|
||||||
event.preventDefault()
|
|
||||||
submit()
|
|
||||||
|
|
||||||
$el.on "click", "form a.button-green", (event) ->
|
|
||||||
event.preventDefault()
|
|
||||||
submit()
|
|
||||||
|
|
||||||
$el.on "click", ".show-add-new", (event) ->
|
$el.on "click", ".show-add-new", (event) ->
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
$el.find(".new-value").removeClass('hidden')
|
$el.find(".new-value").removeClass('hidden')
|
||||||
|
@ -204,12 +188,11 @@ ProjectValuesDirective = ($log, $repo, $confirm, $location, animationFrame) ->
|
||||||
$scope.newValue.order = if $scope.maxValueOrder then $scope.maxValueOrder + 1 else 1
|
$scope.newValue.order = if $scope.maxValueOrder then $scope.maxValueOrder + 1 else 1
|
||||||
|
|
||||||
promise = $repo.create(valueType, $scope.newValue)
|
promise = $repo.create(valueType, $scope.newValue)
|
||||||
promise.then =>
|
promise.then (data) =>
|
||||||
$ctrl.loadValues().then ->
|
|
||||||
animationFrame.add () ->
|
|
||||||
goToBottomList()
|
|
||||||
|
|
||||||
$el.find(".new-value").addClass("hidden")
|
$el.find(".new-value").addClass("hidden")
|
||||||
|
|
||||||
|
$scope.values.push(data)
|
||||||
|
$scope.maxValueOrder = data.order
|
||||||
initializeNewValue()
|
initializeNewValue()
|
||||||
|
|
||||||
promise.then null, (data) ->
|
promise.then null, (data) ->
|
||||||
|
|
Loading…
Reference in New Issue