浏览代码

Moved js to external file

Andrew Kane 8 年之前
父节点
当前提交
d7e32aa974

+ 4 - 0
app/assets/javascripts/blazer/application.js

@@ -29,6 +29,10 @@ $(document).on("submit", "form[method=get]", function() {
   return false;
 });
 
+$(document).on("change", "#bind input, #bind select", function () {
+  submitIfCompleted($(this).closest("form"));
+});
+
 function uuid() {
   return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
     var r = Math.random()*16|0, v = c == 'x' ? r : (r&0x3|0x8);

+ 0 - 6
app/views/blazer/dashboards/show.html.erb

@@ -45,9 +45,3 @@
     });
   </script>
 <% end %>
-
-<script>
-  $(".form-inline input, .form-inline select").change( function () {
-    submitIfCompleted($(this).closest("form"));
-  });
-</script>

+ 0 - 6
app/views/blazer/queries/show.html.erb

@@ -77,9 +77,3 @@
     }
   </script>
 <% end %>
-
-<script>
-  $(".form-inline input, .form-inline select").change( function () {
-    submitIfCompleted($(this).closest("form"));
-  });
-</script>