148: Added "enable all" checkbox to each category.

This commit is contained in:
Sipke Schoorstra
2014-07-01 17:13:53 -07:00
parent 7787ce9138
commit 4588d906d7
2 changed files with 51 additions and 9 deletions

View File

@@ -1,10 +1,44 @@
(function($) {
// Initialize Expando control
$(".expando-wrapper legend").expandoControl(
function (controller) {
return controller.nextAll(".expando");
}, {
collapse: true,
remember: true
var initExpandoControl = function() {
// Initialize Expando control
$(".expando-wrapper legend").expandoControl(
function(controller) {
return controller.nextAll(".expando");
}, {
collapse: true,
remember: true
});
};
var initCheckAll = function() {
// Check all / uncheck all.
$("table.check-all").each(function() {
var table = $(this);
var controller = table.find("thead input[type=\"checkbox\"]");
var checkboxes = table.find("tbody input[type=\"checkbox\"]");
var updateController = function () {
var allChecked = checkboxes.filter(":not(:checked)").length == 0;
controller.prop("checked", allChecked);
}
table.on("change", "thead input[type=\"checkbox\"]", function() {
var isChecked = $(this).is(":checked");
checkboxes.prop("checked", isChecked);
});
table.on("change", "tbody input[type=\"checkbox\"]", function () {
updateController();
});
updateController();
});
};
$(function() {
initExpandoControl();
initCheckAll();
});
})(jQuery);

View File

@@ -1,6 +1,9 @@
@model Orchard.AuditTrail.ViewModels.AuditTrailSettingsViewModel
@{
Style.Include("admin.css");
Script.Require("ShapesBase");
Script.Include("~/Themes/TheAdmin/scripts/admin.js").AtFoot();
Script.Include("audit-trail-admin.js").AtFoot();
}
<div class="audit-trail-site-settings">
<fieldset>
@@ -12,12 +15,17 @@
<fieldset>
<legend>@category.Name</legend>
<input type="hidden" name="AuditTrailSettingsPart.Categories[@i].Category" value="@category.Category" />
<table class="items">
<table class="items check-all">
<thead>
<tr>
<th class="event-name">@T("Event")</th>
<th>@T("Description")</th>
<th class="event-enabled">@T("Enabled")</th>
<th class="event-enabled">
<label>
<input type="checkbox"/>
@T("Enabled")
</label>
</th>
</tr>
</thead>
@{ var j = 0; }