mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-21 09:35:49 +02:00
Show attachment preview on attachment page.
This commit is contained in:
parent
02b71eeab8
commit
d99365f906
1 changed files with 36 additions and 28 deletions
|
@ -11,10 +11,11 @@
|
|||
<tbody>
|
||||
{% for attachment in form.attachments %}
|
||||
<tr>
|
||||
<td>
|
||||
<td class="row">
|
||||
<div class="col-9">
|
||||
{{ form_widget(attachment) }}
|
||||
</td>
|
||||
<td>
|
||||
</div>
|
||||
<div class="pl-0 col-3">
|
||||
{{ delete_btn }}
|
||||
|
||||
{% set attach = attachment.vars.value %}
|
||||
|
@ -39,6 +40,13 @@
|
|||
</span>
|
||||
</h6>
|
||||
{% endif %}
|
||||
{% if attach.picture %}
|
||||
<a href="{{ attach | entityURL('file_view') }}" target="_blank" data-no-ajax>
|
||||
<img class="img-fluid img-thumbnail" src="{{ attach | entityURL('file_view') }}" alt="{% trans %}attachment.preview.alt{% endtrans %}" />
|
||||
</a>
|
||||
{% else %}
|
||||
<a href="{{ attach | entityURL('file_view') }}" target="_blank" data-no-ajax class="link-external">{% trans %}attachment.view{% endtrans %}</a>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<br><br>
|
||||
<h6>
|
||||
|
@ -47,7 +55,7 @@
|
|||
</span>
|
||||
</h6>
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
@ -77,12 +85,12 @@
|
|||
|
||||
//Increase the index
|
||||
newForm = newForm.replace(/__name__/g, index);
|
||||
newForm = '<td>' + newForm + '</td>';
|
||||
$newFormRow = $('<tr></tr>').html(newForm);
|
||||
newForm = '<div class="col-9">' + newForm + '</div>';
|
||||
$newFormRow = $('<tr></tr>').html("<td class='row'>" + newForm + "</td>");
|
||||
|
||||
//Add delete button
|
||||
$btn = '<td>' + '{{ delete_btn|e('js') }}' + '</td>';
|
||||
$newFormRow.append($btn);
|
||||
$btn = '<div class="col-3">' + '{{ delete_btn|e('js') }}' + '</div>';
|
||||
$('td' ,$newFormRow).append($btn);
|
||||
|
||||
$holder.append($newFormRow);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue