From 16dc5e2436778c20ffe1dda9dc427dbd6813f507 Mon Sep 17 00:00:00 2001 From: Oliver Walters <oliver.henry.walters@gmail.com> Date: Wed, 17 Apr 2019 19:03:03 +1000 Subject: [PATCH] Reorganize script locations - Delete script files that are no longer used --- .../bootstrap-table-en-US.min.js | 0 .../{ => bootstrap}/bootstrap-table.min.js | 0 .../{ => bootstrap}/bootstrap-treeview.js | 0 .../script/{ => bootstrap}/bootstrap.min.js | 0 InvenTree/static/script/filter_company.js | 63 ---------------- .../static/script/{ => inventree}/delay.js | 0 .../script/{ => inventree}/notification.js | 0 .../static/script/{ => inventree}/sidenav.js | 0 .../static/script/{ => inventree}/tables.js | 0 InvenTree/templates/base.html | 23 +++--- wip/ajax_request.js | 71 ------------------- 11 files changed, 12 insertions(+), 145 deletions(-) rename InvenTree/static/script/{ => bootstrap}/bootstrap-table-en-US.min.js (100%) rename InvenTree/static/script/{ => bootstrap}/bootstrap-table.min.js (100%) rename InvenTree/static/script/{ => bootstrap}/bootstrap-treeview.js (100%) rename InvenTree/static/script/{ => bootstrap}/bootstrap.min.js (100%) delete mode 100644 InvenTree/static/script/filter_company.js rename InvenTree/static/script/{ => inventree}/delay.js (100%) rename InvenTree/static/script/{ => inventree}/notification.js (100%) rename InvenTree/static/script/{ => inventree}/sidenav.js (100%) rename InvenTree/static/script/{ => inventree}/tables.js (100%) delete mode 100644 wip/ajax_request.js diff --git a/InvenTree/static/script/bootstrap-table-en-US.min.js b/InvenTree/static/script/bootstrap/bootstrap-table-en-US.min.js similarity index 100% rename from InvenTree/static/script/bootstrap-table-en-US.min.js rename to InvenTree/static/script/bootstrap/bootstrap-table-en-US.min.js diff --git a/InvenTree/static/script/bootstrap-table.min.js b/InvenTree/static/script/bootstrap/bootstrap-table.min.js similarity index 100% rename from InvenTree/static/script/bootstrap-table.min.js rename to InvenTree/static/script/bootstrap/bootstrap-table.min.js diff --git a/InvenTree/static/script/bootstrap-treeview.js b/InvenTree/static/script/bootstrap/bootstrap-treeview.js similarity index 100% rename from InvenTree/static/script/bootstrap-treeview.js rename to InvenTree/static/script/bootstrap/bootstrap-treeview.js diff --git a/InvenTree/static/script/bootstrap.min.js b/InvenTree/static/script/bootstrap/bootstrap.min.js similarity index 100% rename from InvenTree/static/script/bootstrap.min.js rename to InvenTree/static/script/bootstrap/bootstrap.min.js diff --git a/InvenTree/static/script/filter_company.js b/InvenTree/static/script/filter_company.js deleted file mode 100644 index feff8dcaca..0000000000 --- a/InvenTree/static/script/filter_company.js +++ /dev/null @@ -1,63 +0,0 @@ - -function add_company(company){ - - var text = "<li class='list-group-item'>"; - - text += "<b><a href='" + company.url + "'>"; - text += company.name + "</a></b>"; - - if (company.description){ - text += " - " + company.description; - } - - text += "</li>"; - - $("#company-list").append(text); -} - - -function filter(text){ - - $.ajax( - { - url: "/api/company/", - success: function(result) { - $("#company-list").empty(); - $.each(result.results, function(i, company){ - add_company(company); - }) - }, - data: { - 'search': text, - } - } - ); -} - -$(document).ready(function(){ - $("#company-filter").keyup(function(e) { - - if (e.keyCode == 27){ // Escape key - $("#company-filter").val(''); - cancelTimer(); - filter(''); - } - else { - - var value = $(this).val().toLowerCase(); - - delay(function() { - filter(value); - }, 500); - } - }); - - $("#clear-filter").click(function(){ - clearTimeout(keyDelay); - $("#company-filter").val(''); - filter(''); - }); - - // Initially load the list with all values - filter(''); -}); \ No newline at end of file diff --git a/InvenTree/static/script/delay.js b/InvenTree/static/script/inventree/delay.js similarity index 100% rename from InvenTree/static/script/delay.js rename to InvenTree/static/script/inventree/delay.js diff --git a/InvenTree/static/script/notification.js b/InvenTree/static/script/inventree/notification.js similarity index 100% rename from InvenTree/static/script/notification.js rename to InvenTree/static/script/inventree/notification.js diff --git a/InvenTree/static/script/sidenav.js b/InvenTree/static/script/inventree/sidenav.js similarity index 100% rename from InvenTree/static/script/sidenav.js rename to InvenTree/static/script/inventree/sidenav.js diff --git a/InvenTree/static/script/tables.js b/InvenTree/static/script/inventree/tables.js similarity index 100% rename from InvenTree/static/script/tables.js rename to InvenTree/static/script/inventree/tables.js diff --git a/InvenTree/templates/base.html b/InvenTree/templates/base.html index 2ec82aaf51..42c79532b2 100644 --- a/InvenTree/templates/base.html +++ b/InvenTree/templates/base.html @@ -54,19 +54,20 @@ InvenTree <!-- Scripts --> <script type="text/javascript" src="{% static 'script/jquery_3.3.1_jquery.min.js' %}"></script> -<script type="text/javascript" src="{% static 'script/bootstrap.min.js' %}"></script> -<script type="text/javascript" src="{% static 'script/select2/select2.js' %}"></script> -<script type='text/javascript' src="{% static 'script/bootstrap-treeview.js' %}"></script> - - -<script type='text/javascript' src="{% static 'script/bootstrap-table.min.js' %}"></script> -<script type='text/javascript' src="{% static 'script/bootstrap-table-en-US.min.js' %}"></script> -<script type='text/javascript' src="{% static 'script/moment.js' %}"></script> -<script type='text/javascript' src="{% static 'script/tables.js' %}"></script> -<script type='text/javascript' src="{% static 'script/sidenav.js' %}"></script> -<script type='text/javascript' src="{% static 'script/notification.js' %}"></script> <script type='text/javascript' src="{% static 'script/jquery.form.min.js' %}"></script> + +<script type="text/javascript" src="{% static 'script/bootstrap/bootstrap.min.js' %}"></script> +<script type='text/javascript' src="{% static 'script/bootstrap/bootstrap-treeview.js' %}"></script> +<script type='text/javascript' src="{% static 'script/bootstrap/bootstrap-table.min.js' %}"></script> +<script type='text/javascript' src="{% static 'script/bootstrap/bootstrap-table-en-US.min.js' %}"></script> + +<script type="text/javascript" src="{% static 'script/select2/select2.js' %}"></script> +<script type='text/javascript' src="{% static 'script/moment.js' %}"></script> + +<script type='text/javascript' src="{% static 'script/inventree/tables.js' %}"></script> +<script type='text/javascript' src="{% static 'script/inventree/notification.js' %}"></script> <script type='text/javascript' src="{% static 'script/inventree/modals.js' %}"></script> +<script type='text/javascript' src="{% static 'script/inventree/sidenav.js' %}"></script> {% block js_load %} {% endblock %} diff --git a/wip/ajax_request.js b/wip/ajax_request.js deleted file mode 100644 index 856af8ca47..0000000000 --- a/wip/ajax_request.js +++ /dev/null @@ -1,71 +0,0 @@ -{% load static %} - -<script type="text/javascript" src="{% static 'script/delay.js' %}"> -</script> - -<script type="text/javascript"> - -function add_part(part) { - var text = "<tr>"; - - text += "<td><a href='" + part.url + "'>" + part.name + "</a></td>"; - text += "<td>" + part.description + "</td>"; - - text += "<td>"; - - // TODO - Work out how to add in category name + link... - if (part.category){ - text += '<a href="/part/category/' + part.category + '/">'; - text += part.category_path; - text += '</a>'; - } - - text += "</td>"; - - text += "</tr>"; - - $("#part-list").append(text); -} - -function filter_parts(text) { - $.ajax({ - url: "{% url 'api-part-list' %}", - data: { - {% if category %} - 'category': {{ category.id }}, - {% endif %} - 'search': text - }, - success: function(result) { - $("#part-list").find("tr:gt(0)").remove(); - $.each(result.results, function(i, part) { - add_part(part); - }) - } - }); -} - - -$("#part-filter").keyup(function(e) { - if (e.keyCode == 27){ // Escape key - cancelTimer(); - $("#part-filter").val(''); - } - else { - var value = $(this).val().toLowerCase(); - - delay(function() { - filter_parts(value); - }, 500); - } -}); - -$("#clear-filter").click(function(){ - clearTimeout(keyDelay); - $("#company-filter").val(''); - filter_parts(''); -}); - -filter_parts(''); - -</script> \ No newline at end of file