From 9004086632162a4975a9193a1c2ac932a603c755 Mon Sep 17 00:00:00 2001 From: Oliver Date: Wed, 25 Apr 2018 00:09:25 +1000 Subject: [PATCH] Add button to launch modal form --- InvenTree/part/forms.py | 2 +- InvenTree/part/templates/part/index.html | 34 +++++++++++++++++++ .../templates/part/partial_category_new.html | 1 + InvenTree/part/views.py | 2 +- InvenTree/templates/base.html | 13 ++++--- InvenTree/templates/modal_form.html | 18 ++++++++++ 6 files changed, 63 insertions(+), 7 deletions(-) create mode 100644 InvenTree/part/templates/part/partial_category_new.html create mode 100644 InvenTree/templates/modal_form.html diff --git a/InvenTree/part/forms.py b/InvenTree/part/forms.py index 109b1961b6..2a66103168 100644 --- a/InvenTree/part/forms.py +++ b/InvenTree/part/forms.py @@ -45,7 +45,7 @@ class EditCategoryForm(forms.ModelForm): self.helper.form_id = 'id-edit-part-form' self.helper.form_method = 'post' - self.helper.add_input(Submit('submit', 'Submit')) + #self.helper.add_input(Submit('submit', 'Submit')) class Meta: model = PartCategory diff --git a/InvenTree/part/templates/part/index.html b/InvenTree/part/templates/part/index.html index 94d939f27e..bc912f346b 100644 --- a/InvenTree/part/templates/part/index.html +++ b/InvenTree/part/templates/part/index.html @@ -5,6 +5,18 @@ {% include "part/cat_link.html" with category=category %} + + + + {% if children.all|length > 0 %}

Part Categories

{% include "part/category_subcategories.html" with children=children %} @@ -23,3 +35,25 @@ {% endblock %} +{% block javascript %} + + + +{% endblock %} diff --git a/InvenTree/part/templates/part/partial_category_new.html b/InvenTree/part/templates/part/partial_category_new.html new file mode 100644 index 0000000000..acec8357bd --- /dev/null +++ b/InvenTree/part/templates/part/partial_category_new.html @@ -0,0 +1 @@ +{% include 'modal_form.html' with title='Create new Part Catagory' %} \ No newline at end of file diff --git a/InvenTree/part/views.py b/InvenTree/part/views.py index 0b2b768a93..9b3ac4df09 100644 --- a/InvenTree/part/views.py +++ b/InvenTree/part/views.py @@ -132,7 +132,7 @@ class CategoryDelete(DeleteView): class CategoryCreate(CreateView): model = PartCategory - template_name = 'part/category_new.html' + template_name = 'part/partial_category_new.html' form_class = EditCategoryForm def get_context_data(self, **kwargs): diff --git a/InvenTree/templates/base.html b/InvenTree/templates/base.html index 512d545992..02ea1d788b 100644 --- a/InvenTree/templates/base.html +++ b/InvenTree/templates/base.html @@ -13,11 +13,6 @@ - - - - - {% block head %} {% endblock %} @@ -39,5 +34,13 @@ InvenTree {% endblock %} + + + + +{% block javascript %} + +{% endblock %} + \ No newline at end of file diff --git a/InvenTree/templates/modal_form.html b/InvenTree/templates/modal_form.html new file mode 100644 index 0000000000..bdc1529170 --- /dev/null +++ b/InvenTree/templates/modal_form.html @@ -0,0 +1,18 @@ +{% load static %} + +
+ {% csrf_token %} + + + +
\ No newline at end of file