11
return(declare(null, {
19
unsavedChanges: false,
21
// Areas can know about their parents to trigger results and other fun stuff on them.
22
// ToDo: Consider how this can be de-coupled?
25
constructor: function (controller, previousArea) {
27
// Store the reference to the controller we're operating under.
28
this.controller = controller;
29
this.previousArea = previousArea || null;
33
getLabel: function () {
37
getSlug: function () {
41
// Returns the widget this Area wants to be represented by.
42
getWidget: function () {
46
// Returns all widgets this Area makes use of.
47
getWidgets: function () {
50
// Called before the Area is shown?
51
beforeShow: function () {
57
if(this.unsavedChanges) {
59
console.log("Praxis: Unsaved changes, prompting!");
61
// Dijit style, but this has to be async...
62
//var unsavedPrompt = new Dialog({
63
// title: "Unsaved Changes",
64
// content: "You have unsaved changes. Are you sure you want to leave?"
66
//unsavedPrompt.show();
68
// Figure out a way to switch to async confirmation!!
69
if(!confirm("You have unsaved changes. Are you sure you want to leave?")) {
75
// Only modal Areas actually get destroyed.
78
console.log("Praxis: Destroying modal Area.");
81
this.controller.removeArea(this, this.previousArea);
82
this.widget.destroyRecursive();
83
this.widget.destroy();