help: Add indicator for new plinth version available

This commit is contained in:
pk13055 2017-01-08 03:23:03 +05:30 committed by James Valleroy
parent b9954f4c79
commit 7fdb09abfd
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808
2 changed files with 8 additions and 2 deletions

View File

@ -24,7 +24,7 @@ from django.http import Http404
from django.template.response import TemplateResponse from django.template.response import TemplateResponse
from django.utils.translation import ugettext as _, ugettext_lazy from django.utils.translation import ugettext as _, ugettext_lazy
from stronghold.decorators import public from stronghold.decorators import public
from apt.cache import Cache
from plinth import cfg, __version__ from plinth import cfg, __version__
@ -50,9 +50,12 @@ def index(request):
@public @public
def about(request): def about(request):
"""Serve the about page""" """Serve the about page"""
cache = Cache()
plinth = cache['plinth']
context = { context = {
'title': _('About {box_name}').format(box_name=_(cfg.box_name)), 'title': _('About {box_name}').format(box_name=_(cfg.box_name)),
'version': __version__ 'version': __version__,
'new_version': plinth.candidate.is_installed
} }
return TemplateResponse(request, 'help_about.html', context) return TemplateResponse(request, 'help_about.html', context)

View File

@ -75,6 +75,9 @@
<p style='margin-top:30px'> <p style='margin-top:30px'>
{% blocktrans trimmed %} {% blocktrans trimmed %}
You are running Plinth version {{ version }}. You are running Plinth version {{ version }}.
{% if new_version %}
There is a new version available.
{% end if %}
{% endblocktrans %} {% endblocktrans %}
</p> </p>