2014-10-18 12:37:01 +02:00
|
|
|
var App = App || {};
|
|
|
|
App.Presenters = App.Presenters || {};
|
|
|
|
|
|
|
|
App.Presenters.HttpErrorPresenter = function(
|
2015-06-28 10:07:11 +02:00
|
|
|
jQuery,
|
|
|
|
promise,
|
|
|
|
util,
|
|
|
|
topNavigationPresenter) {
|
|
|
|
|
|
|
|
var $el = jQuery('#content');
|
|
|
|
var templates = {};
|
|
|
|
|
|
|
|
function init(params, loaded) {
|
|
|
|
topNavigationPresenter.changeTitle('Error ' + params.error);
|
|
|
|
|
|
|
|
if (params.error === 404) {
|
|
|
|
promise.wait(util.promiseTemplate('404'))
|
|
|
|
.then(function(template) {
|
|
|
|
templates.errorPage = template;
|
|
|
|
reinit(params, loaded);
|
|
|
|
}).fail(function() {
|
|
|
|
console.log(arguments);
|
|
|
|
loaded();
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
console.log('Not supported.');
|
|
|
|
loaded();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function reinit(params, loaded) {
|
|
|
|
render();
|
|
|
|
loaded();
|
|
|
|
}
|
|
|
|
|
|
|
|
function render() {
|
|
|
|
$el.html(templates.errorPage());
|
|
|
|
}
|
|
|
|
|
|
|
|
return {
|
|
|
|
init: init,
|
|
|
|
reinit: reinit,
|
|
|
|
render: render,
|
|
|
|
};
|
2014-10-18 12:37:01 +02:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
App.DI.register('httpErrorPresenter', ['jQuery', 'promise', 'util', 'topNavigationPresenter'], App.Presenters.HttpErrorPresenter);
|