parent
ff7197455c
commit
1e97fd6459
2 changed files with 23 additions and 6 deletions
|
@ -49,6 +49,15 @@ Hooks.once("init", async function() {
|
||||||
preloadHandlebarsTemplates();
|
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.
|
// Multiboxes.
|
||||||
Handlebars.registerHelper('multiboxes', function(selected, options) {
|
Handlebars.registerHelper('multiboxes', function(selected, options) {
|
||||||
|
|
||||||
|
|
|
@ -4,8 +4,16 @@
|
||||||
{{#each turfs_data as |turf id|}}
|
{{#each turfs_data as |turf id|}}
|
||||||
<div class="turf-block {{#if turf.value}}turf-selected{{/if}}">
|
<div class="turf-block {{#if turf.value}}turf-selected{{/if}}">
|
||||||
|
|
||||||
{{#each turf.connects as |connect|}}
|
{{#each turf.connects as |connect key|}}
|
||||||
|
|
||||||
|
{{#is_turf_side key}}
|
||||||
|
{{#if connect}}
|
||||||
|
<div class="connector {{key}}"></div>
|
||||||
|
{{/if}}
|
||||||
|
{{else}}
|
||||||
<div class="connector {{connect}}"></div>
|
<div class="connector {{connect}}"></div>
|
||||||
|
{{/is_turf_side}}
|
||||||
|
|
||||||
{{/each}}
|
{{/each}}
|
||||||
|
|
||||||
{{#if ../can_edit}}
|
{{#if ../can_edit}}
|
||||||
|
@ -16,10 +24,10 @@
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
{{#multiboxes turf.connects}}
|
{{#multiboxes turf.connects}}
|
||||||
<input type="checkbox" name="data.turfs.{{id}}.connects" value="left">
|
<input type="checkbox" name="data.turfs.{{id}}.connects.left" {{checked turf.connects.left}}>
|
||||||
<input type="checkbox" name="data.turfs.{{id}}.connects" value="top">
|
<input type="checkbox" name="data.turfs.{{id}}.connects.top" {{checked turf.connects.top}}>
|
||||||
<input type="checkbox" name="data.turfs.{{id}}.connects" value="right">
|
<input type="checkbox" name="data.turfs.{{id}}.connects.right" {{checked turf.connects.right}}>
|
||||||
<input type="checkbox" name="data.turfs.{{id}}.connects" value="bottom">
|
<input type="checkbox" name="data.turfs.{{id}}.connects.bottom" {{checked turf.connects.bottom}}>
|
||||||
{{/multiboxes}}
|
{{/multiboxes}}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
Reference in a new issue