Add history api and modify js for tests

All JS Files now call 'requirejs' instead of 'require', also
the holder.js reference is removed and the history api added.
Tests are following in the next commit

refs #4303
refs #4315
This commit is contained in:
Jannis Moßhammer 2013-06-17 17:13:30 +02:00 committed by Marius Hein
parent b46dd9bae4
commit 0694973c88
4 changed files with 24 additions and 12 deletions

View File

@ -34,14 +34,14 @@
}
target.focus();
this.initializeContainers(target);
holder.run();
};
this.updateControlTargets = function(ctrl, req) {
$('a',ctrl).each(function() {
$(this).attr("href",req.url);
});
holder.run();
};
this.initControlBehaviour = function(root) {
@ -86,7 +86,7 @@
this.initExpandables(root);
this.drawImplicitWidgets(root);
this.loadAsyncContainers(root);
holder.run();
};
this.createPopupContainer = function(content,req) {
@ -96,7 +96,7 @@
.append($("<div>").addClass('modal-body').html(content)).appendTo(document.body);
closeButton.on("click",function() {container.remove();});
holder.run();
};
this.getContainer = function(id) {
@ -104,11 +104,11 @@
};
};
define(['jquery','logging','icinga/widgets/checkIcons','icinga/widgets/subTable','Holder'],function($,log,widgets,subTable,holder) {
define(['jquery','logging','icinga/widgets/checkIcons','icinga/widgets/subTable'], function($,log,widgets,subTable) {
if (containerMgrInstance === null) {
containerMgrInstance = new ContainerMgr($,log,widgets,subTable,holder);
containerMgrInstance = new ContainerMgr($,log,widgets,subTable);
}
return containerMgrInstance;
});
})();
})();

View File

@ -67,7 +67,13 @@ define([
loadIntoContainer: function(ctr) {
},
loadUrl: function(url, target, params) {
target = target || "icinga-main";
async.loadToTarget(target, url, params);
History.pushState(params, document.title, url);
},
getFailedModules: function() {
return failedModules;
}

View File

@ -3,7 +3,7 @@
"use strict";
var asyncMgrInstance = null;
define(['icinga/container','logging','icinga/behaviour','jquery'],function(containerMgr,log,behaviour,$) {
define(['icinga/container','logging','jquery'],function(containerMgr,log,$) {
var pending = {
@ -21,7 +21,6 @@
};
var handleResponse = function(html) {
if(this.destination) {
containerMgr.updateContainer(this.destination,html,this);
} else {
@ -94,7 +93,13 @@
});
req.destination = destination;
}
if (destination == "icinga-main") {
History.pushState(data, document.title, url);
} else {
data = data || {};
data[destination] = url;
History.pushState(data, document.title, document.location.href);
}
return req;
};
@ -106,4 +111,4 @@
return new CallInterface();
});
})();
})();

1
public/js/vendor/history.js vendored Normal file

File diff suppressed because one or more lines are too long