Add a flag to hide instructions in a set card
This commit is contained in:
parent
53309a9502
commit
3bbcf2c21c
@ -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
|
||||
|
@ -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},
|
||||
|
@ -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,
|
||||
|
@ -35,7 +35,7 @@
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
{% if solo %}
|
||||
{% if solo and not config['HIDE_SET_INSTRUCTIONS'] %}
|
||||
<div class="accordion accordion-flush border-top" id="set-details">
|
||||
{% if not delete %}
|
||||
{{ accordion.header('Instructions', 'instructions', 'set-details', expanded=open_instructions, quantity=item.instructions | length, icon='file-line', class='p-0') }}
|
||||
|
Loading…
Reference in New Issue
Block a user