hide "settings" link if features is disabled

This commit is contained in:
Jakob Ketterl 2020-04-25 20:52:41 +02:00
parent 4dc10fb6a3
commit dd492fa63c
2 changed files with 7 additions and 2 deletions

View File

@ -17,7 +17,7 @@
<div class="button" data-toggle-panel="openwebrx-panel-log"><img src="static/gfx/openwebrx-panel-log.png" /><br/>Log</div> <div class="button" data-toggle-panel="openwebrx-panel-log"><img src="static/gfx/openwebrx-panel-log.png" /><br/>Log</div>
<div class="button" data-toggle-panel="openwebrx-panel-receiver"><img src="static/gfx/openwebrx-panel-receiver.png" /><br/>Receiver</div> <div class="button" data-toggle-panel="openwebrx-panel-receiver"><img src="static/gfx/openwebrx-panel-receiver.png" /><br/>Receiver</div>
<a class="button" href="map" target="_blank"><img src="static/gfx/openwebrx-panel-map.png" /><br/>Map</a> <a class="button" href="map" target="_blank"><img src="static/gfx/openwebrx-panel-map.png" /><br/>Map</a>
<a class="button" href="admin" target="_blank"><img src="static/gfx/openwebrx-panel-settings.png" /><br/>Settings</a> ${settingslink}
</section> </section>
</div> </div>
<div id="webrx-rx-photo-title"></div> <div id="webrx-rx-photo-title"></div>

View File

@ -1,6 +1,7 @@
from . import Controller from . import Controller
import pkg_resources import pkg_resources
from string import Template from string import Template
from owrx.config import Config
class TemplateController(Controller): class TemplateController(Controller):
@ -19,7 +20,11 @@ class TemplateController(Controller):
class WebpageController(TemplateController): class WebpageController(TemplateController):
def template_variables(self): def template_variables(self):
header = self.render_template("include/header.include.html") settingslink = ""
pm = Config.get()
if "webadmin_enabled" in pm and pm["webadmin_enabled"]:
settingslink = """<a class="button" href="admin" target="_blank"><img src="static/gfx/openwebrx-panel-settings.png" /><br/>Settings</a>"""
header = self.render_template("include/header.include.html", settingslink=settingslink)
return {"header": header} return {"header": header}