From e43a4205e726f9f0c9ca41791a53b4b03f233753 Mon Sep 17 00:00:00 2001 From: Florian Bezagu Date: Wed, 26 Nov 2014 21:19:04 +0100 Subject: [PATCH] Catch submit event of form to create and edit task MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This allows to use « enter » to create or edit a task because there is a new event caught, the submit one. --- app/coffee/modules/taskboard/lightboxes.coffee | 12 +++++++++--- .../views/modules/lightbox-task-create-edit.jade | 1 + 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/app/coffee/modules/taskboard/lightboxes.coffee b/app/coffee/modules/taskboard/lightboxes.coffee index 6a1c09f0..68ac79c5 100644 --- a/app/coffee/modules/taskboard/lightboxes.coffee +++ b/app/coffee/modules/taskboard/lightboxes.coffee @@ -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} diff --git a/app/partials/views/modules/lightbox-task-create-edit.jade b/app/partials/views/modules/lightbox-task-create-edit.jade index 96772bd8..bc363077 100644 --- a/app/partials/views/modules/lightbox-task-create-edit.jade +++ b/app/partials/views/modules/lightbox-task-create-edit.jade @@ -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