From 4066a2f8d62d35bd9f637e26df7cf6820a083249 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Fri, 12 Feb 2016 18:12:51 +0530 Subject: [PATCH] shaarli: Use new setup mechanism --- plinth/modules/shaarli/__init__.py | 26 ++++++++++++++++--- plinth/modules/shaarli/templates/shaarli.html | 18 ++----------- plinth/modules/shaarli/views.py | 8 ++---- 3 files changed, 26 insertions(+), 26 deletions(-) diff --git a/plinth/modules/shaarli/__init__.py b/plinth/modules/shaarli/__init__.py index ac2e07df1..2210da998 100644 --- a/plinth/modules/shaarli/__init__.py +++ b/plinth/modules/shaarli/__init__.py @@ -26,21 +26,39 @@ from plinth import cfg from plinth import service as service_module +version = 1 + depends = ['apps'] +title = _('Bookmarks (Shaarli)') + +description = [ + _('Shaarli allows you to save and share bookmarks.'), + + _('When enabled, Shaarli will be available from ' + '/shaarli path on the web server. Note that Shaarli only supports a ' + 'single user account, which you will need to setup on the initial ' + 'visit.'), +] + service = None def init(): """Initialize the module.""" menu = cfg.main_menu.get('apps:index') - menu.add_urlname(_('Bookmarks (Shaarli)'), 'glyphicon-bookmark', - 'shaarli:index', 350) + menu.add_urlname(title, 'glyphicon-bookmark', 'shaarli:index', 350) global service service = service_module.Service( - 'shaarli', _('Shaarli'), ['http', 'https'], - is_external=True, enabled=is_enabled()) + 'shaarli', title, ['http', 'https'], is_external=True, + enabled=is_enabled()) + + +def setup(helper, old_version=None): + """Install and configure the module.""" + helper.install(['shaarli']) + helper.call('post', service.notify_enabled, None, True) def is_enabled(): diff --git a/plinth/modules/shaarli/templates/shaarli.html b/plinth/modules/shaarli/templates/shaarli.html index 391c25466..9a6c55b0a 100644 --- a/plinth/modules/shaarli/templates/shaarli.html +++ b/plinth/modules/shaarli/templates/shaarli.html @@ -1,4 +1,4 @@ -{% extends "base.html" %} +{% extends "app.html" %} {% comment %} # # This file is part of Plinth. @@ -21,21 +21,7 @@ {% load bootstrap %} {% load i18n %} -{% block content %} - -

{% trans "Bookmarks (Shaarli)" %}

- -

{% trans "Shaarli allows you to save and share bookmarks." %}

- -

- {% blocktrans trimmed %} - - When enabled, Shaarli will be available from /shaarli - path on the web server. Note that Shaarli only supports a single - user account, which you will need to setup on the initial visit. - - {% endblocktrans %} -

+{% block configuration %}

{% trans "Configuration" %}

diff --git a/plinth/modules/shaarli/views.py b/plinth/modules/shaarli/views.py index 6182db539..de174faa7 100644 --- a/plinth/modules/shaarli/views.py +++ b/plinth/modules/shaarli/views.py @@ -25,14 +25,9 @@ from django.utils.translation import ugettext as _ from .forms import ShaarliForm from plinth import actions -from plinth import package from plinth.modules import shaarli -def on_install(): - """Notify that the service is now enabled.""" - shaarli.service.notify_enabled(None, True) -@package.required(['shaarli'], on_install=on_install) def index(request): """Serve configuration page.""" status = get_status() @@ -49,7 +44,8 @@ def index(request): form = ShaarliForm(initial=status, prefix='shaarli') return TemplateResponse(request, 'shaarli.html', - {'title': _('Bookmarks (Shaarli)'), + {'title': shaarli.title, + 'description': shaarli.description, 'status': status, 'form': form})