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:
@ -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>
|
||||
|
Reference in New Issue
Block a user