Move the dynamic input into a macro
This commit is contained in:
parent
f32ea0b1b3
commit
cc87495aba
@ -15,3 +15,18 @@
|
||||
{{ text }}
|
||||
{% endif %}
|
||||
{% endmacro %}
|
||||
|
||||
{% macro input(id, html_id, url, value) %}
|
||||
<input class="form-control form-control-sm flex-shrink-1" type="text" value="{% if value %}{{ value }}{% endif %}"
|
||||
{% if g.login.is_authenticated() %}
|
||||
onchange="change_part_missing_amount(this, '{{ id }}', '{{ html_id }}', '{{ url }}')"
|
||||
{% else %}
|
||||
disabled
|
||||
{% endif %}
|
||||
autocomplete="off">
|
||||
{% if g.login.is_authenticated() %}
|
||||
<span id="status-part-{{ id }}-{{ html_id }}" class="input-group-text ri-save-line"></span>
|
||||
{% else %}
|
||||
<span class="input-group-text ri-prohibited-line"></span>
|
||||
{% endif %}
|
||||
{% endmacro %}
|
||||
|
@ -1,3 +1,4 @@
|
||||
{% import 'macro/form.html' as form %}
|
||||
{% import 'macro/table.html' as table %}
|
||||
|
||||
<div class="table-responsive-sm">
|
||||
@ -32,15 +33,7 @@
|
||||
{{ item.fields.total_missing }}
|
||||
{% else %}
|
||||
<div class="input-group">
|
||||
{% if g.login.is_authenticated() %}
|
||||
<input class="form-control form-control-sm flex-shrink-1" type="text" {% if item.fields.total_missing %}value="{{ item.fields.total_missing }}"{% endif %}
|
||||
onchange="change_part_missing_amount(this, '{{ item.fields.id }}', '{{ item.html_id() }}', '{{ item.url_for_missing() }}')" autocomplete="off">
|
||||
<span id="status-part-{{ item.fields.id }}-{{ item.html_id() }}" class="input-group-text ri-save-line"></span>
|
||||
{% else %}
|
||||
<input class="form-control form-control-sm" type="text" {% if item.fields.total_missing %}value="{{ item.fields.total_missing }}"{% endif %}
|
||||
disabled autocomplete="off">
|
||||
<span class="input-group-text ri-prohibited-line"></span>
|
||||
{% endif %}
|
||||
{{ form.input(item.fields.id, item.html_id(), item.url_for_missing(), item.fields.total_missing) }}
|
||||
</div>
|
||||
{% endif %}
|
||||
</td>
|
||||
|
Loading…
Reference in New Issue
Block a user