szurubooru/client/js/controllers/page_controller.js

34 lines
874 B
JavaScript
Raw Normal View History

2016-04-10 22:13:01 +02:00
'use strict';
const settings = require('../models/settings.js');
2016-04-12 23:49:46 +02:00
const EndlessPageView = require('../views/endless_page_view.js');
2016-04-10 22:13:01 +02:00
const ManualPageView = require('../views/manual_page_view.js');
class PageController {
constructor(ctx) {
const extendedContext = {
2016-07-05 21:20:28 +02:00
getClientUrlForPage: ctx.getClientUrlForPage,
parameters: ctx.parameters,
};
ctx.headerContext = Object.assign({}, extendedContext);
ctx.pageContext = Object.assign({}, extendedContext);
2016-04-12 23:49:46 +02:00
if (settings.get().endlessScroll) {
this._view = new EndlessPageView(ctx);
2016-04-12 23:49:46 +02:00
} else {
this._view = new ManualPageView(ctx);
2016-04-12 23:49:46 +02:00
}
2016-04-10 22:13:01 +02:00
}
showSuccess(message) {
this._view.showSuccess(message);
}
2016-06-11 09:59:29 +02:00
showError(message) {
this._view.showError(message);
2016-04-10 22:13:01 +02:00
}
}
module.exports = PageController;