Add dynamic checkboxes

Conflicts:
	vendor/built_in_modules/ask_new/app/views/panel/ask/back_end/ask_questions/edit.html.erb
This commit is contained in:
Bernie Chiu 2013-09-11 15:50:14 +08:00 committed by chris
parent 883496ede1
commit 71dad22b04
1 changed files with 20 additions and 2 deletions

View File

@ -1,7 +1,23 @@
<script> <script type="text/javascript">
$('table tr').hide();
$(document).ready(function() {
if ($("#ask_reply_status").val() == '轉介其他單位') { $('.dept_options').show(); }
$("#ask_reply_status").change(function() {
$('.dept_options').slideUp();
if ($(this).find('option:selected').attr('value') == '轉介其他單位') {
$('.dept_options').slideDown();
}
});
});
</script> </script>
<style type="text/css">
.dept_options {
display: none;
}
</style>
<div id="ask_question_reply"> <div id="ask_question_reply">
<%= form_for @ask_reply, url: @url, method: @method do |f| %> <%= form_for @ask_reply, url: @url, method: @method do |f| %>
<table class="table"> <table class="table">
@ -39,6 +55,7 @@
</tr> </tr>
<tr> <tr>
<td colspan="5" class="dept_options"> <td colspan="5" class="dept_options">
<div class="dept_options">
<%= check_box("school", "depts", {:multiple => true}, "localhost:3000", nil) %><%= label_tag(:dep1, "總務長室暨總務處秘書室") %> <%= check_box("school", "depts", {:multiple => true}, "localhost:3000", nil) %><%= label_tag(:dep1, "總務長室暨總務處秘書室") %>
<%= check_box("school", "depts", {:multiple => true}, "localhost:4000", nil) %><%= label_tag(:dep2, "文書組") %> <%= check_box("school", "depts", {:multiple => true}, "localhost:4000", nil) %><%= label_tag(:dep2, "文書組") %>
<%= check_box("school", "depts", {:multiple => true}, "事務組", nil) %><%= label_tag(:dep3, "事務組") %> <%= check_box("school", "depts", {:multiple => true}, "事務組", nil) %><%= label_tag(:dep3, "事務組") %>
@ -50,6 +67,7 @@
<%= check_box("school", "depts", {:multiple => true}, "駐警隊", nil) %><%= label_tag(:dep9, "駐警隊") %> <%= check_box("school", "depts", {:multiple => true}, "駐警隊", nil) %><%= label_tag(:dep9, "駐警隊") %>
<%= check_box("school", "depts", {:multiple => true}, "社科院總務分處", nil) %><%= label_tag(:dep10, "社科院總務分處") %> <%= check_box("school", "depts", {:multiple => true}, "社科院總務分處", nil) %><%= label_tag(:dep10, "社科院總務分處") %>
<%= check_box("school", "depts", {:multiple => true}, "醫學院總務分處", nil) %><%= label_tag(:dep11, "醫學院總務分處") %> <%= check_box("school", "depts", {:multiple => true}, "醫學院總務分處", nil) %><%= label_tag(:dep11, "醫學院總務分處") %>
</div>
</td> </td>
</tr> </tr>
<tr> <tr>