inline header variables
This commit is contained in:
parent
7f9c0539bb
commit
48a9c76c18
@ -3,8 +3,8 @@
|
||||
<a href="https://www.openwebrx.de/" target="_blank"><img src="${assets_prefix}static/gfx/openwebrx-top-logo.png" class="webrx-top-logo" alt="OpenWebRX Logo"/></a>
|
||||
<img class="webrx-rx-avatar openwebrx-photo-trigger" src="${assets_prefix}static/gfx/openwebrx-avatar.png" alt="Receiver avatar"/>
|
||||
<div class="webrx-rx-texts openwebrx-photo-trigger">
|
||||
<div class="webrx-rx-title"></div>
|
||||
<div class="webrx-rx-desc"></div>
|
||||
<div class="webrx-rx-title">${receiver_name}</div>
|
||||
<div class="webrx-rx-desc">${receiver_location} | Loc: ${locator}, ASL: ${receiver_asl} m</div>
|
||||
</div>
|
||||
<section class="openwebrx-main-buttons">
|
||||
<div class="button" data-toggle-panel="openwebrx-panel-status"><span class="sprite sprite-panel-status"></span><br/>Status</div>
|
||||
@ -15,8 +15,8 @@
|
||||
</section>
|
||||
</div>
|
||||
<div class="openwebrx-description-container">
|
||||
<div class="webrx-rx-photo-title"></div>
|
||||
<div class="webrx-rx-photo-desc"></div>
|
||||
<div class="webrx-rx-photo-title">${photo_title}</div>
|
||||
<div class="webrx-rx-photo-desc">${photo_desc}</div>
|
||||
</div>
|
||||
<a class="openwebrx-rx-details-arrow openwebrx-rx-details-arrow--down openwebrx-photo-trigger"><span class="sprite sprite-rx-details-arrow"></span></a>
|
||||
</div>
|
||||
|
@ -11,7 +11,6 @@ function Header(el) {
|
||||
});
|
||||
|
||||
this.init_rx_photo();
|
||||
this.download_details();
|
||||
};
|
||||
|
||||
Header.prototype.setDetails = function(details) {
|
||||
@ -56,14 +55,6 @@ Header.prototype.toggle_rx_photo = function(ev) {
|
||||
}
|
||||
};
|
||||
|
||||
Header.prototype.download_details = function() {
|
||||
var self = this;
|
||||
// TODO: make this use a relative URL again
|
||||
$.ajax('/api/receiverdetails').done(function(data){
|
||||
self.setDetails(data);
|
||||
});
|
||||
};
|
||||
|
||||
$.fn.header = function() {
|
||||
if (!this.data('header')) {
|
||||
this.data('header', new Header(this));
|
||||
|
@ -1,6 +1,5 @@
|
||||
from . import Controller
|
||||
from owrx.feature import FeatureDetector
|
||||
from owrx.details import ReceiverDetails
|
||||
import json
|
||||
|
||||
|
||||
@ -8,8 +7,3 @@ class ApiController(Controller):
|
||||
def indexAction(self):
|
||||
data = json.dumps(FeatureDetector().feature_report())
|
||||
self.send_response(data, content_type="application/json")
|
||||
|
||||
def receiverDetails(self):
|
||||
receiver_details = ReceiverDetails()
|
||||
data = json.dumps(receiver_details.__dict__())
|
||||
self.send_response(data, content_type="application/json")
|
||||
|
@ -1,6 +1,7 @@
|
||||
from . import Controller
|
||||
import pkg_resources
|
||||
from owrx.controllers import Controller
|
||||
from owrx.details import ReceiverDetails
|
||||
from string import Template
|
||||
import pkg_resources
|
||||
|
||||
|
||||
class TemplateController(Controller):
|
||||
@ -19,7 +20,9 @@ class TemplateController(Controller):
|
||||
|
||||
class WebpageController(TemplateController):
|
||||
def header_variables(self):
|
||||
return {"assets_prefix": ""}
|
||||
variables = {"assets_prefix": ""}
|
||||
variables.update(ReceiverDetails().__dict__())
|
||||
return variables
|
||||
|
||||
def template_variables(self):
|
||||
header = self.render_template("include/header.include.html", **self.header_variables())
|
||||
|
@ -108,7 +108,6 @@ class Router(object):
|
||||
StaticRoute("/map", MapController),
|
||||
StaticRoute("/features", FeatureController),
|
||||
StaticRoute("/api/features", ApiController),
|
||||
StaticRoute("/api/receiverdetails", ApiController, options={"action": "receiverDetails"}),
|
||||
StaticRoute("/metrics", MetricsController, options={"action": "prometheusAction"}),
|
||||
StaticRoute("/metrics.json", MetricsController),
|
||||
StaticRoute("/settings", SettingsController),
|
||||
|
Loading…
Reference in New Issue
Block a user