Skip to content

Commit

Permalink
Merge pull request #28 from foosel/master
Browse files Browse the repository at this point in the history
Backwards compatible fix for #27
  • Loading branch information
imrahil authored Dec 5, 2017
2 parents 2274751 + 01b6439 commit 8fcc435
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
22 changes: 11 additions & 11 deletions octoprint_navbartemp/static/js/navbartemp.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,17 @@ $(function() {
self.raspiTemp = ko.observable();
self.isRaspi = ko.observable(false);

self.formatBarTemperature = function(toolName, actual, target) {
var output = toolName + ": " + _.sprintf("%.1f°C", actual);

if (target) {
var sign = (target >= actual) ? " \u21D7 " : " \u21D8 ";
output += sign + _.sprintf("%.1f°C", target);
}

return output;
};

self.onBeforeBinding = function () {
self.settings = self.global_settings.settings.plugins.navbartemp;
};
Expand All @@ -33,14 +44,3 @@ $(function() {
["#navbar_plugin_navbartemp", "#settings_plugin_navbartemp"]
]);
});

function formatBarTemperature(toolName, actual, target) {
var output = toolName + ": " + _.sprintf("%.1f°C", actual);

if (target) {
var sign = (target >= actual) ? " \u21D7 " : " \u21D8 ";
output += sign + _.sprintf("%.1f°C", target);
}

return output;
};
2 changes: 1 addition & 1 deletion octoprint_navbartemp/templates/navbartemp_navbar.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
</div>

<script type="text/html" id="navbartemp-template">
<span data-bind="html: formatBarTemperature(name(), actual(), target())"></span>
<span data-bind="html: $root.formatBarTemperature(name(), actual(), target())"></span>
</script>
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
plugin_identifier = "navbartemp"
plugin_package = "octoprint_%s" % plugin_identifier
plugin_name = "OctoPrint-NavbarTemp"
plugin_version = "0.8"
plugin_version = "0.9"
plugin_description = "Displays temperatures on navbar"
plugin_author = "Jarek Szczepanski"
plugin_author_email = "imrahil@imrahil.com"
Expand Down

0 comments on commit 8fcc435

Please sign in to comment.