names: Use new setup mechanism

This commit is contained in:
Sunil Mohan Adapa 2016-02-12 16:05:28 +05:30
parent 41e730d7ac
commit 0568bf259c
No known key found for this signature in database
GPG Key ID: 36C361440C9BC971
3 changed files with 12 additions and 7 deletions

View File

@ -31,8 +31,14 @@ SERVICES = (
('ssh', _('SSH'), 22), ('ssh', _('SSH'), 22),
) )
version = 1
is_essential = True
depends = ['system'] depends = ['system']
title = _('Name Services')
domain_types = {} domain_types = {}
domains = {} domains = {}
@ -42,8 +48,7 @@ logger = logging.getLogger(__name__)
def init(): def init():
"""Initialize the names module.""" """Initialize the names module."""
menu = cfg.main_menu.get('system:index') menu = cfg.main_menu.get('system:index')
menu.add_urlname(_('Name Services'), 'glyphicon-tag', menu.add_urlname(title, 'glyphicon-tag', 'names:index', 19)
'names:index', 19)
domain_added.connect(on_domain_added) domain_added.connect(on_domain_added)
domain_removed.connect(on_domain_removed) domain_removed.connect(on_domain_removed)
@ -54,6 +59,7 @@ def on_domain_added(sender, domain_type, name='', description='',
"""Add domain to global list.""" """Add domain to global list."""
if not domain_type: if not domain_type:
return return
domain_types[domain_type] = description domain_types[domain_type] = description
if not name: if not name:

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,9 +21,7 @@
{% load bootstrap %} {% load bootstrap %}
{% load i18n %} {% load i18n %}
{% block content %} {% block configuration %}
<h2>{{ title }}</h2>
<div class="row"> <div class="row">
<div class="col-sm-5"> <div class="col-sm-5">

View File

@ -24,6 +24,7 @@ from django.utils.translation import ugettext as _
from . import SERVICES, get_domain_types, get_description from . import SERVICES, get_domain_types, get_description
from . import get_domain, get_services_status from . import get_domain, get_services_status
from plinth.modules import names
def index(request): def index(request):
@ -31,7 +32,7 @@ def index(request):
status = get_status() status = get_status()
return TemplateResponse(request, 'names.html', return TemplateResponse(request, 'names.html',
{'title': _('Name Services'), {'title': names.title,
'status': status}) 'status': status})