2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-19 05:25:42 +00:00

Tweak javascript for category detail pages

This commit is contained in:
Oliver
2018-04-28 11:43:26 +10:00
parent bc597d7c21
commit 2e7253ebc4
5 changed files with 58 additions and 24 deletions

View File

@ -50,24 +50,40 @@ $(document).ready(function (){
);
});
{% if category.parent %}
var categoryRedirect = "{% url 'category-detail' category.parent.id %}";
{% else %}
var categoryRedirect = "{% url 'part-index' %}";
{% endif %}
$("#delete-category").click(function() {
launchDeleteForm("#modal-delete",
"{% url 'category-delete' category.id %}",
{redirect: "{% url 'part-index' %}"});
{
redirect: categoryRedirect
});
});
$("#create-cat").click(function() {
launchModalForm("#modal-form",
"{% url 'category-create' %}",
{data: {category: {{ category.id }}
}});
{
follow: true,
data: {
category: {{ category.id }}
}
});
});
$("#create-part").click( function() {
launchModalForm("#modal-form",
"{% url 'part-create' %}",
{data: {category: {{ category.id }}
}});
{
data: {
category: {{ category.id }}
},
reload: true
});
});
});
</script>