Add buttons to select or upload part images

This commit is contained in:
Oliver Walters 2020-02-11 00:00:03 +11:00
parent d4fe83170f
commit e0e996a6c3
2 changed files with 27 additions and 19 deletions

View File

@ -25,18 +25,7 @@
<div class="row">
<div class="col-sm-6">
<div class="media">
<div class="media-left">
<div class='dropzone' id='part-thumb'>
<img class="part-thumb"
{% if part.image %}
src="{{ part.image.url }}"
{% else %}
src="{% static 'img/blank_image.png' %}"
{% endif %}/>
</div>
<a href='#' id='part-image-select'>Select Part Image</a>
</div>
{% include "part/part_thumb.html" %}
<div class="media-body">
<h4>
{{ part.full_name }}
@ -209,13 +198,12 @@
});
});
$("#part-thumb").click(function() {
launchModalForm(
"{% url 'part-image-upload' part.id %}",
{
reload: true
}
);
$("#part-image-upload").click(function() {
launchModalForm("{% url 'part-image-upload' part.id %}",
{
reload: true
}
);
});

View File

@ -0,0 +1,20 @@
{% load static %}
{% load i18n %}
<div class="media">
<div class="media-left">
<div class='dropzone' id='part-thumb'>
<img class="part-thumb"
{% if part.image %}
src="{{ part.image.url }}"
{% else %}
src="{% static 'img/blank_image.png' %}"
{% endif %}/>
</div>
<div class='btn-row'>
<div class='btn-group'>
<button type='button' class='btn btn-default btn-glyph' title="{% trans 'Select from existing images' %}" id='part-image-select'><span class='glyphicon glyphicon-edit'></span></button>
<button type='button' class='btn btn-default btn-glyph' title="{% trans 'Upload new image' %}" id='part-image-upload'><span class='glyphicon glyphicon-upload'></span></button>
</div>
</div>
</div>