From b0c7cd7da57abe03c68ba3116e4a083b830b8f8c Mon Sep 17 00:00:00 2001 From: Gregoo Date: Tue, 4 Feb 2025 09:32:57 +0100 Subject: [PATCH] Enforce hidden features in the card and grid filters/sort --- templates/macro/badge.html | 8 ++++++-- templates/set/card.html | 12 +++++++++--- templates/set/filter.html | 16 ++++++++++++---- templates/set/sort.html | 4 ++++ 4 files changed, 31 insertions(+), 9 deletions(-) diff --git a/templates/macro/badge.html b/templates/macro/badge.html index e1f9071..ea2be58 100644 --- a/templates/macro/badge.html +++ b/templates/macro/badge.html @@ -103,7 +103,9 @@ {% endmacro %} {% macro total_damaged(damaged, solo=false, last=false) %} - {{ badge(check=damaged, solo=solo, last=last, color='danger', icon='error-warning-line', collapsible='Damaged:', text=damaged, alt='Damaged') }} + {% if not config['HIDE_TABLE_DAMAGED_PARTS'] %} + {{ badge(check=damaged, solo=solo, last=last, color='danger', icon='error-warning-line', collapsible='Damaged:', text=damaged, alt='Damaged') }} + {% endif %} {% endmacro %} {% macro total_quantity(quantity, solo=false, last=false) %} @@ -115,7 +117,9 @@ {% endmacro %} {% macro total_missing(missing, solo=false, last=false) %} - {{ badge(check=missing, solo=solo, last=last, color='light text-danger-emphasis bg-danger-subtle border border-danger-subtle', icon='question-line', collapsible='Missing:', text=missing, alt='Missing') }} + {% if not config['HIDE_TABLE_MISSING_PARTS'] %} + {{ badge(check=missing, solo=solo, last=last, color='light text-danger-emphasis bg-danger-subtle border border-danger-subtle', icon='question-line', collapsible='Missing:', text=missing, alt='Missing') }} + {% endif %} {% endmacro %} {% macro total_sets(sets, solo=false, last=false) %} diff --git a/templates/set/card.html b/templates/set/card.html index f47a7ca..2064206 100644 --- a/templates/set/card.html +++ b/templates/set/card.html @@ -7,10 +7,16 @@ {% if not solo and not tiny %} data-index="{{ index }}" data-number="{{ item.fields.set }}" data-name="{{ item.fields.name | lower }}" data-parts="{{ item.fields.number_of_parts }}" data-year="{{ item.fields.year }}" data-theme="{{ item.theme.name | lower }}" - data-has-missing-instructions="{{ (not (item.instructions | length)) | int }}" + {% if not config['HIDE_SET_INSTRUCTIONS'] %} + data-has-missing-instructions="{{ (item.instructions | length == 0) | int }}" + {% endif %} data-has-minifigures="{{ (item.fields.total_minifigures > 0) | int }}" data-minifigures="{{ item.fields.total_minifigures }}" - data-has-missing="{{ (item.fields.total_missing > 0) | int }}" data-missing="{{ item.fields.total_missing }}" - data-has-damaged="{{ (item.fields.total_damaged > 0) | int }}" data-damaged="{{ item.fields.total_damaged }}" + {% if not config['HIDE_TABLE_MISSING_PARTS'] %} + data-has-missing="{{ (item.fields.total_missing > 0) | int }}" data-missing="{{ item.fields.total_missing }}" + {% endif %} + {% if not config['HIDE_TABLE_DAMAGED_PARTS'] %} + data-has-damaged="{{ (item.fields.total_damaged > 0) | int }}" data-damaged="{{ item.fields.total_damaged }}" + {% endif %} data-has-storage="{{ item.fields.storage is not none | int }}" {% if item.fields.storage is not none %} data-storage="{{ item.fields.storage }}" diff --git a/templates/set/filter.html b/templates/set/filter.html index 65c3343..8f3b410 100644 --- a/templates/set/filter.html +++ b/templates/set/filter.html @@ -7,10 +7,18 @@ data-filter="metadata" autocomplete="off"> - - - - + {% if not config['HIDE_TABLE_MISSING_PARTS'] %} + + + {% endif %} + {% if not config['HIDE_TABLE_DAMAGED_PARTS'] %} + + + {% endif %} + {% if not config['HIDE_SET_INSTRUCTIONS'] %} + + + {% endif %} {% if brickset_storages | length %} diff --git a/templates/set/sort.html b/templates/set/sort.html index 09f31f0..3315a1d 100644 --- a/templates/set/sort.html +++ b/templates/set/sort.html @@ -14,10 +14,14 @@ data-sort-attribute="minifigures" data-sort-desc="true"> Figures + {% if not config['HIDE_TABLE_MISSING_PARTS'] %} + {% endif %} + {% if not config['HIDE_TABLE_DAMAGED_PARTS'] %} + {% endif %}