Services: Template restructuring

- renamed app.html to simple_service.html
- allow hiding the 'status' block instead of using separate
  apache_service.html template
This commit is contained in:
fonfon 2016-04-27 16:45:03 +00:00 committed by James Valleroy
parent f419c28596
commit b54846b0ce
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808
21 changed files with 39 additions and 56 deletions

View File

@ -1,4 +1,4 @@
{% extends 'app.html' %}
{% extends 'simple_service.html' %}
{% comment %}
#
# This file is part of Plinth.

View File

@ -1,4 +1,4 @@
{% extends "app.html" %}
{% extends "simple_service.html" %}
{% comment %}
#
# This file is part of Plinth.

View File

@ -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."""

View File

@ -1,4 +1,4 @@
{% extends "app.html" %}
{% extends "simple_service.html" %}
{% comment %}
#
# This file is part of Plinth.

View File

@ -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():

View File

@ -1,4 +1,4 @@
{% extends "app.html" %}
{% extends "simple_service.html" %}
{% comment %}
#
# This file is part of Plinth.

View File

@ -1,4 +1,4 @@
{% extends "app.html" %}
{% extends "simple_service.html" %}
{% comment %}
#
# This file is part of Plinth.

View File

@ -1,4 +1,4 @@
{% extends "app.html" %}
{% extends "simple_service.html" %}
{% comment %}
#
# This file is part of Plinth.

View File

@ -1,4 +1,4 @@
{% extends "app.html" %}
{% extends "simple_service.html" %}
{% comment %}
#
# This file is part of Plinth.

View File

@ -1,4 +1,4 @@
{% extends "app.html" %}
{% extends "simple_service.html" %}
{% comment %}
#
# This file is part of Plinth.

View File

@ -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'),
]

View File

@ -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'),
]

View File

@ -1,4 +1,4 @@
{% extends 'app.html' %}
{% extends 'simple_service.html' %}
{% comment %}
#
# This file is part of Plinth.

View File

@ -1,4 +1,4 @@
{% extends "app.html" %}
{% extends "simple_service.html" %}
{% comment %}
#
# This file is part of Plinth.

View File

@ -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'),
]

View File

@ -1,4 +1,4 @@
{% extends 'app.html' %}
{% extends 'simple_service.html' %}
{% comment %}
#
# This file is part of Plinth.

View File

@ -1,4 +1,4 @@
{% extends "app.html" %}
{% extends "simple_service.html" %}
{% comment %}
#
# This file is part of Plinth.

View File

@ -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 <http://www.gnu.org/licenses/>.
#
{% 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 %}

View File

@ -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 %}
<h3>Status</h3>
<p class="running-status-parent">
{% if service.is_running %}
<span class="running-status active"></span>
Service <i>{{ service.name }}</i> {% trans "is running" %}
{% else %}
<span class="running-status inactive"></span>
Service <i>{{ service.name }}</i> {% trans "is not running" %}
{% endif %}
</p>
{% if show_status_block %}
<h3>Status</h3>
<p class="running-status-parent">
{% if service.is_running %}
<span class="running-status active"></span>
Service <i>{{ service.name }}</i> {% trans "is running" %}
{% else %}
<span class="running-status inactive"></span>
Service <i>{{ service.name }}</i> {% trans "is not running" %}
{% endif %}
</p>
{% endif %}
{% endblock %}
{% block diagnostics %}

View File

@ -18,6 +18,8 @@
#
{% endcomment %}
{# Template for simple service configuration/description pages #}
{% load i18n %}
{% block content %}

View File

@ -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