mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-04-29 10:10:19 +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
|
from plinth import service as service_module
|
||||||
|
|
||||||
|
|
||||||
|
version = 1
|
||||||
|
|
||||||
depends = ['apps']
|
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
|
service = None
|
||||||
|
|
||||||
|
|
||||||
def init():
|
def init():
|
||||||
"""Initialize the module."""
|
"""Initialize the module."""
|
||||||
menu = cfg.main_menu.get('apps:index')
|
menu = cfg.main_menu.get('apps:index')
|
||||||
menu.add_urlname(_('Bookmarks (Shaarli)'), 'glyphicon-bookmark',
|
menu.add_urlname(title, 'glyphicon-bookmark', 'shaarli:index', 350)
|
||||||
'shaarli:index', 350)
|
|
||||||
|
|
||||||
global service
|
global service
|
||||||
service = service_module.Service(
|
service = service_module.Service(
|
||||||
'shaarli', _('Shaarli'), ['http', 'https'],
|
'shaarli', title, ['http', 'https'], is_external=True,
|
||||||
is_external=True, enabled=is_enabled())
|
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():
|
def is_enabled():
|
||||||
|
|||||||
@ -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,21 +21,7 @@
|
|||||||
{% load bootstrap %}
|
{% load bootstrap %}
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
|
|
||||||
{% block content %}
|
{% block configuration %}
|
||||||
|
|
||||||
<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>
|
|
||||||
|
|
||||||
<h3>{% trans "Configuration" %}</h3>
|
<h3>{% trans "Configuration" %}</h3>
|
||||||
|
|
||||||
|
|||||||
@ -25,14 +25,9 @@ from django.utils.translation import ugettext as _
|
|||||||
|
|
||||||
from .forms import ShaarliForm
|
from .forms import ShaarliForm
|
||||||
from plinth import actions
|
from plinth import actions
|
||||||
from plinth import package
|
|
||||||
from plinth.modules import shaarli
|
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):
|
def index(request):
|
||||||
"""Serve configuration page."""
|
"""Serve configuration page."""
|
||||||
status = get_status()
|
status = get_status()
|
||||||
@ -49,7 +44,8 @@ def index(request):
|
|||||||
form = ShaarliForm(initial=status, prefix='shaarli')
|
form = ShaarliForm(initial=status, prefix='shaarli')
|
||||||
|
|
||||||
return TemplateResponse(request, 'shaarli.html',
|
return TemplateResponse(request, 'shaarli.html',
|
||||||
{'title': _('Bookmarks (Shaarli)'),
|
{'title': shaarli.title,
|
||||||
|
'description': shaarli.description,
|
||||||
'status': status,
|
'status': status,
|
||||||
'form': form})
|
'form': form})
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user