Modal form now working on multiple pages

- Part index
- Part category detail page(s)
This commit is contained in:
Oliver 2018-04-25 15:34:12 +10:00
parent e3b2bd7129
commit 99743c6bd0
2 changed files with 26 additions and 4 deletions

View File

@ -22,9 +22,9 @@
{% endif %}
<div class='container-fluid'>
<a href="{% url 'category-create' %}?category={{ category.id }}">
<button class="btn btn-success">New Category</button>
</a>
<button type='button' class='btn btn-primary js-create-cat'>
New Category
</button>
<a href="{% url 'part-create' %}?category={{ category.id }}">
<button class="btn btn-success">New Part</button>
</a>
@ -39,4 +39,26 @@
</div>
<div class='modal fade' id='modal-cat'>
<div class='modal-dialog'>
<div class='modal-content'>
</div>
</div>
</div>
{% endblock %}
{% block javascript %}
<script type='text/javascript' src="{% static 'script/modal_form.js' %}"></script>
<script type='text/javascript'>
bindModalForm('#modal-cat',
'.js-create-cat',
"{% url 'category-create' %}",
{category: {{ category.id }} });
</script>
{% endblock %}

View File

@ -37,7 +37,7 @@
<script type="text/javascript">
$(document).ready(function () {
bindModalForm('#modal-cat', '.js-create-cat', "{% url 'category-create' %}", {category: 1});
bindModalForm('#modal-cat', '.js-create-cat', "{% url 'category-create' %}");
});
</script>