implement abstract bool column rendering

This commit is contained in:
Corban-Lee Jones 2024-09-30 14:03:27 +01:00
parent 903f09279a
commit 186ba3d21a
2 changed files with 24 additions and 27 deletions

View File

@ -17,11 +17,26 @@ function initFiltersModule() {
}, },
{ {
title: "Algorithm", title: "Algorithm",
data: "matching_algorithm" data: "matching_algorithm",
render: function(data) {
switch (data) {
case 1: return "Any Word";
case 2: return "All Words";
case 3: return "Exact Match";
case 4: return "Regular Expression";
case 5: return "Fuzzy Match";
default:
console.error(`unknown matching algorithm '${data}'`);
return data;
}
}
}, },
{ {
title: "Case Insensitive", title: "Case-Sensitive",
data: "is_insensitive" data: "is_insensitive",
className: "text-center",
render: data => renderBooleanColumn(!data)
}, },
{ {
title: "Type", title: "Type",

View File

@ -20,55 +20,37 @@ function initMessageStylesModule() {
title: "Is Embed", title: "Is Embed",
data: "is_embed", data: "is_embed",
className: "text-center", className: "text-center",
render: function(data) { render: renderBooleanColumn
const iconClass = data ? "bi-check-circle-fill text-success" : "bi-x-circle-fill text-danger";
return `<i class="bi ${iconClass}"></i>`;
}
}, },
{ {
title: "Is Hyperlinked", title: "Is Hyperlinked",
data: "is_hyperlinked", data: "is_hyperlinked",
className: "text-center", className: "text-center",
render: function(data) { render: renderBooleanColumn
const iconClass = data ? "bi-check-circle-fill text-success" : "bi-x-circle-fill text-danger";
return `<i class="bi ${iconClass}"></i>`;
}
}, },
{ {
title: "Show Author", title: "Show Author",
data: "show_author", data: "show_author",
className: "text-center", className: "text-center",
render: function(data) { render: renderBooleanColumn
const iconClass = data ? "bi-check-circle-fill text-success" : "bi-x-circle-fill text-danger";
return `<i class="bi ${iconClass}"></i>`;
}
}, },
{ {
title: "Show Timestamp", title: "Show Timestamp",
data: "show_timestamp", data: "show_timestamp",
className: "text-center", className: "text-center",
render: function(data) { render: renderBooleanColumn
const iconClass = data ? "bi-check-circle-fill text-success" : "bi-x-circle-fill text-danger";
return `<i class="bi ${iconClass}"></i>`;
}
}, },
{ {
title: "Show Images", title: "Show Images",
data: "show_images", data: "show_images",
className: "text-center", className: "text-center",
render: function(data) { render: renderBooleanColumn
const iconClass = data ? "bi-check-circle-fill text-success" : "bi-x-circle-fill text-danger";
return `<i class="bi ${iconClass}"></i>`;
}
}, },
{ {
title: "Fetch Images", title: "Fetch Images",
data: "fetch_images", data: "fetch_images",
className: "text-center", className: "text-center",
render: function(data) { render: renderBooleanColumn
const iconClass = data ? "bi-check-circle-fill text-success" : "bi-x-circle-fill text-danger";
return `<i class="bi ${iconClass}"></i>`;
}
}, },
{ {
title: "Title Mutator", title: "Title Mutator",