(WIP) Added spinner (#39)

This commit is contained in:
Marcin Kurczewski 2014-09-17 22:37:49 +02:00
parent a16a2d3235
commit eb7c507359
21 changed files with 310 additions and 221 deletions

View file

@ -52,3 +52,22 @@ hr {
background: #f3f7f8; background: #f3f7f8;
color: #7a9 !important; color: #7a9 !important;
} }
#wait-cover {
display: flex;
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
width: 100%;
height: 100%;
background: rgba(255, 255, 255, 0.9);
z-index: 100;
}
#wait .spinner {
margin: auto;
}
#wait .spinner .fa {
font-size: 40px;
}

View file

@ -42,6 +42,15 @@
</div> </div>
</div> </div>
<div id="wait">
<div id="wait-cover">
<div class="spinner">
<i class="fa fa-spin fa-circle-o-notch"></i>
<p>Loading</p>
</div>
</div>
</div>
<!-- build:template <!-- build:template
<% _.each(templates, function(templateString, templateName) { %> <% _.each(templates, function(templateString, templateName) { %>
<script type="text/template" id="<%= templateName %>-template"> <script type="text/template" id="<%= templateName %>-template">

View file

@ -1,36 +1,60 @@
var App = App || {}; var App = App || {};
App.PresenterManager = function(topNavigationPresenter) { App.PresenterManager = function(jQuery, topNavigationPresenter) {
var lastContentPresenterName; var lastContentPresenter = null;
var lastContentPresenter; var $spinner;
var spinnerTimeout;
function init() { function init() {
initPresenter('topNavigationPresenter'); initPresenter(topNavigationPresenter, [], function() {});
$spinner = jQuery('body').find('#wait');
} }
function initPresenter(presenterName, args) { function initPresenter(presenter, args, loaded) {
var presenter = App.DI.get(presenterName); presenter.init.call(presenter, args, loaded);
presenter.init.call(presenter, args);
} }
function switchContentPresenter(presenterName, args) { function switchContentPresenter(presenter, args) {
if (lastContentPresenterName !== presenterName) { var contentPresenterLoaded = function() {
window.clearTimeout(spinnerTimeout);
$spinner.hide();
};
spinnerTimeout = window.setTimeout(function() {
$spinner.stop().fadeIn('slow');
}, 300);
if (lastContentPresenter === null || lastContentPresenter.name !== presenter.name) {
topNavigationPresenter.changeTitle(null); topNavigationPresenter.changeTitle(null);
var presenter = App.DI.get(presenterName); presenter.init.call(presenter, args, contentPresenterLoaded);
presenter.init.call(presenter, args);
lastContentPresenterName = presenterName;
lastContentPresenter = presenter; lastContentPresenter = presenter;
} else if (lastContentPresenter.reinit) { } else if (lastContentPresenter.reinit) {
lastContentPresenter.reinit.call(lastContentPresenter, args); lastContentPresenter.reinit.call(lastContentPresenter, args, contentPresenterLoaded);
}
}
function initPresenters(options, loaded) {
var count = 0;
var subPresenterLoaded = function() {
count ++;
if (count === options.length) {
loaded();
}
};
for (var i = 0; i < options.length; i ++) {
initPresenter(options[i][0], options[i][1], subPresenterLoaded);
} }
} }
return { return {
init: init, init: init,
initPresenter: initPresenter,
initPresenters: initPresenters,
switchContentPresenter: switchContentPresenter, switchContentPresenter: switchContentPresenter,
}; };
}; };
App.DI.registerSingleton('presenterManager', ['topNavigationPresenter'], App.PresenterManager); App.DI.registerSingleton('presenterManager', ['jQuery', 'topNavigationPresenter'], App.PresenterManager);

View file

@ -7,10 +7,11 @@ App.Presenters.CommentListPresenter = function(
var $el = jQuery('#content'); var $el = jQuery('#content');
function init(args) { function init(args, loaded) {
topNavigationPresenter.select('comments'); topNavigationPresenter.select('comments');
topNavigationPresenter.changeTitle('Comments'); topNavigationPresenter.changeTitle('Comments');
render(); render();
loaded();
} }
function render() { function render() {

View file

@ -7,10 +7,11 @@ App.Presenters.HelpPresenter = function(
var $el = jQuery('#content'); var $el = jQuery('#content');
function init(args) { function init(args, loaded) {
topNavigationPresenter.select('help'); topNavigationPresenter.select('help');
topNavigationPresenter.changeTitle('Help'); topNavigationPresenter.changeTitle('Help');
render(); render();
loaded();
} }
function render() { function render() {

View file

@ -7,10 +7,11 @@ App.Presenters.HomePresenter = function(
var $el = jQuery('#content'); var $el = jQuery('#content');
function init(args) { function init(args, loaded) {
topNavigationPresenter.select('home'); topNavigationPresenter.select('home');
topNavigationPresenter.changeTitle('Home'); topNavigationPresenter.changeTitle('Home');
render(); render();
loaded();
} }
function render() { function render() {

View file

@ -16,17 +16,19 @@ App.Presenters.LoginPresenter = function(
var template; var template;
var previousRoute; var previousRoute;
function init(args) { function init(args, loaded) {
topNavigationPresenter.select('login'); topNavigationPresenter.select('login');
topNavigationPresenter.changeTitle('Login'); topNavigationPresenter.changeTitle('Login');
previousRoute = args.previousRoute; previousRoute = args.previousRoute;
promise.wait(util.promiseTemplate('login-form')).then(function(html) { promise.wait(util.promiseTemplate('login-form'))
.then(function(html) {
template = _.template(html); template = _.template(html);
if (auth.isLoggedIn()) { if (auth.isLoggedIn()) {
finishLogin(); finishLogin();
} else { } else {
render(); render();
} }
loaded();
}); });
} }

View file

@ -11,14 +11,17 @@ App.Presenters.LogoutPresenter = function(
var $messages = jQuery('#content'); var $messages = jQuery('#content');
function init() { function init(args, loaded) {
topNavigationPresenter.select('logout'); topNavigationPresenter.select('logout');
topNavigationPresenter.changeTitle('Logout'); topNavigationPresenter.changeTitle('Logout');
promise.wait(auth.logout()).then(function() { promise.wait(auth.logout())
.then(function() {
loaded();
$messages.empty(); $messages.empty();
var $messageDiv = messagePresenter.showInfo($messages, 'Logged out. <a href="">Back to main page</a>'); var $messageDiv = messagePresenter.showInfo($messages, 'Logged out. <a href="">Back to main page</a>');
$messageDiv.find('a').click(mainPageLinkClicked); $messageDiv.find('a').click(mainPageLinkClicked);
}).fail(function(response) { }).fail(function(response) {
loaded();
messagePresenter.showError(($messages, response.json && response.json.error || response) + '<br/>Reload the page to continue.'); messagePresenter.showError(($messages, response.json && response.json.error || response) + '<br/>Reload the page to continue.');
}); });
} }

View file

@ -24,7 +24,7 @@ App.Presenters.PagedCollectionPresenter = function(
var updateCallback; var updateCallback;
var failCallback; var failCallback;
function init(args) { function init(args, loaded) {
forceClear = !_.isEqual(args.searchParams, searchParams) || parseInt(args.page) !== pageNumber + 1; forceClear = !_.isEqual(args.searchParams, searchParams) || parseInt(args.page) !== pageNumber + 1;
searchParams = args.searchParams; searchParams = args.searchParams;
pageNumber = parseInt(args.page) || 1; pageNumber = parseInt(args.page) || 1;
@ -34,9 +34,12 @@ App.Presenters.PagedCollectionPresenter = function(
updateCallback = args.updateCallback; updateCallback = args.updateCallback;
failCallback = args.failCallback; failCallback = args.failCallback;
promise.wait(util.promiseTemplate('pager')).then(function(html) { promise.wait(util.promiseTemplate('pager'))
.then(function(html) {
template = _.template(html); template = _.template(html);
softChangePage(pageNumber); softChangePage(pageNumber)
.then(loaded)
.fail(loaded);
if (!endlessScroll) { if (!endlessScroll) {
mousetrap.bind('a', function(e) { mousetrap.bind('a', function(e) {
@ -82,9 +85,11 @@ App.Presenters.PagedCollectionPresenter = function(
function softChangePage(newPageNumber) { function softChangePage(newPageNumber) {
pageNumber = newPageNumber; pageNumber = newPageNumber;
return promise.make(function(resolve, reject) {
promise.wait( promise.wait(
api.get(backendUri, _.extend({}, searchParams, {page: pageNumber}))) api.get(backendUri, _.extend({}, searchParams, {page: pageNumber})))
.then(function(response) { .then(function(response) {
resolve(response);
var pageSize = response.json.pageSize; var pageSize = response.json.pageSize;
var totalRecords = response.json.totalRecords; var totalRecords = response.json.totalRecords;
totalPages = Math.ceil(totalRecords / pageSize); totalPages = Math.ceil(totalRecords / pageSize);
@ -97,12 +102,14 @@ App.Presenters.PagedCollectionPresenter = function(
render($target); render($target);
}).fail(function(response) { }).fail(function(response) {
reject(response);
if (typeof(failCallback) !== 'undefined') { if (typeof(failCallback) !== 'undefined') {
failCallback(response); failCallback(response);
} else { } else {
console.log(new Error(response.json && response.json.error || response)); console.log(new Error(response.json && response.json.error || response));
} }
}); });
});
} }
function render($target) { function render($target) {

View file

@ -16,30 +16,31 @@ App.Presenters.PostListPresenter = function(
var listTemplate; var listTemplate;
var itemTemplate; var itemTemplate;
function init(args) { function init(args, loaded) {
topNavigationPresenter.select('posts'); topNavigationPresenter.select('posts');
topNavigationPresenter.changeTitle('Posts'); topNavigationPresenter.changeTitle('Posts');
promise.waitAll( promise.waitAll(
util.promiseTemplate('post-list'), util.promiseTemplate('post-list'),
util.promiseTemplate('post-list-item')).then(function(listHtml, itemHtml) { util.promiseTemplate('post-list-item'))
.then(function(listHtml, itemHtml) {
listTemplate = _.template(listHtml); listTemplate = _.template(listHtml);
itemTemplate = _.template(itemHtml); itemTemplate = _.template(itemHtml);
render(); render();
reinit(args); reinit(args, loaded);
}); });
} }
function reinit(args) { function reinit(args, loaded) {
var searchArgs = util.parseComplexRouteArgs(args.searchArgs); var searchArgs = util.parseComplexRouteArgs(args.searchArgs);
searchArgs.order = searchArgs.order; searchArgs.order = searchArgs.order;
updateActiveOrder(searchArgs.order); updateActiveOrder(searchArgs.order);
initPaginator(searchArgs); initPaginator(searchArgs, loaded);
} }
function initPaginator(searchArgs) { function initPaginator(searchArgs, onLoad) {
pagedCollectionPresenter.init({ pagedCollectionPresenter.init({
page: searchArgs.page, page: searchArgs.page,
searchParams: {order: searchArgs.order}, searchParams: {order: searchArgs.order},
@ -52,7 +53,7 @@ App.Presenters.PostListPresenter = function(
failCallback: function(response) { failCallback: function(response) {
$el.empty(); $el.empty();
messagePresenter.showError($el, response.json && response.json.error || response); messagePresenter.showError($el, response.json && response.json.error || response);
}}); }}, onLoad);
} }
function render() { function render() {

View file

@ -20,13 +20,15 @@ App.Presenters.PostUploadPresenter = function(
var tagInput; var tagInput;
var interactionEnabled = true; var interactionEnabled = true;
function init(args) { function init(args, loaded) {
topNavigationPresenter.select('upload'); topNavigationPresenter.select('upload');
topNavigationPresenter.changeTitle('Upload'); topNavigationPresenter.changeTitle('Upload');
promise.wait(util.promiseTemplate('post-upload')).then(function(html) { promise.wait(util.promiseTemplate('post-upload'))
.then(function(html) {
template = _.template(html); template = _.template(html);
render(); render();
loaded();
}); });
} }
@ -524,7 +526,8 @@ App.Presenters.PostUploadPresenter = function(
return; return;
} }
promise.wait(api.post('/posts', formData)).then(function(response) { promise.wait(api.post('/posts', formData))
.then(function(response) {
$row.slideUp(function(response) { $row.slideUp(function(response) {
$row.remove(); $row.remove();
posts.shift(); posts.shift();

View file

@ -14,12 +14,14 @@ App.Presenters.RegistrationPresenter = function(
var template; var template;
var $messages; var $messages;
function init() { function init(args, loaded) {
topNavigationPresenter.select('register'); topNavigationPresenter.select('register');
topNavigationPresenter.changeTitle('Registration'); topNavigationPresenter.changeTitle('Registration');
promise.wait(util.promiseTemplate('registration-form')).then(function(html) { promise.wait(util.promiseTemplate('registration-form'))
.then(function(html) {
template = _.template(html); template = _.template(html);
render(); render();
loaded();
}); });
} }

View file

@ -7,10 +7,11 @@ App.Presenters.TagListPresenter = function(
var $el = jQuery('#content'); var $el = jQuery('#content');
function init(args) { function init(args, loaded) {
topNavigationPresenter.select('tags'); topNavigationPresenter.select('tags');
topNavigationPresenter.changeTitle('Tags'); topNavigationPresenter.changeTitle('Tags');
render(); render();
loaded();
} }
function render() { function render() {

View file

@ -13,10 +13,12 @@ App.Presenters.TopNavigationPresenter = function(
var template; var template;
var baseTitle = document.title; var baseTitle = document.title;
function init() { function init(args, loaded) {
promise.wait(util.promiseTemplate('top-navigation')).then(function(html) { promise.wait(util.promiseTemplate('top-navigation'))
.then(function(html) {
template = _.template(html); template = _.template(html);
render(); render();
loaded();
auth.startObservingLoginChanges('top-navigation', loginStateChanged); auth.startObservingLoginChanges('top-navigation', loginStateChanged);
}); });
} }

View file

@ -16,8 +16,7 @@ App.Presenters.UserAccountRemovalPresenter = function(
var user; var user;
var privileges = {}; var privileges = {};
function init(args) { function init(args, loaded) {
return promise.make(function(resolve, reject) {
user = args.user; user = args.user;
target = args.target; target = args.target;
@ -25,11 +24,11 @@ App.Presenters.UserAccountRemovalPresenter = function(
auth.hasPrivilege(auth.privileges.deleteAllAccounts) || auth.hasPrivilege(auth.privileges.deleteAllAccounts) ||
(auth.hasPrivilege(auth.privileges.deleteOwnAccount) && auth.isLoggedIn(user.name)); (auth.hasPrivilege(auth.privileges.deleteOwnAccount) && auth.isLoggedIn(user.name));
promise.wait(util.promiseTemplate('account-removal')).then(function(html) { promise.wait(util.promiseTemplate('account-removal'))
.then(function(html) {
template = _.template(html); template = _.template(html);
render(); render();
resolve(); loaded();
});
}); });
} }

View file

@ -16,8 +16,7 @@ App.Presenters.UserAccountSettingsPresenter = function(
var privileges; var privileges;
var avatarContent; var avatarContent;
function init(args) { function init(args, loaded) {
return promise.make(function(resolve, reject) {
user = args.user; user = args.user;
target = args.target; target = args.target;
@ -38,11 +37,11 @@ App.Presenters.UserAccountSettingsPresenter = function(
(auth.hasPrivilege(auth.privileges.changeOwnPassword) && auth.isLoggedIn(user.name)), (auth.hasPrivilege(auth.privileges.changeOwnPassword) && auth.isLoggedIn(user.name)),
}; };
promise.wait(util.promiseTemplate('account-settings')).then(function(html) { promise.wait(util.promiseTemplate('account-settings'))
.then(function(html) {
template = _.template(html); template = _.template(html);
render(); render();
resolve(); loaded();
});
}); });
} }

View file

@ -18,15 +18,16 @@ App.Presenters.UserActivationPresenter = function(
var formHidden = false; var formHidden = false;
var operation; var operation;
function init(args) { function init(args, loaded) {
topNavigationPresenter.select('login'); topNavigationPresenter.select('login');
topNavigationPresenter.changeTitle('Account recovery'); topNavigationPresenter.changeTitle('Account recovery');
reinit(args); reinit(args, loaded);
} }
function reinit(args) { function reinit(args, loaded) {
operation = args.operation; operation = args.operation;
promise.wait(util.promiseTemplate('user-query-form')).then(function(html) { promise.wait(util.promiseTemplate('user-query-form'))
.then(function(html) {
template = _.template(html); template = _.template(html);
if (args.token) { if (args.token) {
hideForm(); hideForm();
@ -35,6 +36,7 @@ App.Presenters.UserActivationPresenter = function(
showForm(); showForm();
} }
render(); render();
loaded();
}); });
} }
@ -68,7 +70,8 @@ App.Presenters.UserActivationPresenter = function(
'/password-reset/' + userNameOrEmail : '/password-reset/' + userNameOrEmail :
'/activation/' + userNameOrEmail; '/activation/' + userNameOrEmail;
api.post(url).then(function(response) { api.post(url)
.then(function(response) {
var message = operation === 'passwordReset' ? var message = operation === 'passwordReset' ?
'Password reset request sent.' : 'Password reset request sent.' :
'Activation e-mail resent.'; 'Activation e-mail resent.';
@ -89,7 +92,8 @@ App.Presenters.UserActivationPresenter = function(
'/finish-password-reset/' + token : '/finish-password-reset/' + token :
'/finish-activation/' + token; '/finish-activation/' + token;
api.post(url).then(function(response) { api.post(url)
.then(function(response) {
var message = operation === 'passwordReset' ? var message = operation === 'passwordReset' ?
'Your new password is <strong>' + response.json.newPassword + '</strong>.' : 'Your new password is <strong>' + response.json.newPassword + '</strong>.' :
'E-mail activation successful.'; 'E-mail activation successful.';

View file

@ -15,18 +15,17 @@ App.Presenters.UserBrowsingSettingsPresenter = function(
var user; var user;
var privileges = {}; var privileges = {};
function init(args) { function init(args, loaded) {
return promise.make(function(resolve, reject) {
user = args.user; user = args.user;
target = args.target; target = args.target;
privileges.canChangeBrowsingSettings = auth.isLoggedIn(user.name) && user.name === auth.getCurrentUser().name; privileges.canChangeBrowsingSettings = auth.isLoggedIn(user.name) && user.name === auth.getCurrentUser().name;
promise.wait(util.promiseTemplate('browsing-settings')).then(function(html) { promise.wait(util.promiseTemplate('browsing-settings'))
.then(function(html) {
template = _.template(html); template = _.template(html);
render(); render();
resolve(); loaded();
});
}); });
} }
@ -41,6 +40,7 @@ App.Presenters.UserBrowsingSettingsPresenter = function(
var $el = jQuery(target); var $el = jQuery(target);
var $messages = $el.find('.messages'); var $messages = $el.find('.messages');
messagePresenter.hideMessages($messages); messagePresenter.hideMessages($messages);
var newSettings = { var newSettings = {
endlessScroll: $el.find('[name=endless-scroll]').is(':checked'), endlessScroll: $el.find('[name=endless-scroll]').is(':checked'),
hideDownvoted: $el.find('[name=hide-downvoted]').is(':checked'), hideDownvoted: $el.find('[name=hide-downvoted]').is(':checked'),
@ -50,7 +50,9 @@ App.Presenters.UserBrowsingSettingsPresenter = function(
unsafe: $el.find('[name=listUnsafePosts]').is(':checked'), unsafe: $el.find('[name=listUnsafePosts]').is(':checked'),
}, },
}; };
browsingSettings.setSettings(newSettings).then(function() {
browsingSettings.setSettings(newSettings)
.then(function() {
messagePresenter.showInfo($messages, 'Browsing settings updated!'); messagePresenter.showInfo($messages, 'Browsing settings updated!');
}); });
} }

View file

@ -16,30 +16,31 @@ App.Presenters.UserListPresenter = function(
var listTemplate; var listTemplate;
var itemTemplate; var itemTemplate;
function init(args) { function init(args, loaded) {
topNavigationPresenter.select('users'); topNavigationPresenter.select('users');
topNavigationPresenter.changeTitle('Users'); topNavigationPresenter.changeTitle('Users');
promise.waitAll( promise.waitAll(
util.promiseTemplate('user-list'), util.promiseTemplate('user-list'),
util.promiseTemplate('user-list-item')).then(function(listHtml, itemHtml) { util.promiseTemplate('user-list-item'))
.then(function(listHtml, itemHtml) {
listTemplate = _.template(listHtml); listTemplate = _.template(listHtml);
itemTemplate = _.template(itemHtml); itemTemplate = _.template(itemHtml);
render(); render();
reinit(args); reinit(args, loaded);
}); });
} }
function reinit(args) { function reinit(args, loaded) {
var searchArgs = util.parseComplexRouteArgs(args.searchArgs); var searchArgs = util.parseComplexRouteArgs(args.searchArgs);
searchArgs.order = searchArgs.order || 'name'; searchArgs.order = searchArgs.order || 'name';
updateActiveOrder(searchArgs.order); updateActiveOrder(searchArgs.order);
initPaginator(searchArgs); initPaginator(searchArgs, loaded);
} }
function initPaginator(searchArgs) { function initPaginator(searchArgs, onLoad) {
pagedCollectionPresenter.init({ pagedCollectionPresenter.init({
page: searchArgs.page, page: searchArgs.page,
searchParams: {order: searchArgs.order}, searchParams: {order: searchArgs.order},
@ -52,7 +53,7 @@ App.Presenters.UserListPresenter = function(
failCallback: function(response) { failCallback: function(response) {
$el.empty(); $el.empty();
messagePresenter.showError($el, response.json && response.json.error || response); messagePresenter.showError($el, response.json && response.json.error || response);
}}); }}, onLoad);
} }
function render() { function render() {

View file

@ -9,6 +9,7 @@ App.Presenters.UserPresenter = function(
api, api,
auth, auth,
topNavigationPresenter, topNavigationPresenter,
presenterManager,
userBrowsingSettingsPresenter, userBrowsingSettingsPresenter,
userAccountSettingsPresenter, userAccountSettingsPresenter,
userAccountRemovalPresenter, userAccountRemovalPresenter,
@ -21,7 +22,7 @@ App.Presenters.UserPresenter = function(
var userName; var userName;
var activeTab; var activeTab;
function init(args) { function init(args, loaded) {
userName = args.userName; userName = args.userName;
topNavigationPresenter.select(auth.isLoggedIn(userName) ? 'my-account' : 'users'); topNavigationPresenter.select(auth.isLoggedIn(userName) ? 'my-account' : 'users');
topNavigationPresenter.changeTitle(userName); topNavigationPresenter.changeTitle(userName);
@ -38,12 +39,12 @@ App.Presenters.UserPresenter = function(
user = response.json; user = response.json;
var extendedContext = _.extend(args, {user: user}); var extendedContext = _.extend(args, {user: user});
promise.waitAll( presenterManager.initPresenters([
userBrowsingSettingsPresenter.init(_.extend(extendedContext, {target: '#browsing-settings-target'})), [userBrowsingSettingsPresenter, _.extend({}, extendedContext, {target: '#browsing-settings-target'})],
userAccountSettingsPresenter.init(_.extend(extendedContext, {target: '#account-settings-target'})), [userAccountSettingsPresenter, _.extend({}, extendedContext, {target: '#account-settings-target'})],
userAccountRemovalPresenter.init(_.extend(extendedContext, {target: '#account-removal-target'}))) [userAccountRemovalPresenter, _.extend({}, extendedContext, {target: '#account-removal-target'})]],
.then(function() { function() {
initTabs(args); reinit(args, loaded);
}); });
}).fail(function(response) { }).fail(function(response) {
@ -52,6 +53,11 @@ App.Presenters.UserPresenter = function(
}); });
} }
function reinit(args, loaded) {
initTabs(args);
loaded();
}
function initTabs(args) { function initTabs(args) {
activeTab = args.tab || 'basic-info'; activeTab = args.tab || 'basic-info';
render(); render();
@ -82,10 +88,10 @@ App.Presenters.UserPresenter = function(
return { return {
init: init, init: init,
reinit: initTabs, reinit: reinit,
render: render render: render
}; };
}; };
App.DI.register('userPresenter', ['_', 'jQuery', 'util', 'promise', 'api', 'auth', 'topNavigationPresenter', 'userBrowsingSettingsPresenter', 'userAccountSettingsPresenter', 'userAccountRemovalPresenter', 'messagePresenter'], App.Presenters.UserPresenter); App.DI.register('userPresenter', ['_', 'jQuery', 'util', 'promise', 'api', 'auth', 'topNavigationPresenter', 'presenterManager', 'userBrowsingSettingsPresenter', 'userAccountSettingsPresenter', 'userAccountRemovalPresenter', 'messagePresenter'], App.Presenters.UserPresenter);

View file

@ -57,7 +57,9 @@ App.Router = function(pathJs, _, jQuery, util, appState, presenterManager) {
additionalParams, additionalParams,
{previousRoute: pathJs.routes.previous}); {previousRoute: pathJs.routes.previous});
presenterManager.switchContentPresenter( presenterName, finalParams); var presenter = App.DI.get(presenterName);
presenter.name = presenterName;
presenterManager.switchContentPresenter(presenter, finalParams);
}).enter(function(e) { }).enter(function(e) {
if (util.isExitConfirmationEnabled()) { if (util.isExitConfirmationEnabled()) {
if (window.location.href !== previousLocation) { if (window.location.href !== previousLocation) {