From ad5b34ed35edcc41a13ca30f45768b0dd00cfd29 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Mon, 13 May 2019 15:34:58 -0700 Subject: [PATCH] Common template for showing port forwarding information Signed-off-by: Sunil Mohan Adapa --- plinth/modules/openvpn/templates/openvpn.html | 18 +-------- plinth/templates/port-forwarding-info.html | 38 +++++++++++++++++++ plinth/templates/service.html | 20 +--------- 3 files changed, 40 insertions(+), 36 deletions(-) create mode 100644 plinth/templates/port-forwarding-info.html diff --git a/plinth/modules/openvpn/templates/openvpn.html b/plinth/modules/openvpn/templates/openvpn.html index 69736f4e8..a5f02e122 100644 --- a/plinth/modules/openvpn/templates/openvpn.html +++ b/plinth/modules/openvpn/templates/openvpn.html @@ -118,23 +118,7 @@ {% include "diagnostics_button.html" with module="openvpn" enabled=status.enabled %} - {% if port_forwarding_info %} -

{% trans "Port Forwarding" %}

- -

- {% blocktrans trimmed %} - If your FreedomBox is behind a router, you will need to set up port - forwarding on your router. You should forward the following ports for - OpenVPN: - {% endblocktrans %} -

- - - {% endif %} + {% include "port-forwarding-info.html" with service_name=title %}

{% trans "Configuration" %}

diff --git a/plinth/templates/port-forwarding-info.html b/plinth/templates/port-forwarding-info.html new file mode 100644 index 000000000..130c9390f --- /dev/null +++ b/plinth/templates/port-forwarding-info.html @@ -0,0 +1,38 @@ +{% comment %} +# +# This file is part of FreedomBox. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +{% endcomment %} + +{% load i18n %} + +{% if port_forwarding_info %} +

{% trans "Port Forwarding" %}

+ +

+ {% blocktrans trimmed %} + If your FreedomBox is behind a router, you will need to set up port + forwarding on your router. You should forward the following ports for + {{ service_name }}: + {% endblocktrans %} +

+ +
    + {% for port in port_forwarding_info %} +
  • {{ port.0 }} {{ port.1 }}
  • + {% endfor %} +
+{% endif %} diff --git a/plinth/templates/service.html b/plinth/templates/service.html index bf5f4c145..72431dc3d 100644 --- a/plinth/templates/service.html +++ b/plinth/templates/service.html @@ -75,25 +75,7 @@ {% include "internal-zone.html" %} - {% if port_forwarding_info %} -

{% trans "Port Forwarding" %}

- -

- {% with service_name=service.name %} - {% blocktrans trimmed %} - If your FreedomBox is behind a router, you will need to set up port - forwarding on your router. You should forward the following ports for - {{ service_name }}: - {% endblocktrans %} - {% endwith %} -

- -
    - {% for port in port_forwarding_info %} -
  • {{ port.0 }} {{ port.1 }}
  • - {% endfor %} -
- {% endif %} + {% include "port-forwarding-info.html" with service_name=service.name %} {% block configuration %}

{% trans "Configuration" %}