소스 검색

clean up code

Mattia Larentis 12 년 전
부모
커밋
b44cf14381
1개의 변경된 파일5개의 추가작업 그리고 4개의 파일을 삭제
  1. 5 4
      static/js/bootstrap-switch.js

+ 5 - 4
static/js/bootstrap-switch.js

@@ -11,7 +11,7 @@
  * Licensed under the Apache License, Version 2.0
  * http://www.apache.org/licenses/LICENSE-2.0
  * ============================================================ */
- 
+
 !function ($) {
   "use strict";
 
@@ -210,12 +210,13 @@
               }
             });
 
-            if ($form.data('bootstrapSwitch') != 'injected') {
+            if ($form.data('bootstrapSwitch') !== 'injected') {
               $form.bind('reset', function () {
                 setTimeout(function () {
                   $form.find('.switch').each(function () {
-                    var $this = $(this);
-                    $this.bootstrapSwitch('setState', $this.bootstrapSwitch('status'));
+                    var $input = $(this).find('input');
+                    
+                    $input.prop('checked', $input.is(':checked')).trigger('change');
                   });
                 }, 1);
               });