diff --git a/InvenTree/InvenTree/version.py b/InvenTree/InvenTree/version.py new file mode 100644 index 0000000000..ad2d9094d0 --- /dev/null +++ b/InvenTree/InvenTree/version.py @@ -0,0 +1,19 @@ +""" Version information for InvenTree. +Provides information on the current InvenTree version +""" + +import subprocess + +INVENTREE_SW_VERSION = "0.0.1" + + +def inventreeVersion(): + """ Returns the InvenTree version string """ + return INVENTREE_SW_VERSION + + +def inventreeCommitHash(): + """ Returns the git commit hash for the running codebase """ + commit = str(subprocess.check_output('git rev-parse --short HEAD'.split()), 'utf-8').strip() + + return commit diff --git a/InvenTree/InvenTree/views.py b/InvenTree/InvenTree/views.py index 711a4f685c..e727063f0f 100644 --- a/InvenTree/InvenTree/views.py +++ b/InvenTree/InvenTree/views.py @@ -298,9 +298,6 @@ class IndexView(TemplateView): # Generate a list of buildable parts which have stock below their minimum values context['to_build'] = [part for part in Part.objects.filter(buildable=True) if part.need_to_restock()] - print("order:", len(context['to_order'])) - print("build:", len(context['to_build'])) - return context diff --git a/InvenTree/build/templatetags/inventree_extras.py b/InvenTree/build/templatetags/inventree_extras.py deleted file mode 100644 index cb8cd0d235..0000000000 --- a/InvenTree/build/templatetags/inventree_extras.py +++ /dev/null @@ -1,12 +0,0 @@ -""" This module provides template tags for extra functionality -over and above the built-in Django tags. -""" - -from django import template - -register = template.Library() - - -@register.simple_tag() -def multiply(x, y, *args, **kwargs): - return x * y diff --git a/InvenTree/build/views.py b/InvenTree/build/views.py index 3892f28843..cd2c87e814 100644 --- a/InvenTree/build/views.py +++ b/InvenTree/build/views.py @@ -143,7 +143,6 @@ class BuildComplete(AjaxUpdateView): location = StockLocation.objects.get(id=loc_id) valid = True except StockLocation.DoesNotExist: - print('id:', loc_id) form.errors['location'] = ['Invalid location selected'] if valid: diff --git a/InvenTree/build/templatetags/__init__.py b/InvenTree/part/templatetags/__init__.py similarity index 100% rename from InvenTree/build/templatetags/__init__.py rename to InvenTree/part/templatetags/__init__.py diff --git a/InvenTree/part/templatetags/inventree_extras.py b/InvenTree/part/templatetags/inventree_extras.py new file mode 100644 index 0000000000..499f976416 --- /dev/null +++ b/InvenTree/part/templatetags/inventree_extras.py @@ -0,0 +1,28 @@ +""" This module provides template tags for extra functionality +over and above the built-in Django tags. +""" + +from django import template +from InvenTree import version + +register = template.Library() + + +@register.simple_tag() +def multiply(x, y, *args, **kwargs): + return x * y + + +@register.simple_tag() +def inventree_version(*args, **kwargs): + return version.inventreeVersion() + + +@register.simple_tag() +def inventree_commit(*args, **kwargs): + return version.inventreeCommitHash() + + +@register.simple_tag() +def inventree_github(*args, **kwargs): + return "https://github.com/InvenTree" \ No newline at end of file diff --git a/InvenTree/templates/about.html b/InvenTree/templates/about.html new file mode 100644 index 0000000000..2516812d1c --- /dev/null +++ b/InvenTree/templates/about.html @@ -0,0 +1,40 @@ +{% load static %} +{% load inventree_extras %} + + \ No newline at end of file diff --git a/InvenTree/templates/base.html b/InvenTree/templates/base.html index 42c79532b2..8331476cfa 100644 --- a/InvenTree/templates/base.html +++ b/InvenTree/templates/base.html @@ -49,6 +49,7 @@ InvenTree {% include 'modals.html' %} +{% include 'about.html' %} {% include 'notification.html' %} @@ -76,6 +77,17 @@ $(document).ready(function () { {% block js_ready %} {% endblock %} showCachedAlerts(); + + $('#launch-about').click(function() { + var modal = $('#modal-about'); + + modal.modal({ + backdrop: 'static', + keyboard: 'false', + }); + + modal.modal('show'); + }); }); diff --git a/InvenTree/templates/navbar.html b/InvenTree/templates/navbar.html index 005e342bf3..9523ffd7a3 100644 --- a/InvenTree/templates/navbar.html +++ b/InvenTree/templates/navbar.html @@ -13,19 +13,21 @@ + \ No newline at end of file