Removed "Both" column from Content recipe builder step.

This commit is contained in:
Sipke Schoorstra
2015-07-24 11:42:26 +01:00
parent a88b35192e
commit f6e5f6b91e
2 changed files with 18 additions and 59 deletions

View File

@@ -1,63 +1,25 @@
(function($) {
$(function() {
$("table.items").each(function() {
var table = $(this);
$(function () {
$("table.items thead tr input[type='checkbox'].check-all-in-column").each(function () {
var master = $(this);
var columnIndex = master.closest("th").index() + 1;
var slaves = master.closest("table").find("tbody tr td:nth-child(" + columnIndex + ") input[type='checkbox']:not(:disabled)");
table.on("click", ".check-schema, .check-data", function (e) {
updateState();
var updateMaster = function () {
var allChecked = slaves.filter(":not(:checked)").length == 0;
master.prop("checked", allChecked);
}
master.on("change", function () {
var isChecked = $(this).is(":checked");
slaves.prop("checked", isChecked);
});
table.on("click", ".check-both", function (e) {
var sender = $(this);
var isChecked = sender.is(":checked");
var row = sender.closest("tr");
row.find(".check-schema, .check-data").prop("checked", isChecked);
updateState();
slaves.on("change", function () {
updateMaster();
});
table.on("click", ".check-all-schema", function (e) {
var sender = $(this);
var isChecked = sender.is(":checked");
table.find(".check-schema").prop("checked", isChecked);
updateState();
});
table.on("click", ".check-all-data", function (e) {
var sender = $(this);
var isChecked = sender.is(":checked");
table.find(".check-data").prop("checked", isChecked);
updateState();
});
table.on("click", ".check-all-both", function (e) {
var sender = $(this);
var isChecked = sender.is(":checked");
table.find(".check-schema").prop("checked", isChecked);
table.find(".check-data").prop("checked", isChecked);
updateState();
});
var updateState = function () {
table.find("tbody tr").each(function() {
var tr = $(this);
var checkSchema = tr.find(".check-schema").is(":checked");
var checkData = tr.find(".check-data").is(":checked");
tr.find(".check-both").prop("checked", checkSchema && checkData);
});
var allBothChecked = table.find(".check-both").not(":checked").length === 0;
var allSchemaChecked = table.find(".check-schema").not(":checked").length === 0;
var allDataChecked = table.find(".check-data").not(":checked").length === 0;
table.find(".check-all-both").prop("checked", allBothChecked);
table.find(".check-all-schema").prop("checked", allSchemaChecked);
table.find(".check-all-data").prop("checked", allDataChecked);
};
updateMaster();
});
});
})(jQuery);

View File

@@ -11,13 +11,11 @@
<th>@T("Content Type")</th>
<th>@T("Schema")</th>
<th>@T("Data")</th>
<th>@T("Both")</th>
</tr>
<tr class="sub">
<th>&nbsp;</th>
<th><input type="checkbox" class="check-all-schema" /></th>
<th><input type="checkbox" class="check-all-data" /></th>
<th><input type="checkbox" class="check-all-both" /></th>
<th><input type="checkbox" class="check-all-in-column" /></th>
<th><input type="checkbox" class="check-all-in-column" /></th>
</tr>
</thead>
<tbody>
@@ -32,7 +30,6 @@
<td>
<input type="checkbox" class="check-data" name="@Html.NameFor(m => m.ContentTypes[contentTypeIndex].ExportData)" value="true" />
</td>
<td><input type="checkbox" class="check-both" /></td>
</tr>
contentTypeIndex++;
}