|
@@ -15,7 +15,12 @@
|
|
|
|
|
|
<body>
|
|
|
<div id="page_info">Designer Block. Generated by BORA 0.0.1</div>
|
|
|
-<img src="{{ static_url('background.png') }}"></img>
|
|
|
+
|
|
|
+{% if "background" in data %}
|
|
|
+<img src="{{ static_url( data['background'] ) }}"></img>
|
|
|
+{% else %}
|
|
|
+<img src="{{ static_url( 'background.png' ) }}"></img>
|
|
|
+{% end %}
|
|
|
|
|
|
<button class="button showhide" onclick="showhide()">Show/Hide</button>
|
|
|
|
|
@@ -442,13 +447,22 @@ function mysave(data) {
|
|
|
header["title"] = $("#elem_title_text").val().trim();
|
|
|
//header["color"] = $(".title", "#"+key).css("color");
|
|
|
header["size"] = $("#elem_title_size").val();
|
|
|
- header["weight"] = $("#elem_title_style option:selected").val();
|
|
|
-
|
|
|
+ header["weight"] = $("#elem_title_style").val();
|
|
|
+
|
|
|
+ // update field
|
|
|
+ $(".title", "#"+key).text(header["title"]);
|
|
|
+ $(".title", "#"+key).css("font-size", header["size"] + "px");
|
|
|
+ $(".title", "#"+key).css("font-weight", header["weight"]);
|
|
|
+
|
|
|
unit = {};
|
|
|
unit["title"] = $("#elem_unit_text").val().trim();
|
|
|
//unit["color"] = $(".varval", "#"+key).css("color");
|
|
|
unit["size"] = $("#elem_unit_size").val();
|
|
|
- unit["weight"] = $("#elem_unit_style option:selected").val();
|
|
|
+ unit["weight"] = $("#elem_unit_style").val();
|
|
|
+ $(".varval", "#"+key).css("font-size", unit["size"] + "px");
|
|
|
+ $(".unit_title", "#"+key).css("font-size", unit["size"] + "px");
|
|
|
+ $(".unit_title", "#"+key).css("font-weight", unit["weight"]);
|
|
|
+ $(".varval", "#"+key).css("font-weight", unit["weight"]);
|
|
|
|
|
|
} else {
|
|
|
tmp["condition"] = $("#"+key).attr("data-cond");
|
|
@@ -461,24 +475,38 @@ function mysave(data) {
|
|
|
header = {};
|
|
|
header["title"] = $(".title", "#"+key).text();
|
|
|
//header["color"] = $(".title", "#"+key).css("color");
|
|
|
- header["size"] = $(".title", "#"+key).css("font-size");
|
|
|
- header["weight"] = $(".title", "#"+key).css("font-weight");
|
|
|
+ header["size"] = parseInt($(".title", "#"+key).css("font-size")) || 28;
|
|
|
+
|
|
|
+ var fontWeight = $(".title", "#"+key).css("font-weight");
|
|
|
+ if (fontWeight == 'bold' || fontWeight == '700') {
|
|
|
+ header["weight"] = "700";
|
|
|
+ } else {
|
|
|
+ header["weight"] = "400";
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
|
|
|
unit = {};
|
|
|
unit["title"] = $(".unit_title", "#"+key).text();
|
|
|
//unit["color"] = $(".varval", "#"+key).css("color");
|
|
|
- unit["size"] = $(".varval", "#"+key).css("font-size");
|
|
|
- unit["weight"] = $(".varval", "#"+key).css("font-weight");
|
|
|
+ unit["size"] = parseInt($(".varval", "#"+key).css("font-size")) || 28;
|
|
|
+
|
|
|
+ fontWeight = $(".varval", "#"+key).css("font-weight");
|
|
|
+ if (fontWeight == 'bold' || fontWeight == '700') {
|
|
|
+ unit["weight"] = "700";
|
|
|
+ } else {
|
|
|
+ unit["weight"] = "400";
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
tmp["header"] = header;
|
|
|
tmp["unit"] = unit;
|
|
|
- } else if ( $("#"+key).attr("data-type") == "header" ) {
|
|
|
- header = {};
|
|
|
- header["title"] = $(".title", "#"+key).text();
|
|
|
- header["size"] = $(".title", "#"+key).css("font-size");
|
|
|
- header["weight"] = $(".title", "#"+key).css("font-weight");
|
|
|
- tmp["header"] = header;
|
|
|
+ //} else if ( $("#"+key).attr("data-type") == "header" ) {
|
|
|
+ // header = {};
|
|
|
+ // header["title"] = $(".title", "#"+key).text();
|
|
|
+ // header["size"] = $(".title", "#"+key).css("font-size");
|
|
|
+ // header["weight"] = $(".title", "#"+key).css("font-weight");
|
|
|
+ // tmp["header"] = header;
|
|
|
} else if ( $("#"+key).attr("data-type") == "ventil" ) {
|
|
|
if ((varname == key) && (varattr == "normal")) {
|
|
|
var unit_text = $("#elem_unit_text").val();
|
|
@@ -502,7 +530,7 @@ function mysave(data) {
|
|
|
header = {};
|
|
|
header["title"] = $("#elem_title_text").val().trim();
|
|
|
header["size"] = $("#elem_title_size").val();
|
|
|
- header["weight"] = $("#elem_title_style option:selected").val();
|
|
|
+ header["weight"] = $("#elem_title_style").val();
|
|
|
|
|
|
unit = {};
|
|
|
//unit["color"] = $(".varval", "#"+key).css("color");
|
|
@@ -571,12 +599,21 @@ function mysave(data) {
|
|
|
header["size"] = $("#elem_title_size").val();
|
|
|
header["weight"] = $("#elem_title_style option:selected").val();
|
|
|
|
|
|
+ // update field
|
|
|
+ $(".title", "#"+key).css("font-size", header["size"] + "px");
|
|
|
+ $(".title", "#"+key).css("font-weight", header["weight"] + "px");
|
|
|
+
|
|
|
unit = {};
|
|
|
unit["title"] = $("#elem_unit_text").val().trim();
|
|
|
//unit["color"] = $(".varval", "#"+key).css("color");
|
|
|
unit["size"] = $("#elem_unit_size").val();
|
|
|
unit["weight"] = $("#elem_unit_style option:selected").val();
|
|
|
|
|
|
+ // update field
|
|
|
+ $(".varval", "#"+key).css("font-size", unit["size"] + "px");
|
|
|
+ $(".unit_title", "#"+key).css("font-size", unit["size"] + "px");
|
|
|
+ $(".varval", "#"+key).css("font-weight", unit["weight"] + "px");
|
|
|
+
|
|
|
} else {
|
|
|
tmp["condition"] = $("#"+key).attr("data-cond");
|
|
|
tmp["formula"] = $("#"+key).attr("data-formula");
|
|
@@ -588,24 +625,24 @@ function mysave(data) {
|
|
|
header = {};
|
|
|
header["title"] = $(".title", "#"+key).text();
|
|
|
//header["color"] = $(".title", "#"+key).css("color");
|
|
|
- header["size"] = $(".title", "#"+key).css("font-size");
|
|
|
- header["weight"] = $(".title", "#"+key).css("font-weight");
|
|
|
+ header["size"] = parseInt($(".title", "#"+key).css("font-size")) || 28;
|
|
|
+ header["weight"] = parseInt($(".title", "#"+key).css("font-weight")) || 28;
|
|
|
|
|
|
unit = {};
|
|
|
unit["title"] = $(".unit_title", "#"+key).text();
|
|
|
//unit["color"] = $(".varval", "#"+key).css("color");
|
|
|
- unit["size"] = $(".varval", "#"+key).css("font-size");
|
|
|
- unit["weight"] = $(".varval", "#"+key).css("font-weight");
|
|
|
+ unit["size"] = parseInt($(".varval", "#"+key).css("font-size")) || 28;
|
|
|
+ unit["weight"] = parseInt($(".varval", "#"+key).css("font-weight")) || 28;
|
|
|
}
|
|
|
|
|
|
tmp["header"] = header;
|
|
|
tmp["unit"] = unit;
|
|
|
- } else if ( $("#"+key).attr("data-type") == "header" ) {
|
|
|
- header = {};
|
|
|
- header["title"] = $(".title", "#"+key).text();
|
|
|
- header["size"] = $(".title", "#"+key).css("font-size");
|
|
|
- header["weight"] = $(".title", "#"+key).css("font-weight");
|
|
|
- tmp["header"] = header;
|
|
|
+ //} else if ( $("#"+key).attr("data-type") == "header" ) {
|
|
|
+ // header = {};
|
|
|
+ // header["title"] = $(".title", "#"+key).text();
|
|
|
+ // header["size"] = $(".title", "#"+key).css("font-size");
|
|
|
+ // header["weight"] = $(".title", "#"+key).css("font-weight");
|
|
|
+ // tmp["header"] = header;
|
|
|
} else if ( $("#"+key).attr("data-type") == "ventil" ) {
|
|
|
if (varname == key) {
|
|
|
var unit_text = $("#elem_unit_text").val();
|
|
@@ -676,11 +713,24 @@ function mysave(data) {
|
|
|
//header["color"] = $(".title", "#"+key).css("color");
|
|
|
header["size"] = $("#elem_title_size").val();
|
|
|
header["weight"] = $("#elem_title_style option:selected").val();
|
|
|
+
|
|
|
+ // update field
|
|
|
+ $(".title", "#"+hkey).css("font-size", header["size"] + "px");
|
|
|
+ $(".title", "#"+hkey).css("font-weight", header["weight"]);
|
|
|
+
|
|
|
+
|
|
|
} else {
|
|
|
header["title"] = $(".title", "#"+hkey).text();
|
|
|
//header["color"] = $(".title", "#"+hkey).css("color");
|
|
|
- header["size"] = $(".title", "#"+hkey).css("font-size");
|
|
|
- header["weight"] = $(".title", "#"+hkey).css("font-weight");
|
|
|
+ header["size"] = parseInt($(".title", "#"+hkey).css("font-size")) || 28;
|
|
|
+ header["weight"] = parseInt($(".title", "#"+hkey).css("font-weight")) || 28;
|
|
|
+
|
|
|
+ var fontWeight = $(".title", "#"+hkey).css("font-weight");
|
|
|
+ if (fontWeight == 'bold' || fontWeight == '700') {
|
|
|
+ header["weight"] = "700";
|
|
|
+ } else {
|
|
|
+ header["weight"] = "400";
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
tmp["header"] = header;
|
|
@@ -746,10 +796,10 @@ function mysave(data) {
|
|
|
}
|
|
|
});
|
|
|
|
|
|
- //console.log("Check here");
|
|
|
+ console.log("Check here");
|
|
|
//console.log(position);
|
|
|
var dataToSend = JSON.stringify(position);
|
|
|
- //console.log(dataToSend);
|
|
|
+ console.log(dataToSend);
|
|
|
$.ajax({
|
|
|
url: '/save/',
|
|
|
type: 'POST',
|
|
@@ -784,6 +834,18 @@ function highlight(mydata) {
|
|
|
if (vartype == "header") {
|
|
|
$("#elem_title_text").val($("#"+varname + " .title").text());
|
|
|
$("#elem_title_size").val(parseInt($("#"+varname + " .title").css("font-size")));
|
|
|
+
|
|
|
+ $("#elem_title_style").val("400");
|
|
|
+ var fontWeight = $("#"+varname + " .title").css("font-weight");
|
|
|
+ if (fontWeight == 'bold' || fontWeight == '700') {
|
|
|
+ $("#elem_title_style").val("700");
|
|
|
+ }
|
|
|
+
|
|
|
+ $("#elem_unit_style").val("400");
|
|
|
+ var fontWeight = $("#"+varname + " .varval").css("font-weight");
|
|
|
+ if (fontWeight == 'bold' || fontWeight == '700') {
|
|
|
+ $("#elem_unit_style").val("700");
|
|
|
+ }
|
|
|
} else if (vartype == "data") {
|
|
|
$("#elem_title_text").val($("#"+varname + " .title").text().trim());
|
|
|
$("#elem_title_size").val("");
|
|
@@ -811,6 +873,20 @@ function highlight(mydata) {
|
|
|
if ($("#"+varname).attr("data-formula") ) {
|
|
|
$("#elem_formula").val($("#"+varname).attr("data-formula"));
|
|
|
}
|
|
|
+
|
|
|
+ $("#elem_title_style").val("400");
|
|
|
+ var fontWeight = $("#"+varname + " .title").css("font-weight");
|
|
|
+ if (fontWeight == 'bold' || fontWeight == '700') {
|
|
|
+ $("#elem_title_style").val("700");
|
|
|
+ }
|
|
|
+
|
|
|
+ $("#elem_unit_style").val("400");
|
|
|
+ var fontWeight = $("#"+varname + " .varval").css("font-weight");
|
|
|
+ if (fontWeight == 'bold' || fontWeight == '700') {
|
|
|
+ $("#elem_unit_style").val("700");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
} else if (vartype == "calc") {
|
|
|
var vid = varname.split("_");
|
|
|
vid = vid[1];
|