From b6987b8f3d07c34332a1dc9d6a15c5f4efc3bac1 Mon Sep 17 00:00:00 2001 From: Michael Pimmer Date: Tue, 12 Jun 2018 15:13:07 +0000 Subject: [PATCH] Use djangos url reverse mechanism instead of hardcoding urls Signed-off-by: Michael Pimmer Reviewed-by: Sunil Mohan Adapa --- plinth/modules/cockpit/__init__.py | 5 +++-- plinth/modules/ejabberd/__init__.py | 12 +++++++----- plinth/modules/ikiwiki/__init__.py | 8 +++++--- plinth/modules/jsxc/manifest.py | 3 ++- plinth/modules/tahoe/templates/tahoe-post-setup.html | 4 ++-- plinth/modules/ttrss/__init__.py | 5 +++-- 6 files changed, 22 insertions(+), 15 deletions(-) diff --git a/plinth/modules/cockpit/__init__.py b/plinth/modules/cockpit/__init__.py index 710290e41..6c3e1f206 100644 --- a/plinth/modules/cockpit/__init__.py +++ b/plinth/modules/cockpit/__init__.py @@ -18,6 +18,7 @@ FreedomBox app to configure Cockpit. """ +from django.urls import reverse_lazy from django.utils.translation import ugettext_lazy as _ from plinth.utils import format_lazy @@ -50,10 +51,10 @@ description = [ format_lazy( _('When enabled, Cockpit will be available from ' '/_cockpit/ path on the web server. It can be accessed by ' - 'any user with a {box_name} login. ' + 'any user with a {box_name} login. ' 'Sensitive information and system altering abilities are limited to ' 'users belonging to admin group.'), - box_name=_(cfg.box_name)), + box_name=_(cfg.box_name), users_url=reverse_lazy('users:index')), _('Currently only limited functionality is available.'), ] diff --git a/plinth/modules/ejabberd/__init__.py b/plinth/modules/ejabberd/__init__.py index 570f32c02..148533b5b 100644 --- a/plinth/modules/ejabberd/__init__.py +++ b/plinth/modules/ejabberd/__init__.py @@ -47,12 +47,14 @@ description = [ _('XMPP is an open and standardized communication protocol. Here ' 'you can run and configure your XMPP server, called ejabberd.'), format_lazy( - _('To actually communicate, you can use the web client or any other ' + 'web client or any other XMPP client. ' - 'When enabled, ejabberd can be accessed by any user with a {box_name} login.'), box_name=_( - cfg.box_name)) + 'When enabled, ejabberd can be accessed by any ' + 'user with a {box_name} login.'), + box_name=_(cfg.box_name), users_url=reverse_lazy('users:index'), + jsxc_url=reverse_lazy('jsxc:index') + ) ] clients = clients diff --git a/plinth/modules/ikiwiki/__init__.py b/plinth/modules/ikiwiki/__init__.py index c6dd6dec4..a416973c1 100644 --- a/plinth/modules/ikiwiki/__init__.py +++ b/plinth/modules/ikiwiki/__init__.py @@ -18,6 +18,7 @@ FreedomBox app to configure ikiwiki. """ +from django.urls import reverse_lazy from django.utils.translation import ugettext_lazy as _ from plinth import service as service_module @@ -50,9 +51,10 @@ description = [ format_lazy( _('Only {box_name} users in the admin group can create ' 'and manage blogs and wikis, but any user in the wiki ' - 'group can edit existing ones. In the User Configuration you can change these ' - 'permissions or add new users.'), box_name=_(cfg.box_name)) + 'group can edit existing ones. In the ' + 'User Configuration you can change these ' + 'permissions or add new users.'), box_name=_(cfg.box_name), + users_url = reverse_lazy('users:index')) ] clients = clients diff --git a/plinth/modules/jsxc/manifest.py b/plinth/modules/jsxc/manifest.py index 3cd988b3f..152edfed0 100644 --- a/plinth/modules/jsxc/manifest.py +++ b/plinth/modules/jsxc/manifest.py @@ -15,6 +15,7 @@ # along with this program. If not, see . # +from django.urls import reverse_lazy from django.utils.translation import ugettext_lazy as _ from plinth.clients import validate @@ -24,6 +25,6 @@ clients = validate([{ _('JSXC'), 'platforms': [{ 'type': 'web', - 'url': '/plinth/apps/jsxc/jsxc/' + 'url': reverse_lazy('jsxc:jsxc') }] }]) diff --git a/plinth/modules/tahoe/templates/tahoe-post-setup.html b/plinth/modules/tahoe/templates/tahoe-post-setup.html index 6cdfe676b..55f102f39 100644 --- a/plinth/modules/tahoe/templates/tahoe-post-setup.html +++ b/plinth/modules/tahoe/templates/tahoe-post-setup.html @@ -66,7 +66,7 @@ -
+ {% csrf_token %}

{% trans "Add new introducer" %}

@@ -97,7 +97,7 @@ {{ introducer }} {{ furl }} + action="{% url 'tahoe:remove-introducer' introducer %}" id="introducer_list"> {% csrf_token %}