mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-02-04 08:13:38 +00:00
shaarli: Use new setup mechanism
This commit is contained in:
parent
bdfd20d661
commit
4066a2f8d6
@ -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 <a href="/shaarli">'
|
||||
'/shaarli</a> 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():
|
||||
|
||||
@ -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 %}
|
||||
|
||||
<h2>{% trans "Bookmarks (Shaarli)" %}</h2>
|
||||
|
||||
<p>{% trans "Shaarli allows you to save and share bookmarks." %}</p>
|
||||
|
||||
<p>
|
||||
{% blocktrans trimmed %}
|
||||
|
||||
When enabled, Shaarli will be available from <a href="/shaarli">/shaarli</a>
|
||||
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 %}
|
||||
</p>
|
||||
{% block configuration %}
|
||||
|
||||
<h3>{% trans "Configuration" %}</h3>
|
||||
|
||||
|
||||
@ -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})
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user