diff --git a/module/tirage/fenetre-recherche-tirage.js b/module/tirage/fenetre-recherche-tirage.js
index 5ab4a008..2c2f589a 100644
--- a/module/tirage/fenetre-recherche-tirage.js
+++ b/module/tirage/fenetre-recherche-tirage.js
@@ -59,6 +59,7 @@ export class FenetreRechercheTirage extends Application {
width: 600,
height: 600,
popOut: true,
+ dragDrop: [{ dragSelector: "a.content-link" }],
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 async create(tirage = {}) {
- new FenetreRechercheTirage(tirage).render(true);
+ static async create(options) {
+ new FenetreRechercheTirage(options).render(true);
}
- constructor(tirage) {
- super();
- this.tirage = tirage;
+ constructor(options) {
+ super(options);
+ this.tirage = {};
this.compendiums = [
SystemCompendiums.getCompendium('faune-flore-mineraux'),
SystemCompendiums.getCompendium('equipement')
@@ -131,6 +132,12 @@ export class FenetreRechercheTirage extends Application {
}
}
+ _canDragStart() {
+ return true;
+ }
+ _onDragStart(event) {
+ console.log('_onDragStart', event)
+ }
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.recherche-filtres").click(async event => {
- 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.recherche-filtres").click(async event => await this.recherche())
this.html.find("a.tirage-filtres").click(async event => {
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() {
const filter = this.getSelectedItemsFilter();
const equipementCompendiumTable = new CompendiumTable('equipement', 'Item');
diff --git a/templates/common/compendium-link.hbs b/templates/common/compendium-link.hbs
index d8516b2f..849be884 100644
--- a/templates/common/compendium-link.hbs
+++ b/templates/common/compendium-link.hbs
@@ -1,20 +1,22 @@
-{{#if pack}}
-{{!-- draggable="true" --}}
-
-{{else}}
-
-{{/if}}
-{{#if img}}
-
-{{else}}
-
-{{/if}}
-{{name}}
+
+ {{#if pack}}
+ {{!-- draggable="true" --}}
+
+ {{else}}
+
+ {{/if}}
+ {{#if img}}
+
+ {{else}}
+
+ {{/if}}
+ {{name}}
+