From 1679b50859ff73cb30d33098bafca79f3f4fd08c Mon Sep 17 00:00:00 2001 From: opus1217 Date: Thu, 11 Mar 2021 18:26:51 -0800 Subject: [PATCH] 0.4.3b 11-Mar-2020 - Changed Reset Filters prompt to be consistent - Fully fixed Issue #4 (filters still showing after reset) compendium-browser.js - Clear all filters to match displayed *-browser.html - Substitute more localization tags template.html - Fixed unlisted bug for content (repeated #if showSpellBrowser) en.json - Add localization for "Reset Filters" prompt --- compendium-browser.js | 13 ++++++++----- lang/en.json | 3 ++- template/feat-browser.html | 4 ++-- template/item-browser.html | 4 ++-- template/npc-browser.html | 2 +- template/spell-browser.html | 2 +- template/template.html | 4 ++-- 7 files changed, 18 insertions(+), 14 deletions(-) diff --git a/compendium-browser.js b/compendium-browser.js index 0f2ed2c..9807685 100644 --- a/compendium-browser.js +++ b/compendium-browser.js @@ -35,6 +35,7 @@ 10-Mar-2021 0.4.3: activateItemListListeners(): Remove spurious li.parents (wasn't being used anyway) 11-Mar-2021 0.4.3 Fixed: Reset Filters doesn't clear the on-screen filter fields (because it is not completely re-rendering like it used to) Issue #4 Hack solution is to re-render whole dialog which unfortunately loses filter settings on other tabs as well + 0.4.3b: Clear all filters to match displayed */ const CMPBrowser = { @@ -250,22 +251,23 @@ class CompendiumBrowser extends Application { this.triggerSort(html, "npc"); // reset filters and re-render + //0.4.3: Reset ALL filters because when we do a re-render it affects all tabs html.find('#reset-spell-filter').click(ev => { - this.spellFilters.activeFilters = {}; + this.resetFilters(); //v0.4.3: Re-render so that we display the filters correctly this.refreshList = "spell"; this.render(); }); html.find('#reset-feat-filter').click(ev => { - this.featFilters.activeFilters = {}; + this.resetFilters(); //v0.4.3: Re-render so that we display the filters correctly this.refreshList = "feat"; this.render(); }); html.find('#reset-item-filter').click(ev => { - this.itemFilters.activeFilters = {}; + this.resetFilters(); //v0.4.3: Re-render so that we display the filters correctly this.refreshList = "item"; this.render(); @@ -273,7 +275,7 @@ class CompendiumBrowser extends Application { }); html.find('#reset-npc-filter').click(ev => { - this.npcFilters.activeFilters = {}; + this.resetFilters(); //v0.4.3: Re-render so that we display the filters correctly this.refreshList = "npc"; this.render(); @@ -765,7 +767,8 @@ class CompendiumBrowser extends Application { /* Hook to load the first data */ static afterRender(cb, html) { - //0.4.3 afterRender is a render hook,but we call it just for the tab when we're just re-rendering for filters + //0.4.3: Because a render always resets ALL the displayed filters (on all tabs) to unselected , we have to blank all the lists as well + // (because the current HTML template doesn't set the selected filter values) if (!cb?.refreshList) {return;} cb.replaceList(html, cb.refreshList); diff --git a/lang/en.json b/lang/en.json index 8c43e23..501edcc 100644 --- a/lang/en.json +++ b/lang/en.json @@ -63,6 +63,7 @@ "CMPBrowser.SETTING.Maxload.NAME" : "Maximum load", "CMPBrowser.SETTING.Maxload.HINT" : "Maximum number of spells, feats, items, or NPCs to display; to see more use the filters. This setting is to allow manageing memory and server load.", "CMPBrowser.LOADING.Message" : "Loaded...{numLoaded} {itemType}s", - "CMPBrowser.LOADING.MaxLoaded" : "(maximum displayed; to see more, use the filters)" + "CMPBrowser.LOADING.MaxLoaded" : "(maximum displayed; to see more, use the filters)", + "CMPBrowser.Filters.ResetFilters" : "Reset Filters" } \ No newline at end of file diff --git a/template/feat-browser.html b/template/feat-browser.html index 1d21166..0960e31 100644 --- a/template/feat-browser.html +++ b/template/feat-browser.html @@ -8,10 +8,10 @@
{{localize "CMPBrowser.sortBy"}}:
- + {{> "modules/compendium-browser/template/filter-container.html" filters=featFilters}} diff --git a/template/item-browser.html b/template/item-browser.html index 2c72c23..7b8b217 100644 --- a/template/item-browser.html +++ b/template/item-browser.html @@ -8,10 +8,10 @@
{{localize "CMPBrowser.sortBy"}}:
- + {{> "modules/compendium-browser/template/filter-container.html" filters=itemFilters}} diff --git a/template/npc-browser.html b/template/npc-browser.html index e45c1a2..16167a3 100644 --- a/template/npc-browser.html +++ b/template/npc-browser.html @@ -12,7 +12,7 @@ - + {{> "modules/compendium-browser/template/filter-container.html" filters=npcFilters}} diff --git a/template/spell-browser.html b/template/spell-browser.html index 100315a..66c3613 100644 --- a/template/spell-browser.html +++ b/template/spell-browser.html @@ -11,7 +11,7 @@ - + {{> "modules/compendium-browser/template/filter-container.html" filters=spellFilters}} diff --git a/template/template.html b/template/template.html index a73382e..ec5f6dc 100644 --- a/template/template.html +++ b/template/template.html @@ -9,8 +9,8 @@
{{#if showSpellBrowser}}{{> "modules/compendium-browser/template/spell-browser.html"}}{{/if}}
-
{{#if showSpellBrowser}}{{> "modules/compendium-browser/template/feat-browser.html"}}{{/if}}
-
{{#if showSpellBrowser}}{{> "modules/compendium-browser/template/item-browser.html"}}{{/if}}
+
{{#if showFeatBrowser}}{{> "modules/compendium-browser/template/feat-browser.html"}}{{/if}}
+
{{#if showItemBrowser}}{{> "modules/compendium-browser/template/item-browser.html"}}{{/if}}
{{#if showNpcBrowser}} {{> "modules/compendium-browser/template/npc-browser.html"}}{{/if}}
{{#if isGM}} {{> "modules/compendium-browser/template/settings.html"}}{{/if}}