mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-08-26 12:46:08 +00:00
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:
parent
f419c28596
commit
b54846b0ce
@ -1,4 +1,4 @@
|
|||||||
{% extends 'app.html' %}
|
{% extends 'simple_service.html' %}
|
||||||
{% comment %}
|
{% comment %}
|
||||||
#
|
#
|
||||||
# This file is part of Plinth.
|
# This file is part of Plinth.
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
{% extends "app.html" %}
|
{% extends "simple_service.html" %}
|
||||||
{% comment %}
|
{% comment %}
|
||||||
#
|
#
|
||||||
# This file is part of Plinth.
|
# This file is part of Plinth.
|
||||||
|
|||||||
@ -43,9 +43,9 @@ subsubmenu = [{'url': reverse_lazy('ikiwiki:index'),
|
|||||||
class IkiwikiServiceView(views.ServiceView):
|
class IkiwikiServiceView(views.ServiceView):
|
||||||
"""Serve configuration page."""
|
"""Serve configuration page."""
|
||||||
service_id = "ikiwiki"
|
service_id = "ikiwiki"
|
||||||
template_name = "apache_service.html"
|
|
||||||
diagnostics_module_name = "ikiwiki"
|
|
||||||
description = ikiwiki.description
|
description = ikiwiki.description
|
||||||
|
diagnostics_module_name = "ikiwiki"
|
||||||
|
show_status_block = False
|
||||||
|
|
||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
"""Return the context data for rendering the template view."""
|
"""Return the context data for rendering the template view."""
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
{% extends "app.html" %}
|
{% extends "simple_service.html" %}
|
||||||
{% comment %}
|
{% comment %}
|
||||||
#
|
#
|
||||||
# This file is part of Plinth.
|
# This file is part of Plinth.
|
||||||
|
|||||||
@ -65,9 +65,9 @@ def setup(helper, old_version=None):
|
|||||||
|
|
||||||
class MinetestServiceView(ServiceView):
|
class MinetestServiceView(ServiceView):
|
||||||
service_id = managed_services[0]
|
service_id = managed_services[0]
|
||||||
template_name = "apache_service.html"
|
|
||||||
diagnostics_module_name = "minetest"
|
diagnostics_module_name = "minetest"
|
||||||
description = description
|
description = description
|
||||||
|
show_status_block = False
|
||||||
|
|
||||||
|
|
||||||
def diagnose():
|
def diagnose():
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
{% extends "app.html" %}
|
{% extends "simple_service.html" %}
|
||||||
{% comment %}
|
{% comment %}
|
||||||
#
|
#
|
||||||
# This file is part of Plinth.
|
# This file is part of Plinth.
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
{% extends "app.html" %}
|
{% extends "simple_service.html" %}
|
||||||
{% comment %}
|
{% comment %}
|
||||||
#
|
#
|
||||||
# This file is part of Plinth.
|
# This file is part of Plinth.
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
{% extends "app.html" %}
|
{% extends "simple_service.html" %}
|
||||||
{% comment %}
|
{% comment %}
|
||||||
#
|
#
|
||||||
# This file is part of Plinth.
|
# This file is part of Plinth.
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
{% extends "app.html" %}
|
{% extends "simple_service.html" %}
|
||||||
{% comment %}
|
{% comment %}
|
||||||
#
|
#
|
||||||
# This file is part of Plinth.
|
# This file is part of Plinth.
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
{% extends "app.html" %}
|
{% extends "simple_service.html" %}
|
||||||
{% comment %}
|
{% comment %}
|
||||||
#
|
#
|
||||||
# This file is part of Plinth.
|
# This file is part of Plinth.
|
||||||
|
|||||||
@ -30,6 +30,6 @@ urlpatterns = [
|
|||||||
service_id="roundcube",
|
service_id="roundcube",
|
||||||
diagnostics_module_name="roundcube",
|
diagnostics_module_name="roundcube",
|
||||||
description=roundcube.description,
|
description=roundcube.description,
|
||||||
template_name="apache_service.html"
|
show_status_block=False
|
||||||
), name='index'),
|
), name='index'),
|
||||||
]
|
]
|
||||||
|
|||||||
@ -29,6 +29,6 @@ urlpatterns = [
|
|||||||
url(r'^apps/shaarli/$', ServiceView.as_view(
|
url(r'^apps/shaarli/$', ServiceView.as_view(
|
||||||
service_id="shaarli",
|
service_id="shaarli",
|
||||||
description=shaarli.description,
|
description=shaarli.description,
|
||||||
template_name="apache_service.html"
|
show_status_block=False,
|
||||||
), name='index'),
|
), name='index'),
|
||||||
]
|
]
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
{% extends 'app.html' %}
|
{% extends 'simple_service.html' %}
|
||||||
{% comment %}
|
{% comment %}
|
||||||
#
|
#
|
||||||
# This file is part of Plinth.
|
# This file is part of Plinth.
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
{% extends "app.html" %}
|
{% extends "simple_service.html" %}
|
||||||
{% comment %}
|
{% comment %}
|
||||||
#
|
#
|
||||||
# This file is part of Plinth.
|
# This file is part of Plinth.
|
||||||
|
|||||||
@ -30,6 +30,6 @@ urlpatterns = [
|
|||||||
service_id=ttrss.managed_services[0],
|
service_id=ttrss.managed_services[0],
|
||||||
diagnostics_module_name="ttrss",
|
diagnostics_module_name="ttrss",
|
||||||
description=ttrss.description,
|
description=ttrss.description,
|
||||||
template_name="apache_service.html"
|
show_status_block=False
|
||||||
), name='index'),
|
), name='index'),
|
||||||
]
|
]
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
{% extends 'app.html' %}
|
{% extends 'simple_service.html' %}
|
||||||
{% comment %}
|
{% comment %}
|
||||||
#
|
#
|
||||||
# This file is part of Plinth.
|
# This file is part of Plinth.
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
{% extends "app.html" %}
|
{% extends "simple_service.html" %}
|
||||||
{% comment %}
|
{% comment %}
|
||||||
#
|
#
|
||||||
# This file is part of Plinth.
|
# This file is part of Plinth.
|
||||||
|
|||||||
@ -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 %}
|
|
||||||
@ -18,6 +18,8 @@
|
|||||||
#
|
#
|
||||||
{% endcomment %}
|
{% endcomment %}
|
||||||
|
|
||||||
|
{# Template to display/configure a Service, used by views.ServiceView #}
|
||||||
|
|
||||||
{% load bootstrap %}
|
{% load bootstrap %}
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
|
|
||||||
@ -33,16 +35,18 @@
|
|||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block status %}
|
{% block status %}
|
||||||
<h3>Status</h3>
|
{% if show_status_block %}
|
||||||
<p class="running-status-parent">
|
<h3>Status</h3>
|
||||||
{% if service.is_running %}
|
<p class="running-status-parent">
|
||||||
<span class="running-status active"></span>
|
{% if service.is_running %}
|
||||||
Service <i>{{ service.name }}</i> {% trans "is running" %}
|
<span class="running-status active"></span>
|
||||||
{% else %}
|
Service <i>{{ service.name }}</i> {% trans "is running" %}
|
||||||
<span class="running-status inactive"></span>
|
{% else %}
|
||||||
Service <i>{{ service.name }}</i> {% trans "is not running" %}
|
<span class="running-status inactive"></span>
|
||||||
{% endif %}
|
Service <i>{{ service.name }}</i> {% trans "is not running" %}
|
||||||
</p>
|
{% endif %}
|
||||||
|
</p>
|
||||||
|
{% endif %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block diagnostics %}
|
{% block diagnostics %}
|
||||||
|
|||||||
@ -18,6 +18,8 @@
|
|||||||
#
|
#
|
||||||
{% endcomment %}
|
{% endcomment %}
|
||||||
|
|
||||||
|
{# Template for simple service configuration/description pages #}
|
||||||
|
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
@ -46,6 +46,10 @@ class ServiceView(FormView):
|
|||||||
diagnostics_module_name = ""
|
diagnostics_module_name = ""
|
||||||
# List of paragraphs describing the service
|
# List of paragraphs describing the service
|
||||||
description = ""
|
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
|
@property
|
||||||
def success_url(self):
|
def success_url(self):
|
||||||
@ -98,6 +102,7 @@ class ServiceView(FormView):
|
|||||||
context['diagnostics_module_name'] = self.diagnostics_module_name
|
context['diagnostics_module_name'] = self.diagnostics_module_name
|
||||||
if self.description:
|
if self.description:
|
||||||
context['description'] = self.description
|
context['description'] = self.description
|
||||||
|
context['show_status_block'] = self.show_status_block
|
||||||
return context
|
return context
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user