power: Use new setup mechanism

This commit is contained in:
Sunil Mohan Adapa 2016-02-12 16:54:37 +05:30
parent 5e094934b0
commit a33f68f051
No known key found for this signature in database
GPG Key ID: 36C361440C9BC971
3 changed files with 17 additions and 11 deletions

View File

@ -23,11 +23,20 @@ from django.utils.translation import ugettext_lazy as _
from plinth import cfg from plinth import cfg
version = 1
is_essential = True
depends = ['system'] depends = ['system']
title = _('Power')
description = [
_('Restart or shut down the system.')
]
def init(): def init():
"""Initialize the power module.""" """Initialize the power module."""
menu = cfg.main_menu.get('system:index') menu = cfg.main_menu.get('system:index')
menu.add_urlname(_('Power'), 'glyphicon-off', menu.add_urlname(title, 'glyphicon-off', 'power:index', 1000)
'power:index', 1000)

View File

@ -1,4 +1,4 @@
{% extends "base.html" %} {% extends "app.html" %}
{% comment %} {% comment %}
# #
# This file is part of Plinth. # This file is part of Plinth.
@ -21,13 +21,7 @@
{% load bootstrap %} {% load bootstrap %}
{% load i18n %} {% load i18n %}
{% block content %} {% block configuration %}
<h2>{{ title }}</h2>
<p>
{% blocktrans trimmed %}Restart or shut down the system.{% endblocktrans %}
</p>
<p> <p>
<a class="btn btn-default btn-md" href="{% url 'power:restart' %}"> <a class="btn btn-default btn-md" href="{% url 'power:restart' %}">

View File

@ -26,11 +26,14 @@ from django.template.response import TemplateResponse
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext as _
from plinth import actions from plinth import actions
from plinth.modules import power
def index(request): def index(request):
"""Serve power controls page.""" """Serve power controls page."""
return TemplateResponse(request, 'power.html', {'title': _('Power')}) return TemplateResponse(request, 'power.html',
{'title': power.title,
'description': power.description})
def restart(request): def restart(request):