diff --git a/plinth/modules/ikiwiki/__init__.py b/plinth/modules/ikiwiki/__init__.py index 8830af010..05f105743 100644 --- a/plinth/modules/ikiwiki/__init__.py +++ b/plinth/modules/ikiwiki/__init__.py @@ -21,26 +21,48 @@ Plinth module to configure ikiwiki from django.utils.translation import ugettext_lazy as _ +from plinth import actions from plinth import action_utils from plinth import cfg from plinth import service as service_module +version = 1 + depends = ['apps'] +title = _('Wiki and Blog (ikiwiki)') + +description = [ + _('When enabled, the blogs and wikis will be available ' + 'from /ikiwiki.') +] + service = None def init(): """Initialize the ikiwiki module.""" menu = cfg.main_menu.get('apps:index') - menu.add_urlname(_('Wiki and Blog (ikiwiki)'), 'glyphicon-edit', - 'ikiwiki:index', 1100) + menu.add_urlname(title, 'glyphicon-edit', 'ikiwiki:index', 1100) global service service = service_module.Service( - 'ikiwiki', _('ikiwiki wikis and blogs'), ['http', 'https'], - is_external=True, enabled=is_enabled()) + 'ikiwiki', title, ['http', 'https'], is_external=True, + enabled=is_enabled()) + + +def setup(helper, old_version=None): + """Install and configure the module.""" + helper.install(['ikiwiki', + 'gcc', + 'libc6-dev', + 'libtimedate-perl', + 'libcgi-formbuilder-perl', + 'libcgi-session-perl', + 'libxml-writer-perl']) + helper.call('post', actions.superuser_run, 'ikiwiki', ['setup']) + helper.call('post', service.notify_enabled, None, True) def is_enabled(): diff --git a/plinth/modules/ikiwiki/templates/ikiwiki.html b/plinth/modules/ikiwiki/templates/ikiwiki.html index 4cea868ad..e08738cf7 100644 --- a/plinth/modules/ikiwiki/templates/ikiwiki.html +++ b/plinth/modules/ikiwiki/templates/ikiwiki.html @@ -1,4 +1,4 @@ -{% extends "base.html" %} +{% extends "app.html" %} {% comment %} # # This file is part of Plinth. @@ -21,14 +21,7 @@ {% load bootstrap %} {% load i18n %} -{% block content %} - -

- {% blocktrans trimmed %} - When enabled, the blogs and wikis will be available - from /ikiwiki. - {% endblocktrans %} -

+{% block configuration %} {% include "diagnostics_button.html" with module="ikiwiki" %} diff --git a/plinth/modules/ikiwiki/views.py b/plinth/modules/ikiwiki/views.py index 37bfaf5c3..27c1a855a 100644 --- a/plinth/modules/ikiwiki/views.py +++ b/plinth/modules/ikiwiki/views.py @@ -27,8 +27,6 @@ from django.utils.translation import ugettext as _, ugettext_lazy from .forms import IkiwikiForm, IkiwikiCreateForm from plinth import actions -from plinth import action_utils -from plinth import package from plinth.modules import ikiwiki @@ -40,20 +38,6 @@ subsubmenu = [{'url': reverse_lazy('ikiwiki:index'), 'text': ugettext_lazy('Create')}] -def on_install(): - """Enable ikiwiki on install.""" - actions.superuser_run('ikiwiki', ['setup']) - ikiwiki.service.notify_enabled(None, True) - - -@package.required(['ikiwiki', - 'gcc', - 'libc6-dev', - 'libtimedate-perl', - 'libcgi-formbuilder-perl', - 'libcgi-session-perl', - 'libxml-writer-perl'], - on_install=on_install) def index(request): """Serve configuration page.""" status = get_status() @@ -70,7 +54,8 @@ def index(request): form = IkiwikiForm(initial=status, prefix='ikiwiki') return TemplateResponse(request, 'ikiwiki.html', - {'title': _('Wiki and Blog'), + {'title': ikiwiki.title, + 'description': ikiwiki.description, 'status': status, 'form': form, 'subsubmenu': subsubmenu})