mirror of
https://github.com/rr-/szurubooru.git
synced 2025-07-17 08:26:24 +00:00
(WIP) Added spinner (#39)
This commit is contained in:
@ -16,30 +16,31 @@ App.Presenters.PostListPresenter = function(
|
||||
var listTemplate;
|
||||
var itemTemplate;
|
||||
|
||||
function init(args) {
|
||||
function init(args, loaded) {
|
||||
topNavigationPresenter.select('posts');
|
||||
topNavigationPresenter.changeTitle('Posts');
|
||||
|
||||
promise.waitAll(
|
||||
util.promiseTemplate('post-list'),
|
||||
util.promiseTemplate('post-list-item')).then(function(listHtml, itemHtml) {
|
||||
listTemplate = _.template(listHtml);
|
||||
itemTemplate = _.template(itemHtml);
|
||||
util.promiseTemplate('post-list'),
|
||||
util.promiseTemplate('post-list-item'))
|
||||
.then(function(listHtml, itemHtml) {
|
||||
listTemplate = _.template(listHtml);
|
||||
itemTemplate = _.template(itemHtml);
|
||||
|
||||
render();
|
||||
reinit(args);
|
||||
});
|
||||
render();
|
||||
reinit(args, loaded);
|
||||
});
|
||||
}
|
||||
|
||||
function reinit(args) {
|
||||
function reinit(args, loaded) {
|
||||
var searchArgs = util.parseComplexRouteArgs(args.searchArgs);
|
||||
searchArgs.order = searchArgs.order;
|
||||
|
||||
updateActiveOrder(searchArgs.order);
|
||||
initPaginator(searchArgs);
|
||||
initPaginator(searchArgs, loaded);
|
||||
}
|
||||
|
||||
function initPaginator(searchArgs) {
|
||||
function initPaginator(searchArgs, onLoad) {
|
||||
pagedCollectionPresenter.init({
|
||||
page: searchArgs.page,
|
||||
searchParams: {order: searchArgs.order},
|
||||
@ -52,7 +53,7 @@ App.Presenters.PostListPresenter = function(
|
||||
failCallback: function(response) {
|
||||
$el.empty();
|
||||
messagePresenter.showError($el, response.json && response.json.error || response);
|
||||
}});
|
||||
}}, onLoad);
|
||||
}
|
||||
|
||||
function render() {
|
||||
|
Reference in New Issue
Block a user