diff options
author | Frederic Guillot <fred@kanboard.net> | 2017-06-03 17:51:20 -0400 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2017-06-03 17:51:20 -0400 |
commit | 6b9b9d2d1c27600969388ad10d749bb6febc92b6 (patch) | |
tree | 752dcbdfc7b52c17961859e705a2c7d6aa2e201f /assets/js/components/autocomplete-email.js | |
parent | dd8d7ef49d522a15dbf0d04f033f676580f30ad7 (diff) |
Add autocomplete dropdown on comment subject and email fields
Diffstat (limited to 'assets/js/components/autocomplete-email.js')
-rw-r--r-- | assets/js/components/autocomplete-email.js | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/assets/js/components/autocomplete-email.js b/assets/js/components/autocomplete-email.js index 1babd516..4a12a2fe 100644 --- a/assets/js/components/autocomplete-email.js +++ b/assets/js/components/autocomplete-email.js @@ -1,25 +1,21 @@ KB.onClick('.js-autocomplete-email', function (e) { var email = KB.dom(e.target).data('email'); + var emailField = KB.find('.js-mail-form input[type="email"]'); - if (email) { - var emailField = KB.find('.js-task-mail-form input[type="email"]'); - - if (emailField) { - emailField.attr('value', email); - _KB.controllers['Dropdown'].close(); - } + if (email && emailField) { + emailField.build().value = email; } + + _KB.controllers['Dropdown'].close(); }); KB.onClick('.js-autocomplete-subject', function (e) { var subject = KB.dom(e.target).data('subject'); + var subjectField = KB.find('.js-mail-form input[name="subject"]'); - if (subject) { - var subjectField = KB.find('.js-task-mail-form input[name="subject"]'); - - if (subjectField) { - subjectField.attr('value', subject); - _KB.controllers['Dropdown'].close(); - } + if (subject && subjectField) { + subjectField.build().value = subject; } + + _KB.controllers['Dropdown'].close(); }); |