From bcd4c528515627c14e17e3631cf93b416235dbd5 Mon Sep 17 00:00:00 2001 From: Nektarios Katakis Date: Mon, 17 Feb 2020 10:39:46 +0000 Subject: [PATCH] networks: Add network view and url for internet connection help page Signed-off-by: Nektarios Katakis [sunil: Use SPDX license identifier] Signed-off-by: Sunil Mohan Adapa Reviewed-by: Sunil Mohan Adapa --- plinth/modules/networks/networks.py | 29 +++++++++++++++++-- .../internet_connectivity_content.html | 20 +++++++++++++ .../templates/internet_connectivity_type.html | 22 ++++++++++++++ plinth/modules/networks/urls.py | 3 ++ 4 files changed, 71 insertions(+), 3 deletions(-) create mode 100644 plinth/modules/networks/templates/internet_connectivity_content.html create mode 100644 plinth/modules/networks/templates/internet_connectivity_type.html diff --git a/plinth/modules/networks/networks.py b/plinth/modules/networks/networks.py index 685829ebb..4752a43cf 100644 --- a/plinth/modules/networks/networks.py +++ b/plinth/modules/networks/networks.py @@ -11,9 +11,15 @@ from django.views.decorators.http import require_POST from plinth import kvstore, network from plinth.modules import first_boot, networks - -from .forms import (ConnectionTypeSelectForm, EthernetForm, GenericForm, - PPPoEForm, RouterConfigurationWizardForm, WifiForm) +from .forms import ( + ConnectionTypeSelectForm, + EthernetForm, + GenericForm, + PPPoEForm, + WifiForm, + RouterConfigurationWizardForm, + InternetConnectionTypeForm, +) logger = logging.getLogger(__name__) @@ -444,3 +450,20 @@ def router_configuration_help_page(request): }) return TemplateResponse(request, html, template_kwargs) + + +def internet_connection_type_help_page(request): + """ + Show the internet connection type page. + Used for first boot step and networks page. + """ + # stub for now + if request.method == 'POST': + resp = reverse_lazy('networks:index') + else: + html = "internet_connectivity_type.html" + template_kwargs = {'form': InternetConnectionTypeForm} + + resp = TemplateResponse(request, html, template_kwargs) + + return resp diff --git a/plinth/modules/networks/templates/internet_connectivity_content.html b/plinth/modules/networks/templates/internet_connectivity_content.html new file mode 100644 index 000000000..985df9924 --- /dev/null +++ b/plinth/modules/networks/templates/internet_connectivity_content.html @@ -0,0 +1,20 @@ +{% comment %} +# SPDX-License-Identifier: AGPL-3.0-or-later +{% endcomment %} + +{% load bootstrap %} +{% load i18n %} +{% load static %} + +

+ {% blocktrans trimmed %} + What Type Of Internet Connection Do You Have? + {% endblocktrans %} +

+ +

+ {% blocktrans trimmed %} + Select an option that best describes the type of Internet connection. + This information is used only to guide you with further setup. + {% endblocktrans %} +

diff --git a/plinth/modules/networks/templates/internet_connectivity_type.html b/plinth/modules/networks/templates/internet_connectivity_type.html new file mode 100644 index 000000000..c8e1d23bf --- /dev/null +++ b/plinth/modules/networks/templates/internet_connectivity_type.html @@ -0,0 +1,22 @@ +{% extends "base.html" %} +{% comment %} +# SPDX-License-Identifier: AGPL-3.0-or-later +{% endcomment %} + +{% load bootstrap %} +{% load i18n %} +{% load static %} + +{% block content %} + {% include "internet_connectivity_content.html" %} + +
+ {% csrf_token %} + + {{ form|bootstrap }} + + +
+ +{% endblock %} diff --git a/plinth/modules/networks/urls.py b/plinth/modules/networks/urls.py index 4953a5e3c..abf054380 100644 --- a/plinth/modules/networks/urls.py +++ b/plinth/modules/networks/urls.py @@ -33,4 +33,7 @@ urlpatterns = [ url(r'^sys/networks/firstboot/$', public(views.router_configuration_help_page), name='firstboot_router_setup'), + url(r'^sys/networks/internet-connection-type/$', + views.internet_connection_type_help_page, + name='internet_connection_type_setup'), ]