diff --git a/src/octoprint/plugins/laser_safety_notes/__init__.py b/src/octoprint/plugins/laser_safety_notes/__init__.py index 3e285966..f6a6cdd4 100644 --- a/src/octoprint/plugins/laser_safety_notes/__init__.py +++ b/src/octoprint/plugins/laser_safety_notes/__init__.py @@ -48,7 +48,7 @@ class LaserSafetyNotesPlugin(octoprint.plugin.SettingsPlugin, def on_settings_load(self): cfg = dict( - current_profile_id=s.get(["agreed_to_safety_notes"]), + has_agreed = s.get(["agreed_to_safety_notes"]), ) return cfg @@ -60,7 +60,11 @@ class LaserSafetyNotesPlugin(octoprint.plugin.SettingsPlugin, ##~~ TemplatePlugin API def get_template_vars(self): - d = dict() + clazz = "show" + if(s.get(["agreed_to_safety_notes"])): + clazz = "hide" + d = dict(has_agreed_class = clazz) + print("foo", d) return d def get_template_folder(self): diff --git a/src/octoprint/plugins/laser_safety_notes/static/js/laserSafetyNotes.js b/src/octoprint/plugins/laser_safety_notes/static/js/laserSafetyNotes.js index c0aa35a6..2620848e 100644 --- a/src/octoprint/plugins/laser_safety_notes/static/js/laserSafetyNotes.js +++ b/src/octoprint/plugins/laser_safety_notes/static/js/laserSafetyNotes.js @@ -4,20 +4,29 @@ $(function() { var self = this; self.settings = params[0]; + self.s = ko.observable(self.settings.settings); + + self.agreed_to_safety_notes = ko.computed(function(){ + console.log(self.s()); +// if(self.s && self.s().plugins) +// return self.s.plugins.laser_safety_notes; + return false; + }); self.onStartup = function(){ -// self.requestData(); -// self.control.showZAxis = ko.computed(function(){ -// var has = self.currentProfileData()['zAxis'](); -// return has; -// }); // dependency injection + $('#laser_safety_overlay').modal("show"); + console.log("settings", self.settings.settings); }; + + self.agree = function(){ + $('#laser_safety_overlay').modal("hide"); + } } // view model class, identifier, parameters for constructor, container to bind to ADDITIONAL_VIEWMODELS.push([LaserSafetyNotesViewModel, ["settingsViewModel"], - document.getElementById("laser_safety_notes")]); + document.getElementById("laser_safety_overlay")]); });