Documents removing
* adds generic modal rendering using package django-bootstrap-modal-forms * adds document file removing from hard drive * adds translations
This commit is contained in:
32
templates/modal/modal_form.html
Normal file
32
templates/modal/modal_form.html
Normal file
@@ -0,0 +1,32 @@
|
||||
{% load i18n %}
|
||||
{% comment %}
|
||||
A generic modal form template which is based on django-bootstrap-modal-forms package
|
||||
https://pypi.org/project/django-bootstrap-modal-forms/
|
||||
{% endcomment %}
|
||||
|
||||
|
||||
<form method="post" action="{{form.action_url}}">
|
||||
{% csrf_token %}
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">{{form.form_title}}</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="modal-body">
|
||||
<article class="mb-5">{{form.form_caption}}</article>
|
||||
{% for field in form %}
|
||||
<div class="form-group{% if field.errors %} invalid{% endif %}">
|
||||
<label for="{{ field.id_for_label }}">{{ field.label }}</label>
|
||||
{{ field }}
|
||||
{% for error in field.errors %}
|
||||
<p class="help-block">{{ error }}</p>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="submit" class="btn btn-default">{% trans 'Continue' %}</button>
|
||||
</div>
|
||||
</form>
|
||||
18
templates/modal/modal_form_script.html
Normal file
18
templates/modal/modal_form_script.html
Normal file
@@ -0,0 +1,18 @@
|
||||
{% comment %}
|
||||
Taken from https://github.com/trco/django-bootstrap-modal-forms
|
||||
|
||||
isDeleteForm refers to reloading the whole page after submitting the form in our case.
|
||||
|
||||
{% endcomment %}
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$(".{{btn_class}}").each(function () {
|
||||
$(this).modalForm({
|
||||
formURL: $(this).data("form-url"),
|
||||
isDeleteForm: {{modal_reload_page}},
|
||||
}
|
||||
);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
Reference in New Issue
Block a user