diff --git a/InvenTree/part/templates/part/category.html b/InvenTree/part/templates/part/category.html index cf7348be76..224d855aa3 100644 --- a/InvenTree/part/templates/part/category.html +++ b/InvenTree/part/templates/part/category.html @@ -3,7 +3,7 @@ {% load i18n %} {% block menubar %} -{% include 'part/category_navbar.html' with tab='parts' %} +{% include 'part/category_navbar.html' %} {% endblock %} {% block content %} @@ -115,63 +115,81 @@ -{% block category_content %} +{% block page_content %} -
-
- - {% if roles.part.add %} - - {% endif %} +
+
+

{% trans "Parts" %}

+
+
- - -
- - - -
- + + {% if roles.part.add %} + + {% endif %} +
+ + +
+ + + +
+ +
+
+ +
+
-
+
-

- {% block heading %} - {% trans "Parts" %} - {% endblock %} -

+

{% trans "Part Parameters" %}

-
- {% block details %} - -
- {% endblock %} +
+ +
+
+
+ +
+
+

{% trans "Subcategories" %}

+
+
+
+
+ +
+ +
+
+
+ +
+
{% endblock %} - -{% block category_tables %} -{% endblock category_tables %} - {% endblock %} {% block js_load %} {{ block.super }} @@ -180,6 +198,26 @@ {% block js_ready %} {{ block.super }} + loadPartCategoryTable($('#subcategory-table'), { + params: { + {% if category %} + parent: {{ category.pk }} + {% else %} + parent: 'null' + {% endif %} + } + }); + + {% if category %} + loadParametricPartTable( + "#parametric-part-table", + { + headers: {{ headers|safe }}, + data: {{ parameters|safe }}, + } + ); + {% endif %} + enableNavbar({ label: 'category', toggleId: '#category-menu-toggle', @@ -328,4 +366,9 @@ $('#view-list').hide(); } + attachNavCallbacks({ + name: 'partcategory', + default: 'part-stock' + }); + {% endblock %} \ No newline at end of file diff --git a/InvenTree/part/templates/part/category_navbar.html b/InvenTree/part/templates/part/category_navbar.html index bd61300531..8e5e085f93 100644 --- a/InvenTree/part/templates/part/category_navbar.html +++ b/InvenTree/part/templates/part/category_navbar.html @@ -11,31 +11,23 @@ -
  • - {% if category %} - - {% else %} - - {% endif %} +
  • + {% trans "Subcategories" %}
  • -
  • - {% if category %} - - {% else %} - - {% endif %} +
  • + {% trans "Parts" %}
  • {% if show_import and user.is_staff and roles.part.add %} -
  • - +
  • + {% trans "Import Parts" %} @@ -43,8 +35,8 @@ {% endif %} {% if category %} -
  • - +
  • + {% trans "Parameters" %} diff --git a/InvenTree/part/templates/part/category_parametric.html b/InvenTree/part/templates/part/category_parametric.html deleted file mode 100644 index 881a292986..0000000000 --- a/InvenTree/part/templates/part/category_parametric.html +++ /dev/null @@ -1,37 +0,0 @@ -{% extends "part/category.html" %} -{% load static %} -{% load i18n %} - -{% block menubar %} -{% include 'part/category_navbar.html' with tab='parameters' %} -{% endblock %} - -{% block heading %} -{% trans "Part Parameters" %} -{% endblock %} - -{% block details %} - - -
    - -{% endblock %} - -{% block js_ready %} -{{ block.super }} - - /* Hide Button Toolbar */ - window.onload = function hideButtonToolbar() { - var toolbar = document.getElementById("button-toolbar"); - toolbar.style.display = "none"; - }; - - loadParametricPartTable( - "#parametric-part-table", - { - headers: {{ headers|safe }}, - data: {{ parameters|safe }}, - } - ); - -{% endblock %} \ No newline at end of file diff --git a/InvenTree/part/templates/part/category_partlist.html b/InvenTree/part/templates/part/category_partlist.html deleted file mode 100644 index e78254c541..0000000000 --- a/InvenTree/part/templates/part/category_partlist.html +++ /dev/null @@ -1,16 +0,0 @@ -{% extends "part/category.html" %} -{% load static %} -{% load i18n %} - -{% block menubar %} -{% include 'part/category_navbar.html' with tab='parts' %} -{% endblock %} - -{% block heading %} -{% trans "Parts" %} -{% endblock %} - -{% block details %} - -
    -{% endblock %} diff --git a/InvenTree/part/templates/part/detail.html b/InvenTree/part/templates/part/detail.html index b44bd25acc..2cb430ccf8 100644 --- a/InvenTree/part/templates/part/detail.html +++ b/InvenTree/part/templates/part/detail.html @@ -3,7 +3,6 @@ {% load i18n %} {% load markdownify %} - {% block menubar %} {% include 'part/navbar.html' %} {% endblock %} @@ -116,6 +115,10 @@
  • +
    + +
    +

    {% trans "Part Variants" %}

    @@ -788,11 +791,6 @@ ) }); - attachNavCallbacks({ - name: 'part', - default: 'part-stock' - }); - $('#supplier-create').click(function () { launchModalForm( "{% url 'supplier-part-create' %}", @@ -895,4 +893,9 @@ }); }); + attachNavCallbacks({ + name: 'part', + default: 'part-stock' + }); + {% endblock %} diff --git a/InvenTree/part/templates/part/subcategory.html b/InvenTree/part/templates/part/subcategory.html deleted file mode 100644 index e9e0d27468..0000000000 --- a/InvenTree/part/templates/part/subcategory.html +++ /dev/null @@ -1,51 +0,0 @@ -{% extends "part/category.html" %} - -{% load i18n %} -{% load inventree_extras %} -{% load static %} - -{% block menubar %} -{% include 'part/category_navbar.html' with tab='subcategories' %} -{% endblock %} - -{% block category_content %} - -
    - -
    -

    {% trans "Subcategories" %}

    -
    - -
    -
    - -
    - -
    -
    -
    - -
    - -
    -{% endblock %} - -{% block js_ready %} -{{ block.super }} - - enableNavbar({ - label: 'category', - toggleId: '#category-menu-toggle', - }); - - loadPartCategoryTable($('#subcategory-table'), { - params: { - {% if category %} - parent: {{ category.pk }} - {% else %} - parent: 'null' - {% endif %} - } - }); - -{% endblock %} diff --git a/InvenTree/part/urls.py b/InvenTree/part/urls.py index 0640807e51..e59ea88a05 100644 --- a/InvenTree/part/urls.py +++ b/InvenTree/part/urls.py @@ -78,9 +78,6 @@ category_urls = [ url(r'^delete/', views.CategoryDelete.as_view(), name='category-delete'), url(r'^parameters/', include(category_parameter_urls)), - url(r'^subcategory/', views.CategoryDetail.as_view(template_name='part/subcategory.html'), name='category-subcategory'), - url(r'^parametric/', views.CategoryParametric.as_view(), name='category-parametric'), - # Anything else url(r'^.*$', views.CategoryDetail.as_view(), name='category-detail'), ])) diff --git a/InvenTree/part/views.py b/InvenTree/part/views.py index bf8c32ba78..cbaa7f3d72 100644 --- a/InvenTree/part/views.py +++ b/InvenTree/part/views.py @@ -1818,7 +1818,7 @@ class CategoryDetail(InvenTreeRoleMixin, DetailView): model = PartCategory context_object_name = 'category' queryset = PartCategory.objects.all().prefetch_related('children') - template_name = 'part/category_partlist.html' + template_name = 'part/category.html' def get_context_data(self, **kwargs): @@ -1829,18 +1829,6 @@ class CategoryDetail(InvenTreeRoleMixin, DetailView): except KeyError: context['part_count'] = 0 - return context - - -class CategoryParametric(CategoryDetail): - """ Parametric view for PartCategory """ - - template_name = 'part/category_parametric.html' - - def get_context_data(self, **kwargs): - - context = super(CategoryParametric, self).get_context_data(**kwargs).copy() - # Get current category category = kwargs.get('object', None)