33 lines
856 B
JavaScript
33 lines
856 B
JavaScript
'use strict';
|
|
|
|
const settings = require('../models/settings.js');
|
|
const EndlessPageView = require('../views/endless_page_view.js');
|
|
const ManualPageView = require('../views/manual_page_view.js');
|
|
|
|
class PageController {
|
|
constructor(ctx) {
|
|
const extendedContext = {
|
|
clientUrl: ctx.clientUrl,
|
|
searchQuery: ctx.searchQuery,
|
|
};
|
|
|
|
ctx.headerContext = Object.assign({}, extendedContext);
|
|
ctx.pageContext = Object.assign({}, extendedContext);
|
|
|
|
if (settings.get().endlessScroll) {
|
|
this._view = new EndlessPageView(ctx);
|
|
} else {
|
|
this._view = new ManualPageView(ctx);
|
|
}
|
|
}
|
|
|
|
showSuccess(message) {
|
|
this._view.showSuccess(message);
|
|
}
|
|
|
|
showError(message) {
|
|
this._view.showError(message);
|
|
}
|
|
}
|
|
|
|
module.exports = PageController;
|