Move js into a file for status in form

This commit is contained in:
chris 2013-09-11 18:38:56 +08:00
parent 579bc3c245
commit 911cfdc980
3 changed files with 12 additions and 9 deletions

View File

@ -0,0 +1,10 @@
$(function() {
$(document).on('click',"*[data-toggle=buttons-checkbox] input",function(){
var d = $(this).parent().find("input[type=hidden]");
if($(this).is(":checked")){
d.val("1");
}else{
d.val("0");
}
})
});

View File

@ -9,6 +9,7 @@
<%= javascript_include_tag "lib/datetimepicker/datetimepicker.js" %> <%= javascript_include_tag "lib/datetimepicker/datetimepicker.js" %>
<%= javascript_include_tag "lib/modal-preview" %> <%= javascript_include_tag "lib/modal-preview" %>
<%= javascript_include_tag "lib/file-type" %> <%= javascript_include_tag "lib/file-type" %>
<%= javascript_include_tag "lib/module-area" %>
<% end %> <% end %>
<%= f.error_messages %> <%= f.error_messages %>
@ -307,15 +308,6 @@
$(this).parents('.start-line').hide(); $(this).parents('.start-line').hide();
} }
}); });
$(document).on('click',"*[data-toggle=buttons-checkbox] input",function(){
var d = $(this).parent().find("input[type=hidden]");
if($(this).is(":checked")){
d.val("1");
}else{
d.val("0");
}
})
}); });
</script> </script>
<% end %> <% end %>

View File

@ -7,6 +7,7 @@
<% content_for :page_specific_javascript do %> <% content_for :page_specific_javascript do %>
<%= javascript_include_tag "lib/bootstrap-fileupload" %> <%= javascript_include_tag "lib/bootstrap-fileupload" %>
<%= javascript_include_tag "lib/file-type" %> <%= javascript_include_tag "lib/file-type" %>
<%= javascript_include_tag "lib/module-area" %>
<% end %> <% end %>
<%= f.error_messages %> <%= f.error_messages %>