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
v0.3.1-spetzel2020 v0.4.3
opus1217 2021-03-11 18:26:51 -08:00
parent d7d8e85e3c
commit 1679b50859
7 changed files with 18 additions and 14 deletions

View File

@ -35,6 +35,7 @@
10-Mar-2021 0.4.3: activateItemListListeners(): Remove spurious li.parents (wasn't being used anyway) 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 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 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 = { const CMPBrowser = {
@ -250,22 +251,23 @@ class CompendiumBrowser extends Application {
this.triggerSort(html, "npc"); this.triggerSort(html, "npc");
// reset filters and re-render // 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 => { html.find('#reset-spell-filter').click(ev => {
this.spellFilters.activeFilters = {}; this.resetFilters();
//v0.4.3: Re-render so that we display the filters correctly //v0.4.3: Re-render so that we display the filters correctly
this.refreshList = "spell"; this.refreshList = "spell";
this.render(); this.render();
}); });
html.find('#reset-feat-filter').click(ev => { html.find('#reset-feat-filter').click(ev => {
this.featFilters.activeFilters = {}; this.resetFilters();
//v0.4.3: Re-render so that we display the filters correctly //v0.4.3: Re-render so that we display the filters correctly
this.refreshList = "feat"; this.refreshList = "feat";
this.render(); this.render();
}); });
html.find('#reset-item-filter').click(ev => { html.find('#reset-item-filter').click(ev => {
this.itemFilters.activeFilters = {}; this.resetFilters();
//v0.4.3: Re-render so that we display the filters correctly //v0.4.3: Re-render so that we display the filters correctly
this.refreshList = "item"; this.refreshList = "item";
this.render(); this.render();
@ -273,7 +275,7 @@ class CompendiumBrowser extends Application {
}); });
html.find('#reset-npc-filter').click(ev => { html.find('#reset-npc-filter').click(ev => {
this.npcFilters.activeFilters = {}; this.resetFilters();
//v0.4.3: Re-render so that we display the filters correctly //v0.4.3: Re-render so that we display the filters correctly
this.refreshList = "npc"; this.refreshList = "npc";
this.render(); this.render();
@ -765,7 +767,8 @@ class CompendiumBrowser extends Application {
/* Hook to load the first data */ /* Hook to load the first data */
static afterRender(cb, html) { 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;} if (!cb?.refreshList) {return;}
cb.replaceList(html, cb.refreshList); cb.replaceList(html, cb.refreshList);

View File

@ -63,6 +63,7 @@
"CMPBrowser.SETTING.Maxload.NAME" : "Maximum load", "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.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.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"
} }

View File

@ -8,10 +8,10 @@
<dt>{{localize "CMPBrowser.sortBy"}}:</dt> <dt>{{localize "CMPBrowser.sortBy"}}:</dt>
<dd><select class="null" name="sortorder"> <dd><select class="null" name="sortorder">
<option value="true" selected>{{localize "Name"}}</option> <option value="true" selected>{{localize "Name"}}</option>
<option value="false">Class</option> <option value="false">{{localize "DND5E.ItemTypeClass"}}</option>
</select></dd> </select></dd>
</dl> </dl>
<button id="reset-feat-filter">Reset Filters</button> <button id="reset-feat-filter">{{localize "CMPBrowser.Filters.ResetFilters"}}</button>
</div> </div>
{{> "modules/compendium-browser/template/filter-container.html" filters=featFilters}} {{> "modules/compendium-browser/template/filter-container.html" filters=featFilters}}
</div> </div>

View File

@ -8,10 +8,10 @@
<dt>{{localize "CMPBrowser.sortBy"}}:</dt> <dt>{{localize "CMPBrowser.sortBy"}}:</dt>
<dd><select class="null" name="sortorder"> <dd><select class="null" name="sortorder">
<option value="true" selected>{{localize "Name"}}</option> <option value="true" selected>{{localize "Name"}}</option>
<option value="false">Item Type</option> <option value="false">{{localize "DND5E.Type"}}</option>
</select></dd> </select></dd>
</dl> </dl>
<button id="reset-item-filter">Reset Filters</button> <button id="reset-item-filter">{{localize "CMPBrowser.Filters.ResetFilters"}}</button>
</div> </div>
{{> "modules/compendium-browser/template/filter-container.html" filters=itemFilters}} {{> "modules/compendium-browser/template/filter-container.html" filters=itemFilters}}
</div> </div>

View File

@ -12,7 +12,7 @@
<option value="size">{{localize "DND5E.Size"}}</option> <option value="size">{{localize "DND5E.Size"}}</option>
</select></dd> </select></dd>
</dl> </dl>
<button id="reset-npc-filter">Reset NPC Filters</button> <button id="reset-npc-filter">{{localize "CMPBrowser.Filters.ResetFilters"}}</button>
</div> </div>
{{> "modules/compendium-browser/template/filter-container.html" filters=npcFilters}} {{> "modules/compendium-browser/template/filter-container.html" filters=npcFilters}}
</div> </div>

View File

@ -11,7 +11,7 @@
<option value="false">{{localize "CMPBrowser.lvl"}}</option> <option value="false">{{localize "CMPBrowser.lvl"}}</option>
</select></dd> </select></dd>
</dl> </dl>
<button id="reset-spell-filter">Reset Spell Filters</button> <button id="reset-spell-filter">{{localize "CMPBrowser.Filters.ResetFilters"}}</button>
</div> </div>
{{> "modules/compendium-browser/template/filter-container.html" filters=spellFilters}} {{> "modules/compendium-browser/template/filter-container.html" filters=spellFilters}}
</div> </div>

View File

@ -9,8 +9,8 @@
<div class="content"> <div class="content">
<div class="tab" data-tab="spell">{{#if showSpellBrowser}}{{> "modules/compendium-browser/template/spell-browser.html"}}{{/if}}</div> <div class="tab" data-tab="spell">{{#if showSpellBrowser}}{{> "modules/compendium-browser/template/spell-browser.html"}}{{/if}}</div>
<div class="tab" data-tab="feat">{{#if showSpellBrowser}}{{> "modules/compendium-browser/template/feat-browser.html"}}{{/if}}</div> <div class="tab" data-tab="feat">{{#if showFeatBrowser}}{{> "modules/compendium-browser/template/feat-browser.html"}}{{/if}}</div>
<div class="tab" data-tab="item">{{#if showSpellBrowser}}{{> "modules/compendium-browser/template/item-browser.html"}}{{/if}}</div> <div class="tab" data-tab="item">{{#if showItemBrowser}}{{> "modules/compendium-browser/template/item-browser.html"}}{{/if}}</div>
<div class="tab" data-tab="npc">{{#if showNpcBrowser}} {{> "modules/compendium-browser/template/npc-browser.html"}}{{/if}}</div> <div class="tab" data-tab="npc">{{#if showNpcBrowser}} {{> "modules/compendium-browser/template/npc-browser.html"}}{{/if}}</div>
<div class="tab" data-tab="setting">{{#if isGM}} {{> "modules/compendium-browser/template/settings.html"}}{{/if}}</div> <div class="tab" data-tab="setting">{{#if isGM}} {{> "modules/compendium-browser/template/settings.html"}}{{/if}}</div>
</div> </div>