Catch submit event of form to create and edit task

This allows to use « enter » to create or edit a task because there is
a new event caught, the submit one.
stable
Florian Bezagu 2014-11-26 21:19:04 +01:00
parent 63d6f4c829
commit e43a4205e7
2 changed files with 10 additions and 3 deletions

View File

@ -54,6 +54,15 @@ CreateEditTaskDirective = ($repo, $model, $rs, $rootscope, lightboxService) ->
lightboxService.open($el)
$el.on "click", ".button-green", debounce 2000, (event) ->
formSubmitted event
$el.on "submit", "form", debounce 2000, (event) ->
formSubmitted event
$scope.$on "$destroy", ->
$el.off()
formSubmitted = (event) ->
event.preventDefault()
form = $el.find("form").checksley()
@ -72,9 +81,6 @@ CreateEditTaskDirective = ($repo, $model, $rs, $rootscope, lightboxService) ->
lightboxService.close($el)
$rootscope.$broadcast(broadcastEvent, data)
$scope.$on "$destroy", ->
$el.off()
return {link: link}

View File

@ -34,5 +34,6 @@ form
tg-blocking-message-input(watch="task.is_blocked", ng-model="task.blocked_note")
button(title="Save" style="display: none;")
a.button.button-green(href="", title="Save")
span Create