Fixed creation of multilingual system boxes
authorMarcel Werk <burntime@woltlab.com>
Wed, 1 Jun 2016 16:51:13 +0000 (18:51 +0200)
committerMarcel Werk <burntime@woltlab.com>
Wed, 1 Jun 2016 16:51:18 +0000 (18:51 +0200)
wcfsetup/install/files/js/WoltLab/WCF/Acp/Ui/Box/Add.js

index a0cf341d18d6139aa28abfe3cb783e446e091c4b..4ab6b6364163d1ce3ff3d0a8ed0c4ba00d5883aa 100644 (file)
@@ -51,10 +51,19 @@ define(['Core', 'Language', 'Ui/Dialog'], function(Core, Language, UiDialog) {
                                                        event.preventDefault();
                                                        
                                                        var boxType = elBySel('input[name="boxType"]:checked', content).value;
-                                                       var isMultilingual = elBySel('input[name="isMultilingual"]:checked', content).value;
+                                                       var isMultilingual = 0;
+                                                       if (boxType !== 'system') isMultilingual = elBySel('input[name="isMultilingual"]:checked', content).value;
                                                        
                                                        window.location = _link.replace(/{\$boxType}/, boxType).replace(/{\$isMultilingual}/, isMultilingual);
                                                });
+                                               
+                                               elBySelAll('input[type="radio"][name="boxType"]', content, function(element) {
+                                                       element.addEventListener('change', function(event) {
+                                                               elBySelAll('input[type="radio"][name="isMultilingual"]', content, function(element) {
+                                                                       element.disabled = (event.currentTarget.value === 'system');
+                                                               });
+                                                       });
+                                               });
                                        },
                                        title: Language.get('wcf.acp.box.add')
                                }