Drag depuis la fenêtre de recherche
This commit is contained in:
parent
40fdff4057
commit
948309bb4f
@ -59,6 +59,7 @@ export class FenetreRechercheTirage extends Application {
|
|||||||
width: 600,
|
width: 600,
|
||||||
height: 600,
|
height: 600,
|
||||||
popOut: true,
|
popOut: true,
|
||||||
|
dragDrop: [{ dragSelector: "a.content-link" }],
|
||||||
resizable: true
|
resizable: true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -83,13 +84,13 @@ export class FenetreRechercheTirage extends Application {
|
|||||||
}
|
}
|
||||||
static $typeToFilter(type) { return { group: 'type', code: type, label: Misc.typeName('Item', type), check: item => item.type == type }; }
|
static $typeToFilter(type) { return { group: 'type', code: type, label: Misc.typeName('Item', type), check: item => item.type == type }; }
|
||||||
|
|
||||||
static async create(tirage = {}) {
|
static async create(options) {
|
||||||
new FenetreRechercheTirage(tirage).render(true);
|
new FenetreRechercheTirage(options).render(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(tirage) {
|
constructor(options) {
|
||||||
super();
|
super(options);
|
||||||
this.tirage = tirage;
|
this.tirage = {};
|
||||||
this.compendiums = [
|
this.compendiums = [
|
||||||
SystemCompendiums.getCompendium('faune-flore-mineraux'),
|
SystemCompendiums.getCompendium('faune-flore-mineraux'),
|
||||||
SystemCompendiums.getCompendium('equipement')
|
SystemCompendiums.getCompendium('equipement')
|
||||||
@ -131,6 +132,12 @@ export class FenetreRechercheTirage extends Application {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_canDragStart() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
_onDragStart(event) {
|
||||||
|
console.log('_onDragStart', event)
|
||||||
|
}
|
||||||
|
|
||||||
activateListeners(html) {
|
activateListeners(html) {
|
||||||
super.activateListeners(html);
|
super.activateListeners(html);
|
||||||
@ -150,10 +157,7 @@ export class FenetreRechercheTirage extends Application {
|
|||||||
|
|
||||||
this.html.find("a.supprimer-filtres").click(async event => this.html.find('input.activate-filter:checked').prop("checked", false))
|
this.html.find("a.supprimer-filtres").click(async event => this.html.find('input.activate-filter:checked').prop("checked", false))
|
||||||
|
|
||||||
this.html.find("a.recherche-filtres").click(async event => {
|
this.html.find("a.recherche-filtres").click(async event => await this.recherche())
|
||||||
const table = await this.buildTable();
|
|
||||||
this.html.find('div.liste-resultats').html(await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/tirage/liste-resultats.hbs`, { resultats: table }));
|
|
||||||
})
|
|
||||||
|
|
||||||
this.html.find("a.tirage-filtres").click(async event => {
|
this.html.find("a.tirage-filtres").click(async event => {
|
||||||
const table = await this.buildTable();
|
const table = await this.buildTable();
|
||||||
@ -162,6 +166,13 @@ export class FenetreRechercheTirage extends Application {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async recherche() {
|
||||||
|
const table = await this.buildTable();
|
||||||
|
const htmlResultats = await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/tirage/liste-resultats.hbs`, { resultats: table });
|
||||||
|
this.html.find('div.liste-resultats').html(htmlResultats);
|
||||||
|
this._dragDrop.forEach(dragDropHandler => dragDropHandler.bind(this.element[0]))
|
||||||
|
}
|
||||||
|
|
||||||
async buildTable() {
|
async buildTable() {
|
||||||
const filter = this.getSelectedItemsFilter();
|
const filter = this.getSelectedItemsFilter();
|
||||||
const equipementCompendiumTable = new CompendiumTable('equipement', 'Item');
|
const equipementCompendiumTable = new CompendiumTable('equipement', 'Item');
|
||||||
|
@ -1,20 +1,22 @@
|
|||||||
{{#if pack}}
|
<span draggable="true">
|
||||||
{{!-- draggable="true" --}}
|
{{#if pack}}
|
||||||
<a class="content-link"
|
{{!-- draggable="true" --}}
|
||||||
data-uuid="Compendium.{{pack}}.{{id}}"
|
<a class="content-link"
|
||||||
data-pack="{{pack}}"
|
data-uuid="Compendium.{{pack}}.{{id}}"
|
||||||
{{#if doctype}}data-doctype="{{doctype}}"{{/if}}
|
data-pack="{{pack}}"
|
||||||
data-id="{{id}}"
|
{{#if doctype}}data-doctype="{{doctype}}"{{/if}}
|
||||||
>
|
data-id="{{id}}"
|
||||||
{{else}}
|
>
|
||||||
<a class="rdd-world-content-link"
|
{{else}}
|
||||||
{{#if doctype}}data-doctype="{{doctype}}"{{/if}}
|
<a class="rdd-world-content-link"
|
||||||
data-id="{{id}}"
|
{{#if doctype}}data-doctype="{{doctype}}"{{/if}}
|
||||||
>
|
data-id="{{id}}"
|
||||||
{{/if}}
|
>
|
||||||
{{#if img}}
|
{{/if}}
|
||||||
<img class="in-text-img" src="{{img}}" alt="{{name}}" />
|
{{#if img}}
|
||||||
{{else}}
|
<img class="in-text-img" src="{{img}}" alt="{{name}}" />
|
||||||
<i class="fas fa-suitcase"></i>
|
{{else}}
|
||||||
{{/if}}
|
<i class="fas fa-suitcase"></i>
|
||||||
{{name}}</a>
|
{{/if}}
|
||||||
|
{{name}}</a>
|
||||||
|
</span>
|
||||||
|
Loading…
Reference in New Issue
Block a user