#18937: Adding a confirmation dialog when try to leave navigation with pending changes

Work Item: 18937

--HG--
branch : 1.x
This commit is contained in:
Sebastien Ros
2012-09-19 16:58:49 -07:00
parent 36420c02c6
commit 735a6487cc
2 changed files with 21 additions and 2 deletions

View File

@@ -38,8 +38,19 @@
// update all positions whenever a menu item was moved
populate(this, '');
$('#save-message').show();
// display a message on leave if changes have been made
window.onbeforeunload = function (e) {
return leaveConfirmation;
};
// cancel leaving message on save
$('#saveButton').click(function (e) {
window.onbeforeunload = function () { };
});
}
});
})(jQuery);
})(jQuery);

View File

@@ -67,7 +67,7 @@
</div>
<fieldset class="actions">
<button type="submit" class="button">@T("Save All")</button>
<button id="saveButton" type="submit" class="button">@T("Save All")</button>
</fieldset>
}
@@ -126,3 +126,11 @@
}
@:</ol>
}
@using (Script.Foot()) {
<script type="text/javascript">
//<![CDATA[
var leaveConfirmation = '@T("Some items where not saved.")';
//]]>
</script>
}