Use djangos url reverse mechanism instead of hardcoding urls

Signed-off-by: Michael Pimmer <info@fonfon.at>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
Michael Pimmer 2018-06-12 15:13:07 +00:00 committed by Sunil Mohan Adapa
parent 19e3136be0
commit b6987b8f3d
No known key found for this signature in database
GPG Key ID: 43EA1CFF0AA7C5F2
6 changed files with 22 additions and 15 deletions

View File

@ -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 <a href="/_cockpit/">'
'/_cockpit/</a> path on the web server. It can be accessed by '
'<a href="/plinth/sys/users">any user</a> with a {box_name} login. '
'<a href="{users_url}">any user</a> 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.'),
]

View File

@ -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 <a href="/plinth/apps/'
'jsxc">web client</a> or any other <a href=\'https://xmpp.org/'
_('To actually communicate, you can use the <a href="{jsxc_url}">'
'web client</a> or any other <a href=\'https://xmpp.org/'
'software/clients\' target=\'_blank\'>XMPP client</a>. '
'When enabled, ejabberd can be accessed by any <a href="/plinth/sys'
'/users">user with a {box_name} login</a>.'), box_name=_(
cfg.box_name))
'When enabled, ejabberd can be accessed by any <a href="{users_url}">'
'user with a {box_name} login</a>.'),
box_name=_(cfg.box_name), users_url=reverse_lazy('users:index'),
jsxc_url=reverse_lazy('jsxc:index')
)
]
clients = clients

View File

@ -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 <b>admin</b> group can <i>create</i> '
'and <i>manage</i> blogs and wikis, but any user in the <b>wiki</b> '
'group can <i>edit</i> existing ones. In the <a href="/plinth/sys/'
'users">User Configuration</a> you can change these '
'permissions or add new users.'), box_name=_(cfg.box_name))
'group can <i>edit</i> existing ones. In the <a href="{users_url}">'
'User Configuration</a> you can change these '
'permissions or add new users.'), box_name=_(cfg.box_name),
users_url = reverse_lazy('users:index'))
]
clients = clients

View File

@ -15,6 +15,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
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')
}]
}])

View File

@ -66,7 +66,7 @@
</tr>
</table>
<form class="form" method="post" action="/plinth/apps/tahoe-lafs/add_introducer">
<form class="form" method="post" action="{% url 'tahoe:add-introducer' %}">
{% csrf_token %}
<h4>{% trans "Add new introducer" %}</h4>
@ -97,7 +97,7 @@
<td> {{ introducer }} </td>
<td> {{ furl }} </td>
<form class="form" method="post"
action="/plinth/apps/tahoe-lafs/remove_introducer/{{introducer}}" id="introducer_list">
action="{% url 'tahoe:remove-introducer' introducer %}" id="introducer_list">
{% csrf_token %}
<td><button type="submit" class="btn btn-danger">
{% trans "Remove" %}

View File

@ -18,6 +18,7 @@
FreedomBox app to configure Tiny Tiny RSS.
"""
from django.urls import reverse_lazy
from django.utils.translation import ugettext_lazy as _
from plinth import service as service_module
@ -47,8 +48,8 @@ description = [
format_lazy(
_('When enabled, Tiny Tiny RSS will be available from <a href="/tt-'
'rss">/tt-rss</a> path on the web server. It can be accessed by '
'any <a href="/plinth/sys/users">user with a {box_name} login</a>.'),
box_name=_(cfg.box_name)),
'any <a href="{users_url}">user with a {box_name} login</a>.'),
box_name=_(cfg.box_name), users_url=reverse_lazy('users:index')),
format_lazy(
_('When using a mobile or desktop application for Tiny Tiny RSS, use '
'the URL <a href="/tt-rss-app/">/tt-rss-app</a> for connecting.'))