Add template for hover_image

This commit is contained in:
Oliver Walters 2019-06-01 21:13:51 +10:00
parent 3869bc27c9
commit 8214aef0db
7 changed files with 19 additions and 27 deletions

View File

@ -6,10 +6,7 @@
{% block collapse_panel_setup %}class='panel part-allocation' id='allocation-panel-{{ item.sub_part.id }}'{% endblock %}
{% block collapse_title %}
<div class='hover-icon media-left' style='float: left;'>
<img class='hover-img-thumb' src="{% if item.sub_part.image %}{{ item.sub_part.image.url }}{% endif %}">
<img class='hover-img-large' src="{% if item.sub_part.image %}{{ item.sub_part.image.url }}{% endif %}">
</div>
{% include "hover_image.html" with image=item.sub_part.image %}
<div>
{{ item.sub_part.full_name }}
<small><i>{{ item.sub_part.description }}</i></small>

View File

@ -21,10 +21,7 @@ Automatically allocate stock to this build?
{% for item in allocations %}
<tr>
<td>
<a class='hover-icon'>
<img class='hover-img-thumb' src='{% if item.stock_item.part.image %}{{ item.stock_item.part.image.url }}{% endif %}'>
<img class='hover-img-large' src='{% if item.stock_item.part.image %}{{ item.stock_item.part.image.url }}{% endif %}'>
</a>
{% include "hover_image.html" with image=item.stock_item.part.image %}
</td>
<td>
{{ item.stock_item.part.full_name }}<br>

View File

@ -30,7 +30,7 @@ InvenTree | Build - {{ build }}
</tr>
<tr>
<td>Part</td>
<td>{{ build.part.full_name }}</td>
<td><a href="{% url 'part-detail' build.part.id %}">{{ build.part.full_name }}</a></td>
</tr>
<tr>
<td>Quantity</td>

View File

@ -18,10 +18,7 @@ The following items will be removed from stock:
{% for item in taking %}
<tr>
<td>
<a class='hover-icon'>
<img class='hover-img-thumb' src='{{ item.stock_item.part.image.url }}'>
<img class='hover-img-large' src='{{ item.stock_item.part.image.url }}'>
</a>
{% include "hover_image.html" with image=item.stock_item.part.image %}
</td>
<td>
{{ item.stock_item.part.full_name }}<br>
@ -38,10 +35,7 @@ No parts have been allocated to this build.
<hr>
The following items will be created:
<div class='panel panel-default'>
<a class='hover-icon'>
<img class='hover-img-thumb' src='{{ build.part.image.url }}'>
<img class='hover-img-large' src='{{ build.part.image.url }}'>
</a>
{% include "hover_image.html" with image=build.part.image %}
{{ build.quantity }} x {{ build.part.full_name }}
</div>

View File

@ -19,10 +19,7 @@
{% for item in build.required_parts %}
<tr>
<td>
<a class='hover-icon'>
<img class='hover-img-thumb' src='{% if item.part.image %}{{ item.part.image.url }}{% endif %}'>
<img class='hover-img-large' src='{% if item.part.image %}{{ item.part.image.url }}{% endif %}'>
</a>
{% include "hover_image.html" with image=item.part.image %}
<a class='hover-icon'a href="{% url 'part-detail' item.part.id %}">{{ item.part.full_name }}</a>
</td>
<td>{{ item.part.total_stock }}</td>

View File

@ -33,12 +33,7 @@
{% for variant in part.variants.all %}
<tr>
<td>
<div class='hover-icon media-left' style='float: left;'>
<img class='hover-img-thumb' src="{% if variant.image %}{{ variant.image.url }}{% else %}{% static 'img/blank_image.png' %}{% endif %}">
{% if variant.image %}
<img class='hover-img-large' src="{{ variant.image.url }}">
{% endif %}
</div>
{% include "hover_image.html" with image=variant.image %}
<a href="{% url 'part-detail' variant.id %}">{{ variant.full_name }}</a>
</td>
<td>{{ variant.description }}</td>

View File

@ -0,0 +1,12 @@
{% load static %}
<div class='hover-icon media-left' style='float: left;'>
{% if image %}
<a class='hover-icon'>
{% endif %}
<img class='hover-img-thumb' {% if image %}src='{{ image.url }}'{% else %}src='{% static "img/blank_image.png" %}'{% endif %}>
{% if image %}
<img class='hover-img-large' src='{{ image.url }}'>
</a>
{% endif %}
</div>