diff --git a/plinth/modules/minetest/templates/minetest.html b/plinth/modules/minetest/templates/minetest.html new file mode 100644 index 000000000..48693c407 --- /dev/null +++ b/plinth/modules/minetest/templates/minetest.html @@ -0,0 +1,50 @@ +{% extends "service.html" %} +{% comment %} +# +# This file is part of Plinth. +# +# 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 bootstrap %} +{% load i18n %} +{% block status %} + {{ block.super }} + + {% if domains %} +
+
+ + + + + + + + + {% for domain in domains %} + + + + + {% endfor %} + +
{% trans "Address" %}{% trans "Port" %}
+ {{ domain }} + {{ 30000 }}
+
+
+ {% endif %} +{% endblock %} diff --git a/plinth/modules/minetest/views.py b/plinth/modules/minetest/views.py index 2a684b414..1b4760c78 100644 --- a/plinth/modules/minetest/views.py +++ b/plinth/modules/minetest/views.py @@ -27,6 +27,7 @@ from plinth.views import ServiceView from . import description, managed_services, get_configuration from .forms import MinetestForm +from plinth.modules import names class MinetestServiceView(ServiceView): # pylint: disable=too-many-ancestors @@ -35,6 +36,7 @@ class MinetestServiceView(ServiceView): # pylint: disable=too-many-ancestors diagnostics_module_name = "minetest" description = description show_status_block = True + template_name = 'minetest.html' form_class = MinetestForm clients = minetest.clients @@ -44,6 +46,15 @@ class MinetestServiceView(ServiceView): # pylint: disable=too-many-ancestors initial.update(get_configuration()) return initial + def get_context_data(self, *args, **kwargs): + """Add service to the context data.""" + context = super().get_context_data(*args, **kwargs) + domains = [domain + for domains in names.domains.values() + for domain in domains] + context['domains'] = domains + return context + def form_valid(self, form): """Change the configurations of Minetest service.""" data = form.cleaned_data