fixed confirmation dialog.

This commit is contained in:
Teja 2015-07-11 16:54:52 +02:00
parent 7dcf2f38e2
commit 7f5d45efdc
4 changed files with 13 additions and 11 deletions

View file

@ -631,19 +631,15 @@ $(function() {
self.jogDistanceInMM = ko.observable(undefined);
self.focus_on = function () {
$("#confirmation_dialog .confirmation_dialog_message").text(gettext("The laser will now be enabled. Protect yourself and everybody in the room appropriately before proceeding!"));
$("#confirmation_dialog .confirmation_dialog_acknowledge").unbind("click");
$("#confirmation_dialog .confirmation_dialog_acknowledge").click(
function (e) {
var callback = function (e) {
e.preventDefault();
$("#confirmation_dialog").modal("hide");
self.sendCustomCommand({type: 'commands', commands: ['M8', 'M3S10']});
setTimeout(function () { // switch focus off after 30 seconds for safety reasons.
self.focus_off();
}, 30000);
});
$("#confirmation_dialog").modal("show");
};
self.printerState.show_safety_glasses_warning(callback);
};
self.focus_off = function () {

View file

@ -190,7 +190,7 @@ $(function() {
self.show_safety_glasses_warning = function (callback) {
$('#confirmation_dialog .confirmation_dialog_message').html();
$('#confirmation_dialog .confirmation_dialog_message div').remove();
jQuery('<div/>', {
class: "safety_glasses_heads_up"
}).appendTo("#confirmation_dialog .confirmation_dialog_message");
@ -198,7 +198,6 @@ $(function() {
class: "safety_glasses_warning",
text: gettext("The laser will now start. Protect yourself and everybody in the room appropriately before proceeding!")
}).appendTo("#confirmation_dialog .confirmation_dialog_message");
//$("#confirmation_dialog .confirmation_dialog_message").text(gettext("The laser will now start. Protect yourself and everybody in the room appropriately before proceeding!"));
$("#confirmation_dialog .confirmation_dialog_acknowledge").unbind("click");
$("#confirmation_dialog .confirmation_dialog_acknowledge").click(
function (e) {

View file

@ -245,8 +245,14 @@ $(function() {
var parts = command.match(/^(M3|M03)(S[0-9.]+)?/i);
if (parts !== null) {
$("#confirmation_dialog .confirmation_dialog_message").text(gettext("The laser will now be enabled. Protect yourself and everybody in the room appropriately before proceeding!"));
$('#confirmation_dialog .confirmation_dialog_message div').remove();
jQuery('<div/>', {
class: "safety_glasses_heads_up"
}).appendTo("#confirmation_dialog .confirmation_dialog_message");
jQuery('<div/>', {
class: "safety_glasses_warning",
text: gettext("The laser will now start. Protect yourself and everybody in the room appropriately before proceeding!")
}).appendTo("#confirmation_dialog .confirmation_dialog_message");
$("#confirmation_dialog .confirmation_dialog_acknowledge").unbind("click");
$("#confirmation_dialog .confirmation_dialog_acknowledge").click(
function (e) {

View file

@ -6,6 +6,7 @@
<div class="modal-body">
<p class="confirmation_dialog_message"></p>
<p>{{ _('Are you sure you want to proceed?') }}</p>
<div style="clear:both"></div>
</div>
<div class="modal-footer">
<a href="#" class="btn" data-dismiss="modal" aria-hidden="true">{{ _('Cancel') }}</a>