networks: Minor changes to router/internet configuration forms

- Cosmetic styling fixes. Having doc string as suggested by Python doc string
guidelines.

- 'connected to the Internet' seems much more popular phrase than 'connected on
the Internet' judging by web search results.

- Stylize as 'Internet' for consistency although 'internet' is correct too.

- Add space at the end of main radio button option text as translators seems to
understand it incorrectly. See current Spanish translation.

- Recommend 'DMZ' for router configuration.

- Remove incorrect title casing port forwarding text.

- Internationalize some strings.

- Update the default value for router configuration to 'not_configured'.

- Update the default value for Internet connection type to None so that nothing
is selected by default. We could consider introducing a fourth option
'not_configured'.

- Update the ID of first boot wizard step for Internet connectivity.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
Sunil Mohan Adapa 2020-02-24 11:44:40 -05:00
parent 1ba55e793f
commit 3e8ce0c6bd
No known key found for this signature in database
GPG Key ID: 43EA1CFF0AA7C5F2
9 changed files with 61 additions and 63 deletions

View File

@ -20,7 +20,7 @@ managed_packages = ['network-manager', 'batctl']
first_boot_steps = [
{
'id': 'internet_connectivity_type',
'id': 'internet_connectivity_type_wizard',
'url': 'networks:firstboot_internet_connection_type',
'order': 3,
},

View File

@ -286,10 +286,12 @@ requires clients to have the password to connect.'),
class InternetConnectionTypeForm(forms.Form):
"""
"""Form for type of public/private IP address ISP provides.
Ask the user for what type of Internet connection they have. We store this
information and use it suggest various setup options during the setup
process and also later on when setting up apps.
"""
internet_connection_type = forms.ChoiceField(
label=_('Choose your internet connection type'),
@ -298,7 +300,7 @@ class InternetConnectionTypeForm(forms.Form):
format_lazy(
_('I have a public IP address that may change over time'
'<p class="help-block">This means that devices on the '
'internet can reach you when you are connected on the '
'Internet can reach you when you are connected to the '
'Internet. Every time you connect to the Internet with '
'your Internet Service Provider (ISP), you may get a '
'different IP address, especially after some offline time. '
@ -311,7 +313,7 @@ class InternetConnectionTypeForm(forms.Form):
_('I have a public IP address that does not change overtime '
'(recommended)'
'<p class="help-block">This means that devices on the '
'Internet can reach you when you are connected on the '
'Internet can reach you when you are connected to the '
'Internet. Every time you connect to the Internet with '
'your Internet Service Provider (ISP), you always get the '
'same IP address. This is the most trouble-free setup for '
@ -339,10 +341,11 @@ class InternetConnectionTypeForm(forms.Form):
class RouterConfigurationWizardForm(forms.Form):
"""
Form to suggest router configuration depending on wan
connectivity/specific setup. The choice will affect
future suggestions during the setup process and other apps.
"""Form to suggest how to configure a router.
Suggest depending on wan connectivity/specific setup. The choice will
affect future suggestions during the setup process and other apps.
"""
router_config = forms.ChoiceField(
label=_('Preferred router configuration'),
@ -350,20 +353,20 @@ class RouterConfigurationWizardForm(forms.Form):
(
'dmz',
format_lazy(
_('Use DMZ feature to forward all traffic'
_('Use DMZ feature to forward all traffic (recommended) '
'<p class="help-block">Most routers provide a '
'configuration setting called DMZ. This will allow the '
'router to forward all incoming traffic from the '
'internet to a single IP address such as the '
'{box_name}\'s address. First remember to configure a '
'static local IP address for your {box_name} in your '
'Internet to a single IP address such as the '
'{box_name}\'s IP address. First remember to configure '
'a static local IP address for your {box_name} in your '
'router\'s configuration.</p>'), box_name=cfg.box_name,
allow_markup=True),
),
('port_forwarding',
format_lazy(
_('Forward Specific Traffic as needed by each '
'application'
_('Forward specific traffic as needed by each '
'application '
'<p class="help-block">You may alternatively choose to '
'forward only specific traffic to your {box_name}. '
'This is ideal if you have other servers like '
@ -376,7 +379,7 @@ class RouterConfigurationWizardForm(forms.Form):
allow_markup=True)),
('not_configured',
format_lazy(
_('Router is currently unconfigured'
_('Router is currently unconfigured '
'<p class="help-block">Choose this if you have not '
'configured or are unable to configure the router '
'currently and wish to be reminded later. Some of '

View File

@ -11,15 +11,10 @@ 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,
WifiForm,
RouterConfigurationWizardForm,
InternetConnectionTypeForm,
)
from .forms import (ConnectionTypeSelectForm, EthernetForm, GenericForm,
InternetConnectionTypeForm, PPPoEForm,
RouterConfigurationWizardForm, WifiForm)
logger = logging.getLogger(__name__)
@ -28,6 +23,8 @@ def index(request):
"""Show connection list."""
connections = network.get_connection_list()
internet_connection_type = kvstore.get_default(
networks.INTERNET_CONNECTION_TYPE_KEY, None)
return TemplateResponse(
request, 'networks_configuration.html', {
'app_id': 'networks',
@ -36,8 +33,7 @@ def index(request):
'has_diagnostics': True,
'is_enabled': True,
'connections': connections,
'internet_connectivity_type': kvstore.get_default(
networks.INTERNET_CONNECTION_TYPE_KEY, "dynamic_public_ip")
'internet_connectivity_type': internet_connection_type
})
@ -410,9 +406,10 @@ def delete(request, uuid):
def router_configuration_help_page(request):
"""
Show the router configuration wizard page/form.
"""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
@ -431,19 +428,18 @@ def router_configuration_help_page(request):
messages.success(request, _('Router configuration type saved.'))
return redirect(resp)
else:
html = "router_configuration_update.html"
html = 'router_configuration_update.html'
initial = {
"router_config":
'router_config':
kvstore.get_default(networks.ROUTER_CONFIGURATION_TYPE_KEY,
'dmz'),
'not_configured'),
}
template_kwargs = {
'form': RouterConfigurationWizardForm(initial=initial),
}
if is_firstboot:
html = "router_configuration_firstboot.html"
html = 'router_configuration_firstboot.html'
# mark step done on firstboot visit to get the next_step
first_boot.mark_step_done('router_setup_wizard')
@ -455,9 +451,10 @@ def router_configuration_help_page(request):
def internet_connection_type_help_page(request):
"""
Show the internet connection type page.
"""Show the internet connection type page.
Used for first boot step and networks page.
"""
is_firstboot = True \
if 'firstboot' in request.build_absolute_uri() else False
@ -477,17 +474,18 @@ def internet_connection_type_help_page(request):
messages.success(request, _('Internet connection type saved.'))
return redirect(reverse_lazy('networks:index'))
else:
html = "internet_connectivity_type.html"
html = 'internet_connectivity_type.html'
initial = {
"internet_connection_type": kvstore.get_default(
networks.INTERNET_CONNECTION_TYPE_KEY, 'dynamic_public_ip'),
'internet_connection_type':
kvstore.get_default(networks.INTERNET_CONNECTION_TYPE_KEY,
None)
}
template_kwargs = {'form': InternetConnectionTypeForm(initial=initial)}
if is_firstboot:
html = "internet_connectivity_firstboot.html"
html = 'internet_connectivity_firstboot.html'
# mark step done on firstboot visit to get the next_step
first_boot.mark_step_done('internet_connectivity_type')
first_boot.mark_step_done('internet_connectivity_type_wizard')
template_kwargs.update({
'first_boot_next_step': reverse_lazy(first_boot.next_step()),
})

View File

@ -15,9 +15,7 @@
{{ 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;"/>
<a href='{{ first_boot_next_step }}'>{% trans "Skip this step" %}</a>
<input type="submit" class="btn btn-primary pull-right" value="{% trans "Next" %}"/>
</form>
{% endblock %}

View File

@ -20,15 +20,20 @@
<p>
{% if internet_connectivity_type == "static_public_ip" %}
My ISP provides a public IP address that does not change over time.
{% blocktrans trimmed %}
My ISP provides a public IP address that does not change over time.
{% endblocktrans %}
{% elif internet_connectivity_type == "dynamic_public_ip" %}
My ISP provides a public IP address that may change over time.
{% blocktrans trimmed %}
My ISP provides a public IP address that may change over time.
{% endblocktrans %}
{% else %}
I don't have a public IP address.
{% blocktrans trimmed %}
My ISP does not provide a public IP address.
{% endblocktrans %}
{% endif %}
<a href="{% url 'networks:internet_connection_type_setup' %}" class="btn btn-default"
role="button" title="{% trans 'Update...' %}">
<span class="fa" aria-hidden="true"></span>
role="button">
{% trans 'Update...' %}
</a>
</p>

View File

@ -15,8 +15,6 @@
{{ form|bootstrap }}
<input type="submit" class="btn btn-primary"
value="{% trans "Submit" %}"/>
<input type="submit" class="btn btn-primary" value="{% trans "Submit" %}"/>
</form>
{% endblock %}

View File

@ -31,7 +31,7 @@
<p>
{% blocktrans trimmed %}
If you don't have control over your router, choose not to configure it. To
see options, to overcome this limitation, choose 'no public address' option
see options to overcome this limitation, choose 'no public address' option
in Internet connection type selection.
{% endblocktrans %}
</p>

View File

@ -15,9 +15,8 @@
{{ 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;"/>
<a href='{{ first_boot_next_step }}'>{% trans "Skip this step" %}</a>
<input type="submit" class="btn btn-primary pull-right" value="{% trans "Next" %}"/>
</form>
{% endblock %}

View File

@ -10,6 +10,7 @@
{{ box_name }} Internet Connectivity
{% endblocktrans %}
</h3>
<p>
{% blocktrans trimmed %}
The following best describes how your {{ box_name }} is connected in your
@ -20,15 +21,11 @@
<p>
{% blocktrans trimmed %}
Your {{ box_name }} gets its internet from your Router via WiFi or
Your {{ box_name }} gets its Internet from your Router via Wi-Fi or
Ethernet cable. This is a typical home setup.
{% endblocktrans %}
</p>
<div class="btn-toolbar">
<a href="{% url 'networks:router_setup' %}" class="btn btn-default"
role="button" title="{% trans 'Update...' %}">
<span class="fa" aria-hidden="true"></span>
role="button">
{% trans 'Update...' %}
</a>
</div>
</p>