From 9c16cf7641d0be15aa6d923c32c6d8fe3b5cd575 Mon Sep 17 00:00:00 2001 From: sladecraven Date: Tue, 1 Dec 2020 22:18:15 +0100 Subject: [PATCH] =?UTF-8?q?#48=20:=20Zone=20de=20saisie=20priv=C3=A9e=20po?= =?UTF-8?q?ur=20le=20MJ?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- module/actor-sheet.js | 10 ++++++++- module/rdd-utility.js | 23 +++++++++++++++++++- styles/simple.css | 9 ++++++++ templates/actor-inventaire-conteneur.html | 26 ++++++++++++++--------- 4 files changed, 56 insertions(+), 12 deletions(-) diff --git a/module/actor-sheet.js b/module/actor-sheet.js index 10d48c6d..5466a50e 100644 --- a/module/actor-sheet.js +++ b/module/actor-sheet.js @@ -11,6 +11,7 @@ export class RdDActorSheet extends ActorSheet { /** @override */ static get defaultOptions() { + RdDUtility.initAfficheContenu(); return mergeObject(super.defaultOptions, { classes: ["rdd", "sheet", "actor"], template: "systems/foundryvtt-reve-de-dragon/templates/actor-sheet.html", @@ -25,7 +26,7 @@ export class RdDActorSheet extends ActorSheet { /* -------------------------------------------- */ getData() { let data = super.getData(); - + data.itemsByType = RdDUtility.buildItemsClassification(data.items); // Competence per category data.competenceByCategory = {}; @@ -279,6 +280,13 @@ export class RdDActorSheet extends ActorSheet { item.sheet.render(true); }); + // Display info about queue + html.find('.conteneur-name a').click((event) => { + let myID = event.currentTarget.attributes['data-item-id'].value; + RdDUtility.toggleAfficheContenu( myID ); + this.render(true); + }); + if (this.options.editCaracComp) { // On carac change html.find('.carac-value').change((event) => { diff --git a/module/rdd-utility.js b/module/rdd-utility.js index 016b452b..ce1bcd25 100644 --- a/module/rdd-utility.js +++ b/module/rdd-utility.js @@ -171,6 +171,20 @@ export class RdDUtility { return []; } + /* -------------------------------------------- */ + static initAfficheContenu( actorId ) { // persistent handling of conteneur show/hide + if ( !this.afficheContenu ) + this.afficheContenu = {}; + } + /* -------------------------------------------- */ + static toggleAfficheContenu( conteneurId) { + this.afficheContenu[conteneurId] = !this.afficheContenu[conteneurId]; + } + /* -------------------------------------------- */ + static getAfficheContenu( conteneurId) { + return this.afficheContenu[conteneurId]; + } + /* -------------------------------------------- */ static filterItemsPerTypeForSheet( data ) { data.data.materiel = this.checkNull(data.itemsByType['objet']); @@ -240,9 +254,16 @@ export class RdDUtility { */ static buildConteneur( objet, niveau ) { if (!niveau) niveau = 1; + objet.niveau = niveau; + //console.log("OBJ:", objet); let str = Handlebars.partials['systems/foundryvtt-reve-de-dragon/templates/actor-inventaire-conteneur.html']( { item: objet} ); if (objet.type == 'conteneur') { - str = str + "