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