From ecad252653e0cff3cfee22fdb5e15cc81d86f95a Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Fri, 12 Feb 2016 18:22:21 +0530 Subject: [PATCH] system: Use new setup mechanism --- plinth/modules/system/__init__.py | 27 ++++++++++++++++--- plinth/modules/system/templates/system.html | 24 +---------------- plinth/modules/system/urls.py | 2 +- plinth/modules/system/{system.py => views.py} | 12 +++------ 4 files changed, 29 insertions(+), 36 deletions(-) rename plinth/modules/system/{system.py => views.py} (73%) diff --git a/plinth/modules/system/__init__.py b/plinth/modules/system/__init__.py index ec0f9e62d..7b75d3976 100644 --- a/plinth/modules/system/__init__.py +++ b/plinth/modules/system/__init__.py @@ -19,8 +19,29 @@ Plinth module for system section page """ -from . import system -from .system import init +from django.utils.translation import ugettext_lazy as _ + +from plinth import cfg +from plinth.utils import format_lazy -__all__ = ['system', 'init'] +version = 1 + +is_essential = 1 + +title = _('System Configuration') + +description = [ + format_lazy( + _('Here you can administrate the underlying system of your ' + '{box_name}.'), box_name=_(cfg.box_name)), + + format_lazy( + _('The options affect the {box_name} at its most general level, ' + 'so be careful!'), box_name=_(cfg.box_name)) +] + + +def init(): + """Initialize the system module""" + cfg.main_menu.add_urlname(title, 'glyphicon-cog', 'system:index', 100) diff --git a/plinth/modules/system/templates/system.html b/plinth/modules/system/templates/system.html index e8c2a46f3..a60745d8f 100644 --- a/plinth/modules/system/templates/system.html +++ b/plinth/modules/system/templates/system.html @@ -1,4 +1,4 @@ -{% extends 'base.html' %} +{% extends 'app.html' %} {% comment %} # # This file is part of Plinth. @@ -17,25 +17,3 @@ # along with this program. If not, see . # {% endcomment %} - -{% load i18n %} - -{% block content %} - -

{% trans "System Configuration" %}

- -

- {% blocktrans trimmed %} - Here you can administrate the underlying system of your - {{ box_name }}. - {% endblocktrans %} -

- -

- {% blocktrans trimmed %} - The options affect the {{ box_name }} at its most general level, - so be careful! - {% endblocktrans %} -

- -{% endblock %} diff --git a/plinth/modules/system/urls.py b/plinth/modules/system/urls.py index aceecc21d..8e75a6af5 100644 --- a/plinth/modules/system/urls.py +++ b/plinth/modules/system/urls.py @@ -21,7 +21,7 @@ URLs for the System module from django.conf.urls import url -from . import system as views +from . import views urlpatterns = [ diff --git a/plinth/modules/system/system.py b/plinth/modules/system/views.py similarity index 73% rename from plinth/modules/system/system.py rename to plinth/modules/system/views.py index c7a68b7f9..bc4dd1953 100644 --- a/plinth/modules/system/system.py +++ b/plinth/modules/system/views.py @@ -16,18 +16,12 @@ # from django.template.response import TemplateResponse -from django.utils.translation import ugettext_lazy as _ -from plinth import cfg - - -def init(): - """Initialize the system module""" - cfg.main_menu.add_urlname(_('System'), 'glyphicon-cog', 'system:index', - 100) +from plinth.modules import system def index(request): """Serve the index page""" return TemplateResponse(request, 'system.html', - {'title': _('System Configuration')}) + {'title': system.title, + 'description': system.description})