reuse existing template

This commit is contained in:
Jakob Ketterl 2021-02-18 22:12:13 +01:00
parent d612792593
commit 54fde2c1c0
2 changed files with 10 additions and 24 deletions

View File

@ -1,21 +0,0 @@
<!DOCTYPE HTML>
<html>
<head>
<title>OpenWebRX Settings</title>
<link rel="shortcut icon" type="image/x-icon" href="../static/favicon.ico" />
<link rel="stylesheet" href="../static/css/bootstrap.min.css" />
<link rel="stylesheet" type="text/css" href="../static/css/admin.css" />
<script src="../compiled/settings.js"></script>
<meta charset="utf-8">
</head>
<body>
${header}
<div class="container">
<div class="col-12">
<h1>SDR device settings</h1>
</div>
<div class="col-12">
${devices}
</div>
</div>
</body>

View File

@ -13,11 +13,18 @@ class SdrSettingsController(AuthorizationMixin, WebpageController):
def template_variables(self): def template_variables(self):
variables = super().template_variables() variables = super().template_variables()
variables["devices"] = self.render_devices() variables["sections"] = self.render_devices()
variables["title"] = "SDR device settings"
return variables return variables
def render_devices(self): def render_devices(self):
return "".join(self.render_device(key, value) for key, value in Config.get()["sdrs"].items()) return """
<div class="col-12">
{devices}
</div>
""".format(
devices="".join(self.render_device(key, value) for key, value in Config.get()["sdrs"].items())
)
def render_device(self, device_id, config): def render_device(self, device_id, config):
return """ return """
@ -41,4 +48,4 @@ class SdrSettingsController(AuthorizationMixin, WebpageController):
) )
def indexAction(self): def indexAction(self):
self.serve_template("settings/sdr.html", **self.template_variables()) self.serve_template("settings/general.html", **self.template_variables())