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",
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",
data: "is_insensitive"
title: "Case-Sensitive",
data: "is_insensitive",
className: "text-center",
render: data => renderBooleanColumn(!data)
},
{
title: "Type",

View File

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