Commit b01b115d authored by Benjamin Fischer's avatar Benjamin Fischer
Browse files

Updated continuing of last save session: by default ask what to do and provide...

Updated continuing of last save session: by default ask what to do and provide an option to make the choice the default behaviour.
parent de2d8e5a
......@@ -30,7 +30,7 @@ define([
descr: "Continue the last saved session for a workspace upon connection.",
selection: ["always", "ask", "never"],
type: "string",
value: "never"
value: "ask"
}
}, { title: "Workspace Handler" });
......@@ -883,6 +883,14 @@ define([
if (state && state.centerView) {
var loader = function(confirmed) {
// Dialog was shown
if (this instanceof Dialog) {
this.close();
if (this.$footer.find("input")[0].checked) {
vispa.workspaces.preferences.continueSession = confirmed ? "always" : "never";
vispa.workspaces.pushPreferences();
}
}
if (confirmed) {
// we can't do this all in one run or we'll kill the browser
self.setLoading(true);
......@@ -916,7 +924,45 @@ define([
switch(vispa.workspaces.preferences.continueSession || "never") {
case "ask":
this.confirm("Do you want to load the last saved session?", loader);
var dialog = new Dialog();
var opts = {};
opts.header = "<i class='glyphicon glyphicon-question-sign'></i> Confirm";
opts.body = "Do you want to load the last saved session?";
opts.wrapBody = true;
opts.footer = [
$('<div class="checkbox"><label><input type="checkbox"> Remember choice</label></div>').css({
display: "inline-block",
float: "left"
}).tooltip({
title: "This setting can be changed any time in the Preferences.",
placement: "right",
delay: {
show: 300,
hide: 0
}
}),
Dialog._makeButton(dialog, {
label: "No",
callback: loader.bind(dialog, false),
}),
Dialog._makeButton(dialog, {
label: "Yes",
className: "btn-primary",
callback: loader.bind(dialog, true),
})
];
opts.wrapFooter = true;
dialog.on("show", function() {
dialog.$footer.find("button.btn-primary").focus();
});
dialog.setOptions(opts);
dialog.show();
break;
case "always":
loader(true);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment