diff --git a/.env.sample b/.env.sample index 7cbc5c0..06584db 100644 --- a/.env.sample +++ b/.env.sample @@ -111,6 +111,10 @@ # Default: false # BK_HIDE_MISSING_PARTS=true +# Optional: Hide the 'Instructions' entry in a Set card +# Default: false +# BK_HIDE_SET_INSTRUCTIONS=true + # Optional: Hide the 'Wishlist' entry from the menu. Does not disable the route. # Default: false # BK_HIDE_WISHES=true diff --git a/bricktracker/config.py b/bricktracker/config.py index 08db61b..f9d8f2b 100644 --- a/bricktracker/config.py +++ b/bricktracker/config.py @@ -30,6 +30,7 @@ CONFIG: Final[list[dict[str, Any]]] = [ {'n': 'HIDE_ALL_PARTS', 'c': bool}, {'n': 'HIDE_ALL_SETS', 'c': bool}, {'n': 'HIDE_MISSING_PARTS', 'c': bool}, + {'n': 'HIDE_SET_INSTRUCTIONS', 'c': bool}, {'n': 'HIDE_WISHES', 'c': bool}, {'n': 'MINIFIGURES_DEFAULT_ORDER', 'd': '"minifigures"."name" ASC'}, {'n': 'MINIFIGURES_FOLDER', 'd': 'minifigs', 's': True}, diff --git a/bricktracker/set.py b/bricktracker/set.py index aa536b8..f16ea6f 100644 --- a/bricktracker/set.py +++ b/bricktracker/set.py @@ -3,7 +3,7 @@ import traceback from typing import Any, Self from uuid import uuid4 -from flask import url_for +from flask import current_app, url_for from .exceptions import DatabaseException, NotFoundException from .minifigure_list import BrickMinifigureList @@ -179,7 +179,10 @@ class BrickSet(RebrickableSet): # Compute the url for the set instructions def url_for_instructions(self, /) -> str: - if len(self.instructions): + if ( + not current_app.config['HIDE_SET_INSTRUCTIONS'] and + len(self.instructions) + ): return url_for( 'set.details', id=self.fields.id, diff --git a/templates/set/card.html b/templates/set/card.html index 9fcea3d..1308c71 100644 --- a/templates/set/card.html +++ b/templates/set/card.html @@ -35,7 +35,7 @@ {% endfor %} {% endif %} - {% if solo %} + {% if solo and not config['HIDE_SET_INSTRUCTIONS'] %}
{% if not delete %} {{ accordion.header('Instructions', 'instructions', 'set-details', expanded=open_instructions, quantity=item.instructions | length, icon='file-line', class='p-0') }}