mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-02-28 09:43:01 +08:00
Add checkbox behaviour to experiment contents
This commit is contained in:
parent
3f33ebe59a
commit
dc82830a8f
1 changed files with 20 additions and 0 deletions
|
@ -30,9 +30,29 @@
|
|||
<script type="javascript">
|
||||
$(function() {
|
||||
var form = $("#add-contents-form");
|
||||
var experimentTab = form.find("#experiment-tab");
|
||||
var moduleTab = form.find("#module-tab");
|
||||
var stepsTab = form.find("#module-steps-tab");
|
||||
|
||||
var experimentCheckAlls = experimentTab.find(".experiment-all-cb");
|
||||
var experimentAll = experimentTab.find("input:checkbox");
|
||||
experimentCheckAlls.click(function() {
|
||||
var nextUl = $(this).closest("div.checkbox").next();
|
||||
if (nextUl.length && nextUl.is("ul.experiment-contents-list")) {
|
||||
nextUl.find("input:checkbox").prop("checked", this.checked);
|
||||
}
|
||||
});
|
||||
experimentAll.click(function() {
|
||||
var parentLists = $(this).parents("ul.experiment-contents-list");
|
||||
|
||||
if (parentLists.length) {
|
||||
var prevEl = parentLists.prev();
|
||||
if (prevEl.length && prevEl.is("div.checkbox")) {
|
||||
prevEl.find("input:checkbox").prop("checked", false);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var moduleCheckAll = moduleTab.find(".module-check-all");
|
||||
var moduleOthers = moduleTab.find("input:checkbox:not(.module-check-all)");
|
||||
var moduleResultsAll = moduleTab.find(".results-all");
|
||||
|
|
Loading…
Reference in a new issue