소스 검색

Fixes #3031: Select2 creates multiple tags for tags with spaces

Khaled BEN ABDALLAH 6 년 전
부모
커밋
cbace6f831
1개의 변경된 파일4개의 추가작업 그리고 0개의 파일을 삭제
  1. 4 0
      netbox/project-static/js/forms.js

+ 4 - 0
netbox/project-static/js/forms.js

@@ -267,6 +267,10 @@ $(document).ready(function() {
 
             processResults: function (data) {
                 var results = $.map(data.results, function (obj) {
+                    // If tag contains space add double quotes
+                    if (/\s/.test(obj.name))
+                        obj.name = '"' + obj.name + '"'
+
                     return {
                         id: obj.name,
                         text: obj.name