WIP: Initial work on deduplicating the minifigures and parts #57

Draft
gregoo wants to merge 19 commits from gregoo/BrickTracker:master into master
Showing only changes of commit 426f0bb123 - Show all commits

View File

@ -35,26 +35,28 @@
{% endfor %} {% endfor %}
</ul> </ul>
{% endif %} {% endif %}
{% if solo and not config['HIDE_SET_INSTRUCTIONS'] %} {% if solo %}
<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') }} {% if not config['HIDE_SET_INSTRUCTIONS'] %}
<div class="list-group list-group-flush"> {{ accordion.header('Instructions', 'instructions', 'set-details', expanded=open_instructions, quantity=item.instructions | length, icon='file-line', class='p-0') }}
{% if item.instructions | length %} <div class="list-group list-group-flush">
{% for instruction in item.instructions %} {% if item.instructions | length %}
<a class="list-group-item list-group-item-action" href="{{ instruction.url() }}" target="_blank"><i class="ri-arrow-right-long-line"></i> <i class="ri-{{ instruction.icon() }}"></i> {{ instruction.filename }}</a> {% for instruction in item.instructions %}
{% endfor %} <a class="list-group-item list-group-item-action" href="{{ instruction.url() }}" target="_blank"><i class="ri-arrow-right-long-line"></i> <i class="ri-{{ instruction.icon() }}"></i> {{ instruction.filename }}</a>
{% else %} {% endfor %}
<span class="list-group-item list-group-item-action text-center"><i class="ri-error-warning-line"></i> No instructions file found.</span> {% else %}
{% if g.login.is_authenticated() %} <span class="list-group-item list-group-item-action text-center"><i class="ri-error-warning-line"></i> No instructions file found.</span>
<a class="list-group-item list-group-item-action" href="{{ url_for('instructions.upload') }}"><i class="ri-upload-line"></i> Upload an instructions file</a> {% if g.login.is_authenticated() %}
<a class="list-group-item list-group-item-action" href="{{ url_for('instructions.upload') }}"><i class="ri-upload-line"></i> Upload an instructions file</a>
{% endif %}
{% endif %} {% endif %}
{% endif %} {% if g.login.is_authenticated() %}
{% if g.login.is_authenticated() %} <a class="list-group-item list-group-item-action" href="{{ url_for('instructions.download', set=item.fields.set) }}"><i class="ri-download-line"></i> Download instructions from Rebrickable</a>
<a class="list-group-item list-group-item-action" href="{{ url_for('instructions.download', set=item.fields.set) }}"><i class="ri-download-line"></i> Download instructions from Rebrickable</a> {% endif %}
{% endif %} </div>
</div> {{ accordion.footer() }}
{{ accordion.footer() }} {% endif %}
{{ accordion.table(item.parts(), 'Parts', 'parts-inventory', 'set-details', 'part/table.html', icon='shapes-line')}} {{ accordion.table(item.parts(), 'Parts', 'parts-inventory', 'set-details', 'part/table.html', icon='shapes-line')}}
{% for minifigure in item.minifigures() %} {% for minifigure in item.minifigures() %}
{{ accordion.table(minifigure.parts(), minifigure.fields.name, minifigure.fields.figure, 'set-details', 'part/table.html', quantity=minifigure.fields.quantity, icon='group-line', image=minifigure.url_for_image(), alt=minifigure.fields.figure, details=minifigure.url())}} {{ accordion.table(minifigure.parts(), minifigure.fields.name, minifigure.fields.figure, 'set-details', 'part/table.html', quantity=minifigure.fields.quantity, icon='group-line', image=minifigure.url_for_image(), alt=minifigure.fields.figure, details=minifigure.url())}}