diff --git a/plinth/modules/diagnostics/templates/diagnostics.html b/plinth/modules/diagnostics/templates/diagnostics.html index 066222347..ab181f029 100644 --- a/plinth/modules/diagnostics/templates/diagnostics.html +++ b/plinth/modules/diagnostics/templates/diagnostics.html @@ -1,4 +1,4 @@ -{% extends 'app.html' %} +{% extends 'simple_service.html' %} {% comment %} # # This file is part of Plinth. diff --git a/plinth/modules/firewall/templates/firewall.html b/plinth/modules/firewall/templates/firewall.html index ec2440702..e8178fe7a 100644 --- a/plinth/modules/firewall/templates/firewall.html +++ b/plinth/modules/firewall/templates/firewall.html @@ -1,4 +1,4 @@ -{% extends "app.html" %} +{% extends "simple_service.html" %} {% comment %} # # This file is part of Plinth. diff --git a/plinth/modules/ikiwiki/views.py b/plinth/modules/ikiwiki/views.py index 0f1dffecb..89ebab841 100644 --- a/plinth/modules/ikiwiki/views.py +++ b/plinth/modules/ikiwiki/views.py @@ -43,9 +43,9 @@ subsubmenu = [{'url': reverse_lazy('ikiwiki:index'), class IkiwikiServiceView(views.ServiceView): """Serve configuration page.""" service_id = "ikiwiki" - template_name = "apache_service.html" - diagnostics_module_name = "ikiwiki" description = ikiwiki.description + diagnostics_module_name = "ikiwiki" + show_status_block = False def get_context_data(self, **kwargs): """Return the context data for rendering the template view.""" diff --git a/plinth/modules/letsencrypt/templates/letsencrypt.html b/plinth/modules/letsencrypt/templates/letsencrypt.html index 1e3e29b2a..9460a81c0 100644 --- a/plinth/modules/letsencrypt/templates/letsencrypt.html +++ b/plinth/modules/letsencrypt/templates/letsencrypt.html @@ -1,4 +1,4 @@ -{% extends "app.html" %} +{% extends "simple_service.html" %} {% comment %} # # This file is part of Plinth. diff --git a/plinth/modules/minetest/__init__.py b/plinth/modules/minetest/__init__.py index 4eb04f273..fa5b49071 100644 --- a/plinth/modules/minetest/__init__.py +++ b/plinth/modules/minetest/__init__.py @@ -65,9 +65,9 @@ def setup(helper, old_version=None): class MinetestServiceView(ServiceView): service_id = managed_services[0] - template_name = "apache_service.html" diagnostics_module_name = "minetest" description = description + show_status_block = False def diagnose(): diff --git a/plinth/modules/monkeysphere/templates/monkeysphere.html b/plinth/modules/monkeysphere/templates/monkeysphere.html index ec9985601..02f7f625f 100644 --- a/plinth/modules/monkeysphere/templates/monkeysphere.html +++ b/plinth/modules/monkeysphere/templates/monkeysphere.html @@ -1,4 +1,4 @@ -{% extends "app.html" %} +{% extends "simple_service.html" %} {% comment %} # # This file is part of Plinth. diff --git a/plinth/modules/names/templates/names.html b/plinth/modules/names/templates/names.html index bbdc0107b..360bbb57c 100644 --- a/plinth/modules/names/templates/names.html +++ b/plinth/modules/names/templates/names.html @@ -1,4 +1,4 @@ -{% extends "app.html" %} +{% extends "simple_service.html" %} {% comment %} # # This file is part of Plinth. diff --git a/plinth/modules/openvpn/templates/openvpn.html b/plinth/modules/openvpn/templates/openvpn.html index 422a9e69f..10d14d63f 100644 --- a/plinth/modules/openvpn/templates/openvpn.html +++ b/plinth/modules/openvpn/templates/openvpn.html @@ -1,4 +1,4 @@ -{% extends "app.html" %} +{% extends "simple_service.html" %} {% comment %} # # This file is part of Plinth. diff --git a/plinth/modules/owncloud/templates/owncloud.html b/plinth/modules/owncloud/templates/owncloud.html index 266967d3d..6f53825d9 100644 --- a/plinth/modules/owncloud/templates/owncloud.html +++ b/plinth/modules/owncloud/templates/owncloud.html @@ -1,4 +1,4 @@ -{% extends "app.html" %} +{% extends "simple_service.html" %} {% comment %} # # This file is part of Plinth. diff --git a/plinth/modules/power/templates/power.html b/plinth/modules/power/templates/power.html index 89553d389..9d17724c8 100644 --- a/plinth/modules/power/templates/power.html +++ b/plinth/modules/power/templates/power.html @@ -1,4 +1,4 @@ -{% extends "app.html" %} +{% extends "simple_service.html" %} {% comment %} # # This file is part of Plinth. diff --git a/plinth/modules/roundcube/urls.py b/plinth/modules/roundcube/urls.py index be4edd836..e2380e290 100644 --- a/plinth/modules/roundcube/urls.py +++ b/plinth/modules/roundcube/urls.py @@ -30,6 +30,6 @@ urlpatterns = [ service_id="roundcube", diagnostics_module_name="roundcube", description=roundcube.description, - template_name="apache_service.html" + show_status_block=False ), name='index'), ] diff --git a/plinth/modules/shaarli/urls.py b/plinth/modules/shaarli/urls.py index 236c00ee8..7b6f360a1 100644 --- a/plinth/modules/shaarli/urls.py +++ b/plinth/modules/shaarli/urls.py @@ -29,6 +29,6 @@ urlpatterns = [ url(r'^apps/shaarli/$', ServiceView.as_view( service_id="shaarli", description=shaarli.description, - template_name="apache_service.html" + show_status_block=False, ), name='index'), ] diff --git a/plinth/modules/system/templates/system.html b/plinth/modules/system/templates/system.html index a60745d8f..18f3070e2 100644 --- a/plinth/modules/system/templates/system.html +++ b/plinth/modules/system/templates/system.html @@ -1,4 +1,4 @@ -{% extends 'app.html' %} +{% extends 'simple_service.html' %} {% comment %} # # This file is part of Plinth. diff --git a/plinth/modules/tor/templates/tor.html b/plinth/modules/tor/templates/tor.html index a81550b18..d675f1aac 100644 --- a/plinth/modules/tor/templates/tor.html +++ b/plinth/modules/tor/templates/tor.html @@ -1,4 +1,4 @@ -{% extends "app.html" %} +{% extends "simple_service.html" %} {% comment %} # # This file is part of Plinth. diff --git a/plinth/modules/ttrss/urls.py b/plinth/modules/ttrss/urls.py index 34413e569..df988258a 100644 --- a/plinth/modules/ttrss/urls.py +++ b/plinth/modules/ttrss/urls.py @@ -30,6 +30,6 @@ urlpatterns = [ service_id=ttrss.managed_services[0], diagnostics_module_name="ttrss", description=ttrss.description, - template_name="apache_service.html" + show_status_block=False ), name='index'), ] diff --git a/plinth/modules/upgrades/templates/upgrades.html b/plinth/modules/upgrades/templates/upgrades.html index 4cc47be98..85efcb57f 100644 --- a/plinth/modules/upgrades/templates/upgrades.html +++ b/plinth/modules/upgrades/templates/upgrades.html @@ -1,4 +1,4 @@ -{% extends 'app.html' %} +{% extends 'simple_service.html' %} {% comment %} # # This file is part of Plinth. diff --git a/plinth/modules/upgrades/templates/upgrades_configure.html b/plinth/modules/upgrades/templates/upgrades_configure.html index 4a4e1c3fe..07237d745 100644 --- a/plinth/modules/upgrades/templates/upgrades_configure.html +++ b/plinth/modules/upgrades/templates/upgrades_configure.html @@ -1,4 +1,4 @@ -{% extends "app.html" %} +{% extends "simple_service.html" %} {% comment %} # # This file is part of Plinth. diff --git a/plinth/templates/apache_service.html b/plinth/templates/apache_service.html deleted file mode 100644 index 991405822..000000000 --- a/plinth/templates/apache_service.html +++ /dev/null @@ -1,28 +0,0 @@ -{% 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 %} - -{% comment %} -# The status block uses is_running, but apache services by default don't -# provide this method. We could use is_enabled instead, but this information is -# available in the enable/disable checkbox already. So omit it altogether. -{% endcomment %} - -{% block status %} -{% endblock %} diff --git a/plinth/templates/service.html b/plinth/templates/service.html index 92940e757..314955095 100644 --- a/plinth/templates/service.html +++ b/plinth/templates/service.html @@ -18,6 +18,8 @@ # {% endcomment %} +{# Template to display/configure a Service, used by views.ServiceView #} + {% load bootstrap %} {% load i18n %} @@ -33,16 +35,18 @@ {% endblock %} {% block status %} -

Status

-

- {% if service.is_running %} - - Service {{ service.name }} {% trans "is running" %} - {% else %} - - Service {{ service.name }} {% trans "is not running" %} - {% endif %} -

+ {% if show_status_block %} +

Status

+

+ {% if service.is_running %} + + Service {{ service.name }} {% trans "is running" %} + {% else %} + + Service {{ service.name }} {% trans "is not running" %} + {% endif %} +

+ {% endif %} {% endblock %} {% block diagnostics %} diff --git a/plinth/templates/app.html b/plinth/templates/simple_service.html similarity index 93% rename from plinth/templates/app.html rename to plinth/templates/simple_service.html index 023171c08..5573add9d 100644 --- a/plinth/templates/app.html +++ b/plinth/templates/simple_service.html @@ -18,6 +18,8 @@ # {% endcomment %} +{# Template for simple service configuration/description pages #} + {% load i18n %} {% block content %} diff --git a/plinth/views.py b/plinth/views.py index efcad2f9a..076377356 100644 --- a/plinth/views.py +++ b/plinth/views.py @@ -46,6 +46,10 @@ class ServiceView(FormView): diagnostics_module_name = "" # List of paragraphs describing the service description = "" + # Display the 'status' block of the service.html template + # This block uses information from service.is_running. This method is + # optional, so allow not showing this block here. + show_status_block = True @property def success_url(self): @@ -98,6 +102,7 @@ class ServiceView(FormView): context['diagnostics_module_name'] = self.diagnostics_module_name if self.description: context['description'] = self.description + context['show_status_block'] = self.show_status_block return context