mirror of
https://github.com/Manuel83/craftbeerpi3
synced 2026-08-10 02:55:27 +02:00
-Custom Web View Examples Added
-UI Adjustment for small screens. Brew Steps are displayed above the kettles. -
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
from flask import Blueprint
|
||||
|
||||
from modules.core.core import cbpi, addon
|
||||
from flask_swagger import swagger
|
||||
from flask import json
|
||||
from flask import Blueprint
|
||||
|
||||
@addon.core.initializer(order=22)
|
||||
def web(cbpi):
|
||||
|
||||
s = Blueprint('web_view', __name__, template_folder='templates', static_folder='static')
|
||||
|
||||
@s.route('/', methods=["GET"])
|
||||
def index():
|
||||
return s.send_static_file("index.html")
|
||||
|
||||
print "REGISTER"
|
||||
cbpi.addon.core.add_menu_link("JQuery View", "/web_view")
|
||||
cbpi._app.register_blueprint(s, url_prefix='/web_view')
|
||||
@@ -0,0 +1,32 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
|
||||
<title>CraftBeerPi WebView</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="root" >
|
||||
|
||||
|
||||
<div id="kettle">
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<!--script src="static/bundle.js" type="text/javascript"></script-->
|
||||
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$.ajax({
|
||||
url: "/api/system/dump",
|
||||
dataType: "json"
|
||||
}).then(function(data) {
|
||||
$.each(data.actors, function (i, val) {
|
||||
$( "#kettle" ).append("<div>"+ val.name +"</div>")
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user