mirror of
https://github.com/rr-/szurubooru.git
synced 2025-07-17 08:26:24 +00:00
Optimized sub routing in presenters
This commit is contained in:
@ -18,26 +18,29 @@ App.Presenters.UserListPresenter = function(
|
||||
|
||||
function init(args) {
|
||||
topNavigationPresenter.select('users');
|
||||
activeSearchOrder = util.parseComplexRouteArgs(args.searchArgs).order;
|
||||
|
||||
promise.wait(util.promiseTemplate('user-list')).then(function(html) {
|
||||
template = _.template(html);
|
||||
|
||||
pagedCollectionPresenter.init({
|
||||
searchArgs: args.searchArgs,
|
||||
baseUri: '#/users',
|
||||
backendUri: '/users',
|
||||
renderCallback: function updateCollection(data) {
|
||||
userList = data.entities;
|
||||
render();
|
||||
},
|
||||
failCallback: function(response) {
|
||||
$el.empty();
|
||||
messagePresenter.showError($el, response.json && response.json.error || response);
|
||||
}});
|
||||
initPaginator(args);
|
||||
});
|
||||
}
|
||||
|
||||
function initPaginator(args) {
|
||||
activeSearchOrder = util.parseComplexRouteArgs(args.searchArgs).order;
|
||||
pagedCollectionPresenter.init({
|
||||
searchArgs: args.searchArgs,
|
||||
baseUri: '#/users',
|
||||
backendUri: '/users',
|
||||
renderCallback: function updateCollection(data) {
|
||||
userList = data.entities;
|
||||
render();
|
||||
},
|
||||
failCallback: function(response) {
|
||||
$el.empty();
|
||||
messagePresenter.showError($el, response.json && response.json.error || response);
|
||||
}});
|
||||
}
|
||||
|
||||
function render() {
|
||||
$el.html(template({
|
||||
userList: userList,
|
||||
@ -59,6 +62,7 @@ App.Presenters.UserListPresenter = function(
|
||||
|
||||
return {
|
||||
init: init,
|
||||
reinit: initPaginator,
|
||||
render: render
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user