Skip to content

Commit

Permalink
Move some javascript in base template and allow erasing email inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
j-bernard committed Jun 28, 2022
1 parent 5c041f9 commit 42a82fc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<label class="col-sm-{{ label_width|default:2 }} control-label" for="id_{{ field.name }}">{{ field.label }}</label>
<div class="col col-sm-{{ control_width|default:10 }}">
{{ field|add_class:"form-control" }}
{% if field.field.widget.input_type == 'text' %}
{% if field.field.widget.input_type == 'text' or field.field.widget.input_type == 'email' %}
<span onClick="cleanInput($(this))" class="search-clear glyphicon glyphicon-remove-circle"></span>
{% endif %}
{% if field.errors %}
Expand All @@ -17,8 +17,3 @@
{% endif %}
</div>
</div>
<script type="text/javascript">
function cleanInput (input) {
input.closest('.col').find('input').val('');
}
</script>
4 changes: 4 additions & 0 deletions src/lgr_web/templates/_base.html
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,10 @@ <h4 class="modal-title">{% trans "About" %}</h4>
}
return confirm(msg);
}

function cleanInput (input) {
input.closest('.col').find('input').val('');
}
</script>
{% block html_body_more %}{% endblock %}
</body>
Expand Down

0 comments on commit 42a82fc

Please sign in to comment.