From 1e97fd64593b051b74fcf4e26dfad7dc4fbeabdb Mon Sep 17 00:00:00 2001 From: Megastruktur Date: Mon, 4 Jan 2021 18:21:41 +0300 Subject: [PATCH] GH-95 - Closes #95 - Fixes Turf custom turf list checkboxes --- module/blades.js | 9 +++++++++ templates/parts/turf-list.html | 20 ++++++++++++++------ 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/module/blades.js b/module/blades.js index 1d23828..15fc099 100644 --- a/module/blades.js +++ b/module/blades.js @@ -49,6 +49,15 @@ Hooks.once("init", async function() { preloadHandlebarsTemplates(); + // Is the value Turf side. + Handlebars.registerHelper('is_turf_side', function(value, options) { + if (["left", "right", "top", "bottom"].includes(value)) { + return options.fn(this); + } else { + return options.inverse(this); + } + }); + // Multiboxes. Handlebars.registerHelper('multiboxes', function(selected, options) { diff --git a/templates/parts/turf-list.html b/templates/parts/turf-list.html index 2159e80..96b18aa 100644 --- a/templates/parts/turf-list.html +++ b/templates/parts/turf-list.html @@ -4,8 +4,16 @@ {{#each turfs_data as |turf id|}}
- {{#each turf.connects as |connect|}} -
+ {{#each turf.connects as |connect key|}} + + {{#is_turf_side key}} + {{#if connect}} +
+ {{/if}} + {{else}} +
+ {{/is_turf_side}} + {{/each}} {{#if ../can_edit}} @@ -16,10 +24,10 @@
{{#multiboxes turf.connects}} - - - - + + + + {{/multiboxes}}