laser safety notes appear and are closable
This commit is contained in:
parent
e4cc81d643
commit
0e829e8e9d
2 changed files with 21 additions and 8 deletions
|
|
@ -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):
|
||||
|
|
|
|||
|
|
@ -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")]);
|
||||
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue