Check if setting exists
authorVlad Chernushevich <mailbox@happytodesign.com>
Sun, 16 Jun 2013 17:37:22 +0000 (19:37 +0200)
committerVlad Chernushevich <mailbox@happytodesign.com>
Sun, 16 Jun 2013 17:37:22 +0000 (19:37 +0200)
client/assets/src/applets/settings.js

index d292ef08b7226a93ee5cdf402539f8eefaba6272..e8c35dd2669d7b5932898cd89f087d7a112145c3 100644 (file)
 \r
             $.each(_kiwi.global.settings.attributes, function(key, value) {\r
 \r
-                switch ($('[data-setting="' + key + '"]', that.$el).prop('type')) {\r
+                var $el = $('[data-setting="' + key + '"]', that.$el);\r
+\r
+                // Only deal with settings we have a UI element for\r
+                if (!$el)\r
+                    return;\r
+\r
+                switch ($el.prop('type')) {\r
                     case 'checkbox':\r
-                        $('[data-setting="' + key + '"]', that.$el).prop('checked', value);\r
+                        $el.prop('checked', value);\r
                         break;\r
                     case 'radio':\r
                         $('[data-setting="' + key + '"][value="' + value + '"]', that.$el).prop('checked', true);\r
                         break;\r
                     case 'text':\r
-                        $('[data-setting="' + key + '"]', that.$el).val(value);\r
+                        $el.val(value);\r
                         break;\r
                     default:\r
                         $('[data-setting="' + key + '"][data-value="' + value + '"]', that.$el).addClass('active');\r