mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-03-21 21:22:11 -03:00
feat: conditionally hide license filters on recipes page
Add shouldShowLicenseFilters method to check if current page is 'recipes' and skip license filter initialization and updates when on recipes page. Also conditionally render license filter section in header template based on current page. This prevents license filters from appearing on the recipes page where they are not applicable.
This commit is contained in:
@@ -39,8 +39,10 @@ export class FilterManager {
|
||||
this.createModelTypeTags();
|
||||
}
|
||||
|
||||
// Add click handlers for license filter tags
|
||||
this.initializeLicenseFilters();
|
||||
// Add click handlers for license filter tags if supported on this page
|
||||
if (this.shouldShowLicenseFilters()) {
|
||||
this.initializeLicenseFilters();
|
||||
}
|
||||
|
||||
// Add click handler for filter button
|
||||
if (this.filterButton) {
|
||||
@@ -386,8 +388,10 @@ export class FilterManager {
|
||||
this.applyTagElementState(tag, state);
|
||||
});
|
||||
|
||||
// Update license tags
|
||||
this.updateLicenseSelections();
|
||||
// Update license tags if visible on this page
|
||||
if (this.shouldShowLicenseFilters()) {
|
||||
this.updateLicenseSelections();
|
||||
}
|
||||
this.updateModelTypeSelections();
|
||||
}
|
||||
|
||||
@@ -546,11 +550,15 @@ export class FilterManager {
|
||||
...source,
|
||||
baseModel: Array.isArray(source.baseModel) ? [...source.baseModel] : [],
|
||||
tags: this.normalizeTagFilters(source.tags),
|
||||
license: this.normalizeLicenseFilters(source.license),
|
||||
license: this.shouldShowLicenseFilters() ? this.normalizeLicenseFilters(source.license) : {},
|
||||
modelTypes: this.normalizeModelTypeFilters(source.modelTypes)
|
||||
};
|
||||
}
|
||||
|
||||
shouldShowLicenseFilters() {
|
||||
return this.currentPage !== 'recipes';
|
||||
}
|
||||
|
||||
normalizeTagFilters(tagFilters) {
|
||||
if (!tagFilters) {
|
||||
return {};
|
||||
|
||||
@@ -147,6 +147,7 @@
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if current_page != 'recipes' %}
|
||||
<div class="filter-section">
|
||||
<h4>{{ t('header.filter.license') }}</h4>
|
||||
<div class="filter-tags">
|
||||
@@ -158,6 +159,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="filter-actions">
|
||||
<button class="clear-filters-btn" onclick="filterManager.clearFilters()">
|
||||
{{ t('header.filter.clearAll') }}
|
||||
|
||||
Reference in New Issue
Block a user