From f7e4c3928aba9cb7f5222cb4af67846312bbb435 Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Sat, 14 Feb 2015 16:11:13 -0500 Subject: Refactoring/simplification of the pull-request about links --- assets/js/src/link.js | 19 ------------------- assets/js/src/task.js | 22 ++++++++++++++++++++++ 2 files changed, 22 insertions(+), 19 deletions(-) delete mode 100644 assets/js/src/link.js create mode 100644 assets/js/src/task.js (limited to 'assets/js/src') diff --git a/assets/js/src/link.js b/assets/js/src/link.js deleted file mode 100644 index 31eeafad..00000000 --- a/assets/js/src/link.js +++ /dev/null @@ -1,19 +0,0 @@ -Kanboard.Link = (function() { - - function on_change() { - if ($('.behaviour').prop('checked')) { - $('.link-inverse-label').hide(); - } - else { - $('.link-inverse-label').show(); - } - } - - jQuery(document).ready(function() { - if (Kanboard.Exists("link-edit-section")) { - on_change(); - $(".behaviour").click(on_change); - } - }); - -})(); \ No newline at end of file diff --git a/assets/js/src/task.js b/assets/js/src/task.js new file mode 100644 index 00000000..2caf81cc --- /dev/null +++ b/assets/js/src/task.js @@ -0,0 +1,22 @@ +Kanboard.Task = (function() { + + jQuery(document).ready(function() { + + if ($(".task-autocomplete").length) { + + $("input[type=submit]").attr('disabled','disabled'); + + $(".task-autocomplete").autocomplete({ + source: $(".task-autocomplete").data("search-url"), + minLength: 2, + select: function(event, ui) { + var field = $(".task-autocomplete").data("dst-field"); + $("input[name=" + field + "]").val(ui.item.id); + + $("input[type=submit]").removeAttr('disabled'); + } + }); + } + }); + +})(); -- cgit v1.2.3