Commit 7d9f91ca authored by Jonathon Duerig's avatar Jonathon Duerig

Add leave page warning to genilib-editor. Pointed edit button on manage_profile to genilib-editor.

parent 4d984597
......@@ -41,6 +41,7 @@ function (_, sup, aptforms,
editor.setValue(atob(source));
editor.selection.clearSelection();
$('#waitwait-modal').modal({ backdrop: 'static', keyboard: false, show: false });
$('#saveButton').on('click', save);
$('#loadButton').on('click', load);
$('#runButton').on('click', clickRun);
......@@ -87,6 +88,7 @@ function (_, sup, aptforms,
{
removeSplit();
}
window.onbeforeunload = beforeUnload;
}
function save()
......@@ -100,7 +102,9 @@ function (_, sup, aptforms,
a.href = window.URL.createObjectURL(file);
a.download = 'saved.py';
document.body.appendChild(a);
a.click(); $('a').last().remove();
a.click();
$('a').last().remove();
window.onbeforeunload = null;
}
}
......@@ -118,6 +122,7 @@ function (_, sup, aptforms,
var contents = e.target.result;
editor.setValue(contents);
editor.selection.clearSelection();
window.onbeforeunload = null;
removeSplit();
// jacksInput.trigger('change-topology', [{ rspec: contents }]);
};
......@@ -405,6 +410,12 @@ function (_, sup, aptforms,
$('#profile_description').prop("readonly", true);
$('#profile_submit_button').removeAttr('disabled');
$('#profile_submit_button').on('click', submitCreate);
// This activates the popover subsystem.
$('[data-toggle="popover"]').popover({
trigger: 'hover',
placement: 'auto',
container: 'body',
});
parseRspec();
}
......@@ -455,6 +466,12 @@ function (_, sup, aptforms,
$('#profile_submit_button').removeAttr('disabled');
$('#profile_submit_button').on('click', submitEdit);
$('#quickvm_create_profile_form').attr('action', 'manage_profile.php?uuid=' + window.PROFILE_LATEST_UUID);
// This activates the popover subsystem.
$('[data-toggle="popover"]').popover({
trigger: 'hover',
placement: 'auto',
container: 'body',
});
parseRspec();
}
......@@ -488,6 +505,11 @@ function (_, sup, aptforms,
}
}
function beforeUnload()
{
return 'You have unsaved changes!';
}
function submitEdit(event)
{
window.onbeforeunload = null;
......
......@@ -247,13 +247,8 @@ function (_, sup, filesize, JacksEditor, ShowImagingModal, moment, aptforms,
var source = $.trim($('#profile_script_textarea').val());
var type = "source";
if (source.length > 0 && false) {
if (modified)
{
$('#modified_modal').modal('show');
} else {
if (source.length > 0 && window.ACTION === 'edit') {
openEditor();
}
} else {
if (source.length === 0) {
source = $.trim($('#profile_rspec_textarea').val());
......@@ -498,7 +493,7 @@ function (_, sup, filesize, JacksEditor, ShowImagingModal, moment, aptforms,
// We also got a geni-lib script, so show the XML button.
if (gotscript) {
$('#show_xml_modal_button').removeClass("hidden");
$('#edit_copy_button').removeClass("hidden");
//$('#edit_copy_button').removeClass("hidden");
$('#profile_instructions').prop("readonly", true);
$('#profile_description').prop("readonly", 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