feat(sets): show bricklink if enabled
This commit is contained in:
@@ -32,6 +32,11 @@
|
|||||||
# Default: https://www.bricklink.com/v2/catalog/catalogitem.page?P={part}&C={color}
|
# Default: https://www.bricklink.com/v2/catalog/catalogitem.page?P={part}&C={color}
|
||||||
# BK_BRICKLINK_LINK_PART_PATTERN=
|
# BK_BRICKLINK_LINK_PART_PATTERN=
|
||||||
|
|
||||||
|
# Optional: Pattern of the link to Bricklink for a set. Will be passed to Python .format()
|
||||||
|
# Supports {set_num} parameter. Set numbers in format like '10255-1' are used.
|
||||||
|
# Default: https://www.bricklink.com/v2/catalog/catalogitem.page?S={set_num}
|
||||||
|
# BK_BRICKLINK_LINK_SET_PATTERN=
|
||||||
|
|
||||||
# Optional: Display Bricklink links wherever applicable
|
# Optional: Display Bricklink links wherever applicable
|
||||||
# Default: false
|
# Default: false
|
||||||
# BK_BRICKLINK_LINKS=true
|
# BK_BRICKLINK_LINKS=true
|
||||||
|
|||||||
@@ -75,6 +75,10 @@
|
|||||||
- Works with both server-side and client-side pagination modes
|
- Works with both server-side and client-side pagination modes
|
||||||
- Consolidated mode: Shows sets that have multiple instances
|
- Consolidated mode: Shows sets that have multiple instances
|
||||||
- Non-consolidated mode: Shows sets that appear multiple times in collection
|
- Non-consolidated mode: Shows sets that appear multiple times in collection
|
||||||
|
- Add BrickLink links for sets
|
||||||
|
- BrickLink badge links now appear on set cards and set details pages alongside Rebrickable links
|
||||||
|
- `BK_BRICKLINK_LINK_SET_PATTERN`: New environment variable for BrickLink set URL pattern (default: https://www.bricklink.com/v2/catalog/catalogitem.page?S={set_num})
|
||||||
|
- Controlled by existing `BK_BRICKLINK_LINKS` environment variable
|
||||||
- Add live environment variable configuration management system
|
- Add live environment variable configuration management system
|
||||||
- Configuration Management interface in admin panel with live preview and badge system
|
- Configuration Management interface in admin panel with live preview and badge system
|
||||||
- Live settings: Can be changed without application restart (menu visibility, table display, pagination, features)
|
- Live settings: Can be changed without application restart (menu visibility, table display, pagination, features)
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ CONFIG: Final[list[dict[str, Any]]] = [
|
|||||||
{'n': 'AUTHENTICATION_PASSWORD', 'd': ''},
|
{'n': 'AUTHENTICATION_PASSWORD', 'd': ''},
|
||||||
{'n': 'AUTHENTICATION_KEY', 'd': ''},
|
{'n': 'AUTHENTICATION_KEY', 'd': ''},
|
||||||
{'n': 'BRICKLINK_LINK_PART_PATTERN', 'd': 'https://www.bricklink.com/v2/catalog/catalogitem.page?P={part}&C={color}'}, # noqa: E501
|
{'n': 'BRICKLINK_LINK_PART_PATTERN', 'd': 'https://www.bricklink.com/v2/catalog/catalogitem.page?P={part}&C={color}'}, # noqa: E501
|
||||||
|
{'n': 'BRICKLINK_LINK_SET_PATTERN', 'd': 'https://www.bricklink.com/v2/catalog/catalogitem.page?S={set_num}'}, # noqa: E501
|
||||||
{'n': 'BRICKLINK_LINKS', 'c': bool},
|
{'n': 'BRICKLINK_LINKS', 'c': bool},
|
||||||
{'n': 'DATABASE_PATH', 'd': './app.db'},
|
{'n': 'DATABASE_PATH', 'd': './app.db'},
|
||||||
{'n': 'DATABASE_TIMESTAMP_FORMAT', 'd': '%Y-%m-%d-%H-%M-%S'},
|
{'n': 'DATABASE_TIMESTAMP_FORMAT', 'd': '%Y-%m-%d-%H-%M-%S'},
|
||||||
|
|||||||
@@ -62,6 +62,7 @@ LIVE_CHANGEABLE_VARS: Final[List[str]] = [
|
|||||||
'BK_WISHES_DEFAULT_ORDER',
|
'BK_WISHES_DEFAULT_ORDER',
|
||||||
# URL and Pattern Variables
|
# URL and Pattern Variables
|
||||||
'BK_BRICKLINK_LINK_PART_PATTERN',
|
'BK_BRICKLINK_LINK_PART_PATTERN',
|
||||||
|
'BK_BRICKLINK_LINK_SET_PATTERN',
|
||||||
'BK_REBRICKABLE_IMAGE_NIL',
|
'BK_REBRICKABLE_IMAGE_NIL',
|
||||||
'BK_REBRICKABLE_IMAGE_NIL_MINIFIGURE',
|
'BK_REBRICKABLE_IMAGE_NIL_MINIFIGURE',
|
||||||
'BK_REBRICKABLE_LINK_MINIFIGURE_PATTERN',
|
'BK_REBRICKABLE_LINK_MINIFIGURE_PATTERN',
|
||||||
|
|||||||
@@ -179,6 +179,15 @@ class RebrickableSet(BrickRecord):
|
|||||||
|
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
|
# Compute the url for the bricklink page
|
||||||
|
def url_for_bricklink(self, /) -> str:
|
||||||
|
if current_app.config['BRICKLINK_LINKS']:
|
||||||
|
return current_app.config['BRICKLINK_LINK_SET_PATTERN'].format(
|
||||||
|
set_num=self.fields.set
|
||||||
|
)
|
||||||
|
|
||||||
|
return ''
|
||||||
|
|
||||||
# Compute the url for the refresh button
|
# Compute the url for the refresh button
|
||||||
def url_for_refresh(self, /) -> str:
|
def url_for_refresh(self, /) -> str:
|
||||||
return url_for('set.refresh', set=self.fields.set)
|
return url_for('set.refresh', set=self.fields.set)
|
||||||
|
|||||||
@@ -83,6 +83,7 @@
|
|||||||
{{ badge.instructions(item, solo=solo, last=last) }}
|
{{ badge.instructions(item, solo=solo, last=last) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{{ badge.rebrickable(item, solo=solo, last=last) }}
|
{{ badge.rebrickable(item, solo=solo, last=last) }}
|
||||||
|
{{ badge.bricklink(item, solo=solo, last=last) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
{% if not tiny and brickset_statuses | length %}
|
{% if not tiny and brickset_statuses | length %}
|
||||||
|
|||||||
Reference in New Issue
Block a user