diff --git a/addons/website_forum/static/src/js/website_forum.js b/addons/website_forum/static/src/js/website_forum.js index 9053c573efb..e84e76e14fa 100644 --- a/addons/website_forum/static/src/js/website_forum.js +++ b/addons/website_forum/static/src/js/website_forum.js @@ -129,11 +129,16 @@ $(document).ready(function () { cacheResults: true } }); - // Note: Adding event handler of whitespaceKeyDown event. - $("input.load_tags").bind("whitespaceKeyDown",function () { + // Adds: create tags on space + blur + $("input.load_tags").on('whitespaceKeyDown blur', function () { $(this).textext()[0].tags().addTags([ $(this).val() ]); $(this).val(""); }); + $("input.load_tags").on('isTagAllowed', function(e, data) { + if (_.indexOf($(this).textext()[0].tags()._formData, data.tag) != -1) { + data.result = false; + } + }); } if ($('textarea.load_editor').length) { diff --git a/addons/website_forum/views/website_forum.xml b/addons/website_forum/views/website_forum.xml index 9af62b8a56a..8e01555e638 100644 --- a/addons/website_forum/views/website_forum.xml +++ b/addons/website_forum/views/website_forum.xml @@ -80,7 +80,7 @@