mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-05-13 10:30:16 +00:00
names: Use AppView for app page
Tests: - App page shows properly. Status of the current domains is shown properly. - App page does not show enable/disable button. Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
parent
b970b72bb0
commit
6bd9211791
@ -34,6 +34,8 @@ class NamesApp(app_module.App):
|
|||||||
|
|
||||||
_version = 1
|
_version = 1
|
||||||
|
|
||||||
|
can_be_disabled = False
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
"""Create components for the app."""
|
"""Create components for the app."""
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
|||||||
@ -8,5 +8,5 @@ from django.urls import re_path
|
|||||||
from . import views
|
from . import views
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
re_path(r'^sys/names/$', views.index, name='index'),
|
re_path(r'^sys/names/$', views.NamesAppView.as_view(), name='index'),
|
||||||
]
|
]
|
||||||
|
|||||||
@ -3,21 +3,22 @@
|
|||||||
FreedomBox app for name services.
|
FreedomBox app for name services.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from django.template.response import TemplateResponse
|
from plinth.views import AppView
|
||||||
|
|
||||||
from plinth import app as app_module
|
|
||||||
|
|
||||||
from . import components
|
from . import components
|
||||||
|
|
||||||
|
|
||||||
def index(request):
|
class NamesAppView(AppView):
|
||||||
"""Serve name services page."""
|
"""Show names app main page."""
|
||||||
status = get_status()
|
|
||||||
|
|
||||||
return TemplateResponse(request, 'names.html', {
|
app_id = 'names'
|
||||||
'app_info': app_module.App.get('names').info,
|
template_name = 'names.html'
|
||||||
'status': status
|
|
||||||
})
|
def get_context_data(self, *args, **kwargs):
|
||||||
|
"""Add additional context data for template."""
|
||||||
|
context = super().get_context_data(*args, **kwargs)
|
||||||
|
context['status'] = get_status()
|
||||||
|
return context
|
||||||
|
|
||||||
|
|
||||||
def get_status():
|
def get_status():
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user