mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Tweak javascript for category detail pages
This commit is contained in:
parent
bc597d7c21
commit
2e7253ebc4
@ -1,34 +1,36 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% load static %}
|
||||
{% block content %}
|
||||
|
||||
<h3>Part Builds</h3>
|
||||
|
||||
<table class='table table-striped'>
|
||||
<table class='table table-striped' id='build-list' data-sorting='true' data-filtering='true'>
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th>Build</th>
|
||||
<th>Part</th>
|
||||
<th>Quantity</th>
|
||||
<th>Status</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
{% if active|length > 0 %}
|
||||
<tr><td colspan="4"><b>Active Builds</b></td></tr>
|
||||
{% include "build/build_list.html" with builds=active %}
|
||||
{% endif %}
|
||||
|
||||
{% if complete|length > 0 %}
|
||||
<tr></tr>
|
||||
<tr><td colspan="4"><b>Completed Builds</b></td></tr>
|
||||
{% include "build/build_list.html" with builds=complete %}
|
||||
{% endif %}
|
||||
|
||||
{% if cancelled|length > 0 %}
|
||||
<tr></tr>
|
||||
<tr><td colspan="4"><b>Cancelled Builds</b></td></tr>
|
||||
{% include "build/build_list.html" with builds=cancelled.all %}
|
||||
{% endif %}
|
||||
{% include "build/build_list.html" with builds=builds %}
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block javascript %}
|
||||
|
||||
<script type='text/javascript' src="{% static 'script/footable.js' %}"></script>
|
||||
<script type='text/javascript' src="{% static 'script/modal_form.js' %}"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function () {
|
||||
$('#build-list').footable();
|
||||
});
|
||||
</script>
|
||||
|
||||
{% endblock %}
|
@ -25,10 +25,12 @@ class BuildIndex(ListView):
|
||||
|
||||
context = super(BuildIndex, self).get_context_data(**kwargs).copy()
|
||||
|
||||
"""
|
||||
context['active'] = self.get_queryset().filter(status__in=[Build.PENDING, Build.HOLDING])
|
||||
|
||||
context['complete'] = self.get_queryset().filter(status=Build.COMPLETE)
|
||||
context['cancelled'] = self.get_queryset().filter(status=Build.CANCELLED)
|
||||
"""
|
||||
|
||||
return context
|
||||
|
||||
|
@ -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>
|
||||
|
@ -54,6 +54,10 @@ function launchDeleteForm(modal, url, options = {}) {
|
||||
if (options.success) {
|
||||
options.success();
|
||||
}
|
||||
// Follow the URL returned by the JSON response
|
||||
else if (options.follow && response.url) {
|
||||
window.location.href = response.url;
|
||||
}
|
||||
else if (options.redirect) {
|
||||
window.location.href = options.redirect;
|
||||
}
|
||||
|
10
InvenTree/templates/InvenTree/index.html
Normal file
10
InvenTree/templates/InvenTree/index.html
Normal file
@ -0,0 +1,10 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
|
||||
{% block javascript %}
|
||||
|
||||
{% endblock %}
|
Loading…
Reference in New Issue
Block a user