Display RGB color, transparency and prints for parts
This commit is contained in:
parent
8b5784bc9e
commit
75f730ae7f
@ -134,6 +134,14 @@ class RebrickablePart(BrickRecord):
|
|||||||
spare=self.fields.spare,
|
spare=self.fields.spare,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Compute the url for the original of the printed part
|
||||||
|
def url_for_print(self, /) -> str:
|
||||||
|
return url_for(
|
||||||
|
'part.details',
|
||||||
|
part=self.fields.print,
|
||||||
|
color=self.fields.color,
|
||||||
|
)
|
||||||
|
|
||||||
# Compute the url for the rebrickable page
|
# Compute the url for the rebrickable page
|
||||||
def url_for_rebrickable(self, /) -> str:
|
def url_for_rebrickable(self, /) -> str:
|
||||||
if current_app.config['REBRICKABLE_LINKS']:
|
if current_app.config['REBRICKABLE_LINKS']:
|
||||||
|
@ -19,7 +19,7 @@ SELECT
|
|||||||
"rebrickable_parts"."image",
|
"rebrickable_parts"."image",
|
||||||
"rebrickable_parts"."image_id",
|
"rebrickable_parts"."image_id",
|
||||||
"rebrickable_parts"."url",
|
"rebrickable_parts"."url",
|
||||||
--"rebrickable_parts"."print",
|
"rebrickable_parts"."print",
|
||||||
{% block total_missing %}
|
{% block total_missing %}
|
||||||
NULL AS "total_missing", -- dummy for order: total_missing
|
NULL AS "total_missing", -- dummy for order: total_missing
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -59,3 +59,9 @@
|
|||||||
.sortable thead th {
|
.sortable thead th {
|
||||||
font-weight: bold !important;
|
font-weight: bold !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.color-rgb {
|
||||||
|
display: inline-block;
|
||||||
|
width: 15px;
|
||||||
|
height: 15px;
|
||||||
|
}
|
@ -1,11 +1,20 @@
|
|||||||
{% macro header(item, name, solo=false, identifier=none, color=none, icon='hashtag') %}
|
{% macro header(item, name, solo=false, identifier=none, icon='hashtag') %}
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
{% if not solo %}
|
{% if not solo %}
|
||||||
<a class="text-decoration-none text-reset" href="{{ item.url() }}" data-bs-toggle="tooltip" title="{{ name }}">
|
<a class="text-decoration-none text-reset" href="{{ item.url() }}" data-bs-toggle="tooltip" title="{{ name }}">
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<h5 class="mb-0 {% if not solo %}fs-6 text-nowrap overflow-x-hidden text-truncate{% endif %}">
|
<h5 class="mb-0 {% if not solo %}fs-6 text-nowrap overflow-x-hidden text-truncate{% endif %}">
|
||||||
{% if identifier %}<span class="badge text-bg-secondary fw-normal"><i class="ri-{{ icon }}"></i>{{ identifier }}</span>{% endif %}
|
{% if identifier %}<span class="badge text-bg-secondary fw-normal"><i class="ri-{{ icon }}"></i>{{ identifier }}</span>{% endif %}
|
||||||
{% if color %}<span class="badge text-bg-light fw-normal border"><i class="ri-palette-line"></i> {{ color }}</span>{% endif %}
|
{% if item.fields.color_name %}
|
||||||
|
<span class="badge bg-white text-black fw-normal border"><i class="ri-palette-line"></i>
|
||||||
|
{% if item.fields.color_rgb %}
|
||||||
|
<span class="color-rgb align-bottom border border-black" style="background-color: #{{ item.fields.color_rgb }};"></span>
|
||||||
|
{% endif %}
|
||||||
|
{{ item.fields.color_name }}
|
||||||
|
</span>
|
||||||
|
{% endif %}
|
||||||
|
{% if item.fields.color_transparent %}<span class="badge text-bg-light fw-normal border"><i class="ri-blur-off-line"></i> Transparent</span>{% endif %}
|
||||||
|
{% if item.fields.print %}<span class="badge text-bg-light fw-normal border"><a class="text-reset" href="{{ item.url_for_print() }}"><i class="ri-paint-brush-line"></i> Print</a></span>{% endif %}
|
||||||
{{ name }}
|
{{ name }}
|
||||||
</h5>
|
</h5>
|
||||||
{% if not solo %}
|
{% if not solo %}
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
{% import 'macro/card.html' as card %}
|
{% import 'macro/card.html' as card %}
|
||||||
|
|
||||||
<div class="card mb-3 flex-fill card-solo">
|
<div class="card mb-3 flex-fill card-solo">
|
||||||
{{ card.header(item, item.fields.name, solo=solo, identifier=item.fields.part, color=item.fields.color, icon='shapes-line') }}
|
{{ card.header(item, item.fields.name, solo=solo, identifier=item.fields.part, icon='shapes-line') }}
|
||||||
{{ card.image(item, solo=solo, last=last, caption=item.fields.name, alt=item.fields.image_id, medium=true) }}
|
{{ card.image(item, solo=solo, last=last, caption=item.fields.name, alt=item.fields.image_id, medium=true) }}
|
||||||
<div class="card-body border-bottom {% if not solo %}p-1{% endif %}">
|
<div class="card-body border-bottom {% if not solo %}p-1{% endif %}">
|
||||||
{{ badge.total_sets(sets_using | length, solo=solo, last=last) }}
|
{{ badge.total_sets(sets_using | length, solo=solo, last=last) }}
|
||||||
|
@ -15,7 +15,10 @@
|
|||||||
{{ table.bricklink(item) }}
|
{{ table.bricklink(item) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
<td>{{ item.fields.color_name }}</td>
|
<td>
|
||||||
|
{% if item.fields.color_rgb %}<span class="color-rgb align-middle border border-black" style="background-color: #{{ item.fields.color_rgb }};"></span>{% endif %}
|
||||||
|
<span class="align-middle">{{ item.fields.color_name }}</span>
|
||||||
|
</td>
|
||||||
{% if not no_quantity %}
|
{% if not no_quantity %}
|
||||||
{% if all %}
|
{% if all %}
|
||||||
<td>{{ item.fields.total_quantity }}</td>
|
<td>{{ item.fields.total_quantity }}</td>
|
||||||
|
Loading…
Reference in New Issue
Block a user