$ -> $(".note-wrapper form").submit (event) -> event.preventDefault() $note = $(this).find(".note") $(this).find(".toggle-note").prop "checked", false $note.addClass "-saving" $.post this.action, $(this).serialize(), (data) => $note.removeClass "-saving" $note.toggleClass "-saved", data == "true"