mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-03-11 09:04:54 +00:00
networks: modify as first boot wizard step
Signed-off-by: Nektarios Katakis <iam@nektarioskatakis.xyz> Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
parent
e771ca3b8e
commit
33f5114241
@ -25,7 +25,7 @@ from django.utils.translation import ugettext as _
|
||||
from django.views.decorators.http import require_POST
|
||||
|
||||
from plinth import network
|
||||
from plinth.modules import networks
|
||||
from plinth.modules import networks, first_boot
|
||||
|
||||
from .forms import (ConnectionTypeSelectForm, EthernetForm, GenericForm,
|
||||
PPPoEForm, WifiForm, RouterConfigurationWizardForm)
|
||||
@ -423,15 +423,34 @@ def router_configuration_help_page(request):
|
||||
Show the router configuration wizard page/form.
|
||||
Used both for fistboot step and same networks page.
|
||||
"""
|
||||
is_firstboot = True \
|
||||
if 'firstboot' in request.build_absolute_uri() else False
|
||||
|
||||
if request.method == "POST":
|
||||
resp = reverse_lazy('networks:index')
|
||||
if is_firstboot:
|
||||
resp = reverse_lazy(first_boot.next_step())
|
||||
else:
|
||||
resp = reverse_lazy('networks:index')
|
||||
messages.success(request, _('Router configuration type saved.'))
|
||||
|
||||
return redirect(resp)
|
||||
|
||||
else:
|
||||
template_kwargs = {
|
||||
'form': RouterConfigurationWizardForm,
|
||||
html = "router_configuration_update.html"
|
||||
initial = {
|
||||
"router_config": kvstore.get_default(
|
||||
networks.ROUTER_CONFIGURATION_TYPE_KEY, 'dmz'),
|
||||
}
|
||||
template_kwargs = {
|
||||
'form': RouterConfigurationWizardForm(initial=initial),
|
||||
}
|
||||
if is_firstboot:
|
||||
html = "router_configuration_firstboot.html"
|
||||
|
||||
return TemplateResponse(request, 'router_configuration.html',
|
||||
template_kwargs)
|
||||
# mark step done on firstboot visit to get the next_step
|
||||
first_boot.mark_step_done('router_setup_wizard')
|
||||
template_kwargs.update({
|
||||
'first_boot_next_step': reverse_lazy(first_boot.next_step()),
|
||||
})
|
||||
|
||||
return TemplateResponse(request, html, template_kwargs)
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
{% extends "base.html" %}
|
||||
{% comment %}
|
||||
#
|
||||
# This file is part of FreedomBox.
|
||||
@ -22,7 +21,6 @@
|
||||
{% load i18n %}
|
||||
{% load static %}
|
||||
|
||||
{% block content %}
|
||||
<h1>{% trans "Setup FreedomBox Behind a Router" %}</h1>
|
||||
<p>
|
||||
{% blocktrans trimmed %}
|
||||
@ -61,15 +59,3 @@
|
||||
how to perform this task.
|
||||
{% endblocktrans %}
|
||||
</p>
|
||||
|
||||
<form class="form" method="post">
|
||||
{% csrf_token %}
|
||||
|
||||
{{ form|bootstrap }}
|
||||
|
||||
<input type="submit" class="btn btn-primary"
|
||||
value="{% trans "Submit" %}"/>
|
||||
|
||||
</form>
|
||||
|
||||
{% endblock %}
|
||||
@ -0,0 +1,38 @@
|
||||
{% extends "base_firstboot.html" %}
|
||||
{% 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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
{% endcomment %}
|
||||
|
||||
{% load bootstrap %}
|
||||
{% load i18n %}
|
||||
{% load static %}
|
||||
|
||||
{% block content %}
|
||||
{% include "router_configuration_content.html" %}
|
||||
|
||||
<form class="form" method="post">
|
||||
{% csrf_token %}
|
||||
|
||||
{{ form|bootstrap }}
|
||||
|
||||
<a href='{{ first_boot_next_step }}'>{% trans "skip this step" %}</a>
|
||||
<input type="submit" class="btn btn-primary"
|
||||
value="{% trans "Next" %}" style="float: right;"/>
|
||||
</form>
|
||||
|
||||
{% endblock %}
|
||||
@ -0,0 +1,37 @@
|
||||
{% extends "base.html" %}
|
||||
{% 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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
{% endcomment %}
|
||||
|
||||
{% load bootstrap %}
|
||||
{% load i18n %}
|
||||
{% load static %}
|
||||
|
||||
{% block content %}
|
||||
{% include "router_configuration_content.html" %}
|
||||
|
||||
<form class="form" method="post">
|
||||
{% csrf_token %}
|
||||
|
||||
{{ form|bootstrap }}
|
||||
|
||||
<input type="submit" class="btn btn-primary"
|
||||
value="{% trans "Submit" %}"/>
|
||||
</form>
|
||||
|
||||
{% endblock %}
|
||||
Loading…
x
Reference in New Issue
Block a user