#48 : Zone de saisie privée pour le MJ
This commit is contained in:
parent
8361a90f32
commit
9c16cf7641
@ -11,6 +11,7 @@ export class RdDActorSheet extends ActorSheet {
|
|||||||
|
|
||||||
/** @override */
|
/** @override */
|
||||||
static get defaultOptions() {
|
static get defaultOptions() {
|
||||||
|
RdDUtility.initAfficheContenu();
|
||||||
return mergeObject(super.defaultOptions, {
|
return mergeObject(super.defaultOptions, {
|
||||||
classes: ["rdd", "sheet", "actor"],
|
classes: ["rdd", "sheet", "actor"],
|
||||||
template: "systems/foundryvtt-reve-de-dragon/templates/actor-sheet.html",
|
template: "systems/foundryvtt-reve-de-dragon/templates/actor-sheet.html",
|
||||||
@ -279,6 +280,13 @@ export class RdDActorSheet extends ActorSheet {
|
|||||||
item.sheet.render(true);
|
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) {
|
if (this.options.editCaracComp) {
|
||||||
// On carac change
|
// On carac change
|
||||||
html.find('.carac-value').change((event) => {
|
html.find('.carac-value').change((event) => {
|
||||||
|
@ -171,6 +171,20 @@ export class RdDUtility {
|
|||||||
return [];
|
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 ) {
|
static filterItemsPerTypeForSheet( data ) {
|
||||||
data.data.materiel = this.checkNull(data.itemsByType['objet']);
|
data.data.materiel = this.checkNull(data.itemsByType['objet']);
|
||||||
@ -240,9 +254,16 @@ export class RdDUtility {
|
|||||||
*/
|
*/
|
||||||
static buildConteneur( objet, niveau ) {
|
static buildConteneur( objet, niveau ) {
|
||||||
if (!niveau) niveau = 1;
|
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} );
|
let str = Handlebars.partials['systems/foundryvtt-reve-de-dragon/templates/actor-inventaire-conteneur.html']( { item: objet} );
|
||||||
if (objet.type == 'conteneur') {
|
if (objet.type == 'conteneur') {
|
||||||
str = str + "<ul class='item-list alterne-list list-item-margin"+niveau+"'>";
|
//console.log("ITEM DISPLAYED", this.getAfficheContenu(objet._id) );
|
||||||
|
if ( this.getAfficheContenu(objet._id) ) {
|
||||||
|
str = str + "<ul class='item-list alterne-list item-display-show list-item-margin"+niveau+"'>";
|
||||||
|
} else {
|
||||||
|
str = str + "<ul class='item-list alterne-list item-display-hide list-item-margin"+niveau+"'>";
|
||||||
|
}
|
||||||
for (let subItem of objet.subItems) {
|
for (let subItem of objet.subItems) {
|
||||||
str = str + this.buildConteneur(subItem, niveau+1);
|
str = str + this.buildConteneur(subItem, niveau+1);
|
||||||
}
|
}
|
||||||
|
@ -518,6 +518,15 @@ ul, li {
|
|||||||
padding: 0.125rem;
|
padding: 0.125rem;
|
||||||
flex: 1 1 5rem;
|
flex: 1 1 5rem;
|
||||||
}
|
}
|
||||||
|
.item-display-show {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
.item-display-hide {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.conteneur-type {
|
||||||
|
background: rgb(200, 10, 100, 0.25);
|
||||||
|
}
|
||||||
|
|
||||||
.item-quantite {
|
.item-quantite {
|
||||||
margin-left: 0.5rem;
|
margin-left: 0.5rem;
|
||||||
|
@ -1,10 +1,16 @@
|
|||||||
<li class="item flexrow list-item" data-item-id="{{item._id}}">
|
<li class="item flexrow list-item" data-item-id="{{item._id}}">
|
||||||
<img class="sheet-competence-img" src="{{item.img}}" title="{{item.name}}"/>
|
<img class="sheet-competence-img" src="{{item.img}}" title="{{item.name}}"/>
|
||||||
|
|
||||||
|
{{#if (eq item.type 'conteneur')}}
|
||||||
|
<span class="item-name conteneur-name"><a data-item-id="{{item._id}}">+{{item.name}}</a></span>
|
||||||
|
{{else}}
|
||||||
<span class="item-name">{{item.name}}</span>
|
<span class="item-name">{{item.name}}</span>
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
<span class="item-quantite">{{item.data.quantite}}</span>
|
<span class="item-quantite">{{item.data.quantite}}</span>
|
||||||
<span class="item-quantite">{{numberFormat item.data.encTotal decimals=2}}</span>
|
<span class="item-quantite">{{numberFormat item.data.encTotal decimals=2}}</span>
|
||||||
<div class="item-controls">
|
<div class="item-controls">
|
||||||
<a class="item-control item-edit" title="Editer"><i class="fas fa-edit"></i></a>
|
<a class="item-control item-edit" title="Editer"><i class="fas fa-edit"></i></a>
|
||||||
<a class="item-control item-delete" title="Supprimer"><i class="fas fa-trash"></i></a>
|
<a class="item-control item-delete" title="Supprimer"><i class="fas fa-trash"></i></a>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
|
Loading…
Reference in New Issue
Block a user