Add a flag to hide instructions in a set card
This commit is contained in:
parent
a9bf5e03f8
commit
b489cd1ec3
@ -111,6 +111,10 @@
|
|||||||
# Default: false
|
# Default: false
|
||||||
# BK_HIDE_MISSING_PARTS=true
|
# 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.
|
# Optional: Hide the 'Wishlist' entry from the menu. Does not disable the route.
|
||||||
# Default: false
|
# Default: false
|
||||||
# BK_HIDE_WISHES=true
|
# BK_HIDE_WISHES=true
|
||||||
|
@ -30,6 +30,7 @@ CONFIG: Final[list[dict[str, Any]]] = [
|
|||||||
{'n': 'HIDE_ALL_PARTS', 'c': bool},
|
{'n': 'HIDE_ALL_PARTS', 'c': bool},
|
||||||
{'n': 'HIDE_ALL_SETS', 'c': bool},
|
{'n': 'HIDE_ALL_SETS', 'c': bool},
|
||||||
{'n': 'HIDE_MISSING_PARTS', 'c': bool},
|
{'n': 'HIDE_MISSING_PARTS', 'c': bool},
|
||||||
|
{'n': 'HIDE_SET_INSTRUCTIONS', 'c': bool},
|
||||||
{'n': 'HIDE_WISHES', 'c': bool},
|
{'n': 'HIDE_WISHES', 'c': bool},
|
||||||
{'n': 'MINIFIGURES_DEFAULT_ORDER', 'd': '"minifigures"."name" ASC'},
|
{'n': 'MINIFIGURES_DEFAULT_ORDER', 'd': '"minifigures"."name" ASC'},
|
||||||
{'n': 'MINIFIGURES_FOLDER', 'd': 'minifigs', 's': True},
|
{'n': 'MINIFIGURES_FOLDER', 'd': 'minifigs', 's': True},
|
||||||
|
@ -3,7 +3,7 @@ import traceback
|
|||||||
from typing import Any, Self
|
from typing import Any, Self
|
||||||
from uuid import uuid4
|
from uuid import uuid4
|
||||||
|
|
||||||
from flask import url_for
|
from flask import current_app, url_for
|
||||||
|
|
||||||
from .exceptions import DatabaseException, NotFoundException
|
from .exceptions import DatabaseException, NotFoundException
|
||||||
from .minifigure_list import BrickMinifigureList
|
from .minifigure_list import BrickMinifigureList
|
||||||
@ -179,7 +179,10 @@ class BrickSet(RebrickableSet):
|
|||||||
|
|
||||||
# Compute the url for the set instructions
|
# Compute the url for the set instructions
|
||||||
def url_for_instructions(self, /) -> str:
|
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(
|
return url_for(
|
||||||
'set.details',
|
'set.details',
|
||||||
id=self.fields.id,
|
id=self.fields.id,
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if solo %}
|
{% if solo and not config['HIDE_SET_INSTRUCTIONS'] %}
|
||||||
<div class="accordion accordion-flush border-top" id="set-details">
|
<div class="accordion accordion-flush border-top" id="set-details">
|
||||||
{% if not delete %}
|
{% if not delete %}
|
||||||
{{ accordion.header('Instructions', 'instructions', 'set-details', expanded=open_instructions, quantity=item.instructions | length, icon='file-line', class='p-0') }}
|
{{ 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