rename template variable
This commit is contained in:
parent
c5585e290a
commit
d65743f2ea
@ -12,9 +12,9 @@
|
||||
<body>
|
||||
${header}
|
||||
<div class="container">
|
||||
<div class="col-12">
|
||||
<h1>${title}</h1>
|
||||
<div class="row">
|
||||
<h1 class="col-12">${title}s</h1>
|
||||
</div>
|
||||
${sections}
|
||||
${content}
|
||||
</div>
|
||||
</body>
|
@ -67,7 +67,7 @@ class SettingsFormController(AuthorizationMixin, WebpageController, metaclass=AB
|
||||
|
||||
def template_variables(self):
|
||||
variables = super().template_variables()
|
||||
variables["sections"] = self.render_sections()
|
||||
variables["content"] = self.render_sections()
|
||||
variables["title"] = self.getTitle()
|
||||
return variables
|
||||
|
||||
|
@ -1,8 +1,6 @@
|
||||
from owrx.controllers.admin import AuthorizationMixin
|
||||
from owrx.controllers.template import WebpageController
|
||||
from owrx.config import Config
|
||||
from urllib.parse import quote
|
||||
import json
|
||||
|
||||
|
||||
class SdrSettingsController(AuthorizationMixin, WebpageController):
|
||||
@ -13,21 +11,13 @@ class SdrSettingsController(AuthorizationMixin, WebpageController):
|
||||
|
||||
def template_variables(self):
|
||||
variables = super().template_variables()
|
||||
variables["sections"] = self.render_devices()
|
||||
variables["content"] = self.render_devices()
|
||||
variables["title"] = "SDR device settings"
|
||||
return variables
|
||||
|
||||
def render_devices(self):
|
||||
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):
|
||||
return """
|
||||
def render_device(device_id, config):
|
||||
return """
|
||||
<div class="card device bg-dark text-white">
|
||||
<div class="card-header">
|
||||
{device_name}
|
||||
@ -37,7 +27,15 @@ class SdrSettingsController(AuthorizationMixin, WebpageController):
|
||||
</div>
|
||||
</div>
|
||||
""".format(
|
||||
device_name=config["name"]
|
||||
device_name=config["name"]
|
||||
)
|
||||
|
||||
return """
|
||||
<div class="col-12">
|
||||
{devices}
|
||||
</div>
|
||||
""".format(
|
||||
devices="".join(render_device(key, value) for key, value in Config.get()["sdrs"].items())
|
||||
)
|
||||
|
||||
def indexAction(self):
|
||||
|
Loading…
Reference in New Issue
Block a user