mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-05-27 10:44:33 +00:00
networks: Remove subsubmenu in favor of toolbar buttons
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
parent
77737afadd
commit
ec407bfd26
@ -35,6 +35,13 @@ managed_packages = ['network-manager', 'batctl']
|
|||||||
|
|
||||||
name = _('Networks')
|
name = _('Networks')
|
||||||
|
|
||||||
|
description = [
|
||||||
|
_('Configure network devices. Connect to the Internet via Ethernet, Wi-Fi '
|
||||||
|
'or PPPoE. Share that connection with other devices on the network.'),
|
||||||
|
_('Devices administered through other methods may not be available for '
|
||||||
|
'configuration here.'),
|
||||||
|
]
|
||||||
|
|
||||||
logger = Logger(__name__)
|
logger = Logger(__name__)
|
||||||
|
|
||||||
manual_page = 'Networks'
|
manual_page = 'Networks'
|
||||||
|
|||||||
@ -22,7 +22,6 @@ from django.shortcuts import redirect
|
|||||||
from django.template.response import TemplateResponse
|
from django.template.response import TemplateResponse
|
||||||
from django.urls import reverse_lazy
|
from django.urls import reverse_lazy
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import ugettext as _
|
||||||
from django.utils.translation import ugettext_lazy
|
|
||||||
from django.views.decorators.http import require_POST
|
from django.views.decorators.http import require_POST
|
||||||
|
|
||||||
from plinth import network
|
from plinth import network
|
||||||
@ -33,17 +32,6 @@ from .forms import (ConnectionTypeSelectForm, EthernetForm, GenericForm,
|
|||||||
|
|
||||||
logger = Logger(__name__)
|
logger = Logger(__name__)
|
||||||
|
|
||||||
subsubmenu = [{
|
|
||||||
'url': reverse_lazy('networks:index'),
|
|
||||||
'text': ugettext_lazy('Network Connections')
|
|
||||||
}, {
|
|
||||||
'url': reverse_lazy('networks:scan'),
|
|
||||||
'text': ugettext_lazy('Nearby Wi-Fi Networks')
|
|
||||||
}, {
|
|
||||||
'url': reverse_lazy('networks:add'),
|
|
||||||
'text': ugettext_lazy('Add Connection')
|
|
||||||
}]
|
|
||||||
|
|
||||||
|
|
||||||
def index(request):
|
def index(request):
|
||||||
"""Show connection list."""
|
"""Show connection list."""
|
||||||
@ -52,8 +40,11 @@ def index(request):
|
|||||||
return TemplateResponse(
|
return TemplateResponse(
|
||||||
request, 'connections_list.html', {
|
request, 'connections_list.html', {
|
||||||
'title': _('Network Connections'),
|
'title': _('Network Connections'),
|
||||||
|
'name': networks.name,
|
||||||
|
'description': networks.description,
|
||||||
'manual_page': networks.manual_page,
|
'manual_page': networks.manual_page,
|
||||||
'subsubmenu': subsubmenu,
|
'diagnostics_module_name': 'networks',
|
||||||
|
'is_enabled': True,
|
||||||
'connections': connections
|
'connections': connections
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -100,7 +91,6 @@ def show(request, uuid):
|
|||||||
return TemplateResponse(
|
return TemplateResponse(
|
||||||
request, 'connection_show.html', {
|
request, 'connection_show.html', {
|
||||||
'title': _('Connection Information'),
|
'title': _('Connection Information'),
|
||||||
'subsubmenu': subsubmenu,
|
|
||||||
'connection': connection_status,
|
'connection': connection_status,
|
||||||
'active_connection': active_connection_status,
|
'active_connection': active_connection_status,
|
||||||
'device': device_status,
|
'device': device_status,
|
||||||
@ -141,10 +131,8 @@ def edit(request, uuid):
|
|||||||
|
|
||||||
return redirect(reverse_lazy('networks:index'))
|
return redirect(reverse_lazy('networks:index'))
|
||||||
else:
|
else:
|
||||||
return TemplateResponse(
|
return TemplateResponse(request, 'connections_edit.html', {
|
||||||
request, 'connections_edit.html', {
|
|
||||||
'title': _('Edit Connection'),
|
'title': _('Edit Connection'),
|
||||||
'subsubmenu': subsubmenu,
|
|
||||||
'form': form
|
'form': form
|
||||||
})
|
})
|
||||||
else:
|
else:
|
||||||
@ -229,7 +217,6 @@ def edit(request, uuid):
|
|||||||
|
|
||||||
return TemplateResponse(request, 'connections_edit.html', {
|
return TemplateResponse(request, 'connections_edit.html', {
|
||||||
'title': _('Edit Connection'),
|
'title': _('Edit Connection'),
|
||||||
'subsubmenu': subsubmenu,
|
|
||||||
'form': form
|
'form': form
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -243,12 +230,14 @@ def activate(request, uuid):
|
|||||||
messages.success(request,
|
messages.success(request,
|
||||||
_('Activated connection {name}.').format(name=name))
|
_('Activated connection {name}.').format(name=name))
|
||||||
except network.ConnectionNotFound:
|
except network.ConnectionNotFound:
|
||||||
messages.error(request,
|
messages.error(
|
||||||
|
request,
|
||||||
_('Failed to activate connection: '
|
_('Failed to activate connection: '
|
||||||
'Connection not found.'))
|
'Connection not found.'))
|
||||||
except network.DeviceNotFound as exception:
|
except network.DeviceNotFound as exception:
|
||||||
name = exception.args[0].get_id()
|
name = exception.args[0].get_id()
|
||||||
messages.error(request,
|
messages.error(
|
||||||
|
request,
|
||||||
_('Failed to activate connection {name}: '
|
_('Failed to activate connection {name}: '
|
||||||
'No suitable device is available.').format(name=name))
|
'No suitable device is available.').format(name=name))
|
||||||
|
|
||||||
@ -264,7 +253,8 @@ def deactivate(request, uuid):
|
|||||||
messages.success(request,
|
messages.success(request,
|
||||||
_('Deactivated connection {name}.').format(name=name))
|
_('Deactivated connection {name}.').format(name=name))
|
||||||
except network.ConnectionNotFound:
|
except network.ConnectionNotFound:
|
||||||
messages.error(request,
|
messages.error(
|
||||||
|
request,
|
||||||
_('Failed to de-activate connection: '
|
_('Failed to de-activate connection: '
|
||||||
'Connection not found.'))
|
'Connection not found.'))
|
||||||
|
|
||||||
@ -274,10 +264,8 @@ def deactivate(request, uuid):
|
|||||||
def scan(request):
|
def scan(request):
|
||||||
"""Show a list of nearby visible Wi-Fi access points."""
|
"""Show a list of nearby visible Wi-Fi access points."""
|
||||||
access_points = network.wifi_scan()
|
access_points = network.wifi_scan()
|
||||||
return TemplateResponse(
|
return TemplateResponse(request, 'wifi_scan.html', {
|
||||||
request, 'wifi_scan.html', {
|
|
||||||
'title': _('Nearby Wi-Fi Networks'),
|
'title': _('Nearby Wi-Fi Networks'),
|
||||||
'subsubmenu': subsubmenu,
|
|
||||||
'access_points': access_points
|
'access_points': access_points
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -302,7 +290,6 @@ def add(request):
|
|||||||
form = ConnectionTypeSelectForm()
|
form = ConnectionTypeSelectForm()
|
||||||
return TemplateResponse(request, 'connections_type_select.html', {
|
return TemplateResponse(request, 'connections_type_select.html', {
|
||||||
'title': _('Add Connection'),
|
'title': _('Add Connection'),
|
||||||
'subsubmenu': subsubmenu,
|
|
||||||
'form': form
|
'form': form
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -319,10 +306,8 @@ def add_generic(request):
|
|||||||
else:
|
else:
|
||||||
form = GenericForm()
|
form = GenericForm()
|
||||||
|
|
||||||
return TemplateResponse(
|
return TemplateResponse(request, 'connections_create.html', {
|
||||||
request, 'connections_create.html', {
|
|
||||||
'title': _('Adding New Generic Connection'),
|
'title': _('Adding New Generic Connection'),
|
||||||
'subsubmenu': subsubmenu,
|
|
||||||
'form': form
|
'form': form
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -339,10 +324,8 @@ def add_ethernet(request):
|
|||||||
else:
|
else:
|
||||||
form = EthernetForm()
|
form = EthernetForm()
|
||||||
|
|
||||||
return TemplateResponse(
|
return TemplateResponse(request, 'connections_create.html', {
|
||||||
request, 'connections_create.html', {
|
|
||||||
'title': _('Adding New Ethernet Connection'),
|
'title': _('Adding New Ethernet Connection'),
|
||||||
'subsubmenu': subsubmenu,
|
|
||||||
'form': form
|
'form': form
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -359,10 +342,8 @@ def add_pppoe(request):
|
|||||||
else:
|
else:
|
||||||
form = PPPoEForm()
|
form = PPPoEForm()
|
||||||
|
|
||||||
return TemplateResponse(
|
return TemplateResponse(request, 'connections_create.html', {
|
||||||
request, 'connections_create.html', {
|
|
||||||
'title': _('Adding New PPPoE Connection'),
|
'title': _('Adding New PPPoE Connection'),
|
||||||
'subsubmenu': subsubmenu,
|
|
||||||
'form': form
|
'form': form
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -396,10 +377,8 @@ def add_wifi(request, ssid=None, interface_name=None):
|
|||||||
else:
|
else:
|
||||||
form = WifiForm()
|
form = WifiForm()
|
||||||
|
|
||||||
return TemplateResponse(
|
return TemplateResponse(request, 'connections_create.html', {
|
||||||
request, 'connections_create.html', {
|
|
||||||
'title': _('Adding New Wi-Fi Connection'),
|
'title': _('Adding New Wi-Fi Connection'),
|
||||||
'subsubmenu': subsubmenu,
|
|
||||||
'form': form
|
'form': form
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -416,7 +395,8 @@ def delete(request, uuid):
|
|||||||
messages.success(request,
|
messages.success(request,
|
||||||
_('Connection {name} deleted.').format(name=name))
|
_('Connection {name} deleted.').format(name=name))
|
||||||
except network.ConnectionNotFound:
|
except network.ConnectionNotFound:
|
||||||
messages.error(request,
|
messages.error(
|
||||||
|
request,
|
||||||
_('Failed to delete connection: '
|
_('Failed to delete connection: '
|
||||||
'Connection not found.'))
|
'Connection not found.'))
|
||||||
|
|
||||||
@ -426,13 +406,12 @@ def delete(request, uuid):
|
|||||||
connection = network.get_connection(uuid)
|
connection = network.get_connection(uuid)
|
||||||
name = connection.get_id()
|
name = connection.get_id()
|
||||||
except network.ConnectionNotFound:
|
except network.ConnectionNotFound:
|
||||||
messages.error(request,
|
messages.error(
|
||||||
_('Failed to delete connection: '
|
request, _('Failed to delete connection: '
|
||||||
'Connection not found.'))
|
'Connection not found.'))
|
||||||
return redirect(reverse_lazy('networks:index'))
|
return redirect(reverse_lazy('networks:index'))
|
||||||
|
|
||||||
return TemplateResponse(request, 'connections_delete.html', {
|
return TemplateResponse(request, 'connections_delete.html', {
|
||||||
'title': _('Delete Connection'),
|
'title': _('Delete Connection'),
|
||||||
'subsubmenu': subsubmenu,
|
|
||||||
'name': name
|
'name': name
|
||||||
})
|
})
|
||||||
|
|||||||
@ -23,6 +23,8 @@
|
|||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
||||||
|
<h3>{{ title }}</h3>
|
||||||
|
|
||||||
<form class="form" method="post">
|
<form class="form" method="post">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
|
|
||||||
|
|||||||
@ -34,11 +34,8 @@
|
|||||||
<form class="form" method="post">
|
<form class="form" method="post">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
|
|
||||||
<input type="submit" class="btn btn-md btn-primary"
|
<input type="submit" class="btn btn-md btn-danger"
|
||||||
value="Delete {{ name }}"/>
|
value="Delete {{ name }}"/>
|
||||||
|
|
||||||
<a href="{% url 'networks:index' %}" role="button"
|
|
||||||
class="btn btn-md btn-primary">{% trans "Cancel" %}</a>
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
@ -24,6 +24,8 @@
|
|||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
||||||
|
<h3>{{ title }}</h3>
|
||||||
|
|
||||||
<form class="form" method="post">
|
<form class="form" method="post">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
{% extends "base.html" %}
|
{% extends "app.html" %}
|
||||||
{% comment %}
|
{% comment %}
|
||||||
#
|
#
|
||||||
# This file is part of FreedomBox.
|
# This file is part of FreedomBox.
|
||||||
@ -54,7 +54,22 @@
|
|||||||
</style>
|
</style>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block status %}
|
||||||
|
<a href="{% url 'networks:scan' %}" class="btn btn-default"
|
||||||
|
role="button" title="{% trans 'Nearby Wi-Fi Networks' %}">
|
||||||
|
<span class="fa fa-wifi" aria-hidden="true"></span>
|
||||||
|
{% trans "Nearby Wi-Fi Networks" %}
|
||||||
|
</a>
|
||||||
|
<a href="{% url 'networks:add' %}" class="btn btn-default"
|
||||||
|
role="button" title="{% trans 'Add Connection' %}">
|
||||||
|
<span class="fa fa-plus" aria-hidden="true"></span>
|
||||||
|
{% trans "Add Connection" %}
|
||||||
|
</a>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block configuration %}
|
||||||
|
|
||||||
|
<h3>{% trans "Connections" %}</h3>
|
||||||
|
|
||||||
<div class="list-group">
|
<div class="list-group">
|
||||||
{% for connection in connections %}
|
{% for connection in connections %}
|
||||||
@ -106,6 +121,4 @@
|
|||||||
|
|
||||||
{% include "connections_diagram.html" %}
|
{% include "connections_diagram.html" %}
|
||||||
|
|
||||||
{% include "diagnostics_button.html" with module="networks" enabled=True %}
|
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
@ -23,6 +23,8 @@
|
|||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
||||||
|
<h3>{{ title }}</h3>
|
||||||
|
|
||||||
<form class="form" method="post">
|
<form class="form" method="post">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
|
|
||||||
|
|||||||
@ -23,6 +23,8 @@
|
|||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
||||||
|
<h3>{{ title }}</h3>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm-6">
|
<div class="col-sm-6">
|
||||||
<div class="list-group">
|
<div class="list-group">
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user