Implement suggestion from Issue #103: Show SVN revision in the footer

for logged-in users.
Thanks to Andreas Kotowicz for the suggestion.
This commit is contained in:
Ross Poulton 2009-08-25 22:40:42 +00:00
parent c866af467a
commit 1e7125fb8d
2 changed files with 17 additions and 1 deletions

View File

@ -28,7 +28,7 @@
{% block helpdesk_body %}{% endblock %} {% block helpdesk_body %}{% endblock %}
</div> </div>
<div id='footer'> <div id='footer'>
<p>{% trans "Powered by <a href='http://www.jutdahelpdesk.com/'>Jutda Helpdesk</a>." %} <a href='{% url helpdesk_rss_index %}'><img src='{{ MEDIA_URL }}helpdesk/rss_icon.png' width='14' height='14' alt='{% trans "RSS Icon" %}' title='{% trans "RSS Feeds" %}' border='0' />{% trans "RSS Feeds" %}</a> <a href='{% url helpdesk_api_help %}'>{% trans "API" %}</a> <a href='{% url helpdesk_user_settings %}'>{% trans "User Settings" %}</a> {% if user.is_superuser %}<a href='{% url helpdesk_system_settings %}'>{% trans "System Settings" %}</a>{% endif %}</p> <p>{% trans "Powered by <a href='http://www.jutdahelpdesk.com/'>Jutda Helpdesk</a>." %} {% if user.is_staff %}{% load svn_revision %}{% helpdesk_svn_revision %}{% endif %} <a href='{% url helpdesk_rss_index %}'><img src='{{ MEDIA_URL }}helpdesk/rss_icon.png' width='14' height='14' alt='{% trans "RSS Icon" %}' title='{% trans "RSS Feeds" %}' border='0' />{% trans "RSS Feeds" %}</a> <a href='{% url helpdesk_api_help %}'>{% trans "API" %}</a> <a href='{% url helpdesk_user_settings %}'>{% trans "User Settings" %}</a> {% if user.is_superuser %}<a href='{% url helpdesk_system_settings %}'>{% trans "System Settings" %}</a>{% endif %}</p>
</div> </div>
</div> </div>
{% include "helpdesk/debug.html" %} {% include "helpdesk/debug.html" %}

View File

@ -0,0 +1,16 @@
from django import template
from django.utils.version import get_svn_revision
import helpdesk
def svn_revision(parser, token):
path = helpdesk.__path__[0]
return SVNRevisionNode(path)
class SVNRevisionNode(template.Node):
def __init__(self, path):
self.path = path
def render(self, context):
return get_svn_revision(self.path)
register = template.Library()
register.tag('helpdesk_svn_revision', svn_revision)