mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Merge remote-tracking branch 'inventree/master'
This commit is contained in:
commit
a7cec1627f
19
InvenTree/InvenTree/version.py
Normal file
19
InvenTree/InvenTree/version.py
Normal file
@ -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
|
@ -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
|
||||
|
||||
|
||||
|
@ -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
|
@ -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:
|
||||
|
32
InvenTree/part/templatetags/inventree_extras.py
Normal file
32
InvenTree/part/templatetags/inventree_extras.py
Normal file
@ -0,0 +1,32 @@
|
||||
""" 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):
|
||||
""" Multiply two numbers together """
|
||||
return x * y
|
||||
|
||||
|
||||
@register.simple_tag()
|
||||
def inventree_version(*args, **kwargs):
|
||||
""" Return InvenTree version string """
|
||||
return version.inventreeVersion()
|
||||
|
||||
|
||||
@register.simple_tag()
|
||||
def inventree_commit(*args, **kwargs):
|
||||
""" Return InvenTree git commit hash string """
|
||||
return version.inventreeCommitHash()
|
||||
|
||||
|
||||
@register.simple_tag()
|
||||
def inventree_github(*args, **kwargs):
|
||||
""" Return URL for InvenTree github site """
|
||||
return "https://github.com/InvenTree"
|
40
InvenTree/templates/about.html
Normal file
40
InvenTree/templates/about.html
Normal file
@ -0,0 +1,40 @@
|
||||
{% load static %}
|
||||
{% load inventree_extras %}
|
||||
|
||||
<div class='modal fade modal-fixed-footer' tabindex='-1' role='dialog' id='modal-about'>
|
||||
<div class='modal-dialog'>
|
||||
<div class='modal-content'>
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
<img src="{% static 'img/inventree.png' %}" height='60' style='float: left;' alt='Inventree Logo'>
|
||||
</div>
|
||||
<div class='modal-form-content'>
|
||||
<div>
|
||||
<!--
|
||||
-->
|
||||
<h4>InvenTree Version Information</h4>
|
||||
<table class='table table-striped table-condensed'>
|
||||
<tr>
|
||||
<td>Version</td><td>{% inventree_version %}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Commit Hash</td><td>{% inventree_commit %}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>View Code on GitHub</td><td><a href="{% inventree_github %}">{% inventree_github %}</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class='modal-footer'>
|
||||
<button type='button' class='btn btn-default' data-dismiss='modal'>Close</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
@ -49,6 +49,7 @@ InvenTree
|
||||
</div>
|
||||
|
||||
{% include 'modals.html' %}
|
||||
{% include 'about.html' %}
|
||||
{% include 'notification.html' %}
|
||||
</div>
|
||||
|
||||
@ -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');
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
|
@ -13,19 +13,21 @@
|
||||
</ul>
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
{% include "search_form.html" %}
|
||||
{% if user.is_authenticated %}
|
||||
<li class='dropdown'>
|
||||
<a class='dropdown-toggle' data-toggle='dropdown' href="#"><span class="glyphicon glyphicon-user"></span> <b>{{ user.get_username }}</b></a>
|
||||
<ul class='dropdown-menu'>
|
||||
{% if user.is_authenticated %}
|
||||
{% if user.is_staff %}
|
||||
<li><a href="/admin/"><span class="glyphicon glyphicon-edit"></span> Admin</a></li>
|
||||
{% endif %}
|
||||
<li><a href="{% url 'logout' %}"><span class="glyphicon glyphicon-log-out"></span> Logout</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
{% else %}
|
||||
<li><a href="{% url 'login' %}"><span class="glyphicon glyphicon-log-in"></span> Login</a></li>
|
||||
{% endif %}
|
||||
<hr>
|
||||
<li id='launch-about'><a href='#'>About InvenTree</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</nav>
|
Loading…
Reference in New Issue
Block a user