Fix JavaScript for synonyms in tagAdd template
authorMatthias Schmidt <gravatronics@live.com>
Thu, 4 Aug 2016 16:50:34 +0000 (18:50 +0200)
committerMatthias Schmidt <gravatronics@live.com>
Thu, 4 Aug 2016 16:50:34 +0000 (18:50 +0200)
Fix #2072

wcfsetup/install/files/acp/templates/tagAdd.tpl

index 891b60522913a0f046edf2f1416542bbbf2976b9..b19cb7b7f337947b6657ea87c264a39524a0259e 100644 (file)
                        <dl>
                                <dt><label for="synonyms">{lang}wcf.acp.tag.synonyms{/lang}</label></dt>
                                <dd>
-                                       <div id="synonymList" class="editableItemList"></div>
                                        <input id="synonyms" type="text" value="" class="long">
                                </dd>
                        </dl>
                        
-                       <script data-relocate="true" src="{@$__wcf->getPath()}js/WCF.Tagging.js?v={@LAST_UPDATE_TIME}"></script>
                        <script data-relocate="true">
-                               //<![CDATA[
-                               $(function() {
-                                       var $tagList = new WCF.Tagging.TagList('#synonymList', '#synonyms');
-                                       
-                                       {if $synonyms|isset && $synonyms|count}
-                                               $tagList.load([ {implode from=$synonyms item='synonym'}'{$synonym|encodeJS}'{/implode} ]);
-                                       {/if}
+                               require(['WoltLab/WCF/Ui/ItemList'], function(UiItemList) {
+                                       UiItemList.init(
+                                               'synonyms',
+                                               [{if !$synonyms|empty}{implode from=$synonyms item=synonym}'{$synonym|encodeJS}'{/implode}{/if}],
+                                               {
+                                                       ajax: {
+                                                               className: 'wcf\\data\\tag\\TagAction'
+                                                       },
+                                                       maxLength: {@TAGGING_MAX_TAG_LENGTH},
+                                                       submitFieldName: 'tags[]'
+                                               }
+                                       );
                                });
-                               //]]>
                        </script>
                {elseif $tagObj|isset}
                        <dl>