diff options
Diffstat (limited to 'client/js/controllers/snapshots_controller.js')
| -rw-r--r-- | client/js/controllers/snapshots_controller.js | 51 |
1 files changed, 26 insertions, 25 deletions
diff --git a/client/js/controllers/snapshots_controller.js b/client/js/controllers/snapshots_controller.js index 0e9b773..120b6cb 100644 --- a/client/js/controllers/snapshots_controller.js +++ b/client/js/controllers/snapshots_controller.js @@ -1,41 +1,43 @@ -'use strict'; +"use strict"; -const api = require('../api.js'); -const uri = require('../util/uri.js'); -const SnapshotList = require('../models/snapshot_list.js'); -const PageController = require('../controllers/page_controller.js'); -const topNavigation = require('../models/top_navigation.js'); -const SnapshotsPageView = require('../views/snapshots_page_view.js'); -const EmptyView = require('../views/empty_view.js'); +const api = require("../api.js"); +const uri = require("../util/uri.js"); +const SnapshotList = require("../models/snapshot_list.js"); +const PageController = require("../controllers/page_controller.js"); +const topNavigation = require("../models/top_navigation.js"); +const SnapshotsPageView = require("../views/snapshots_page_view.js"); +const EmptyView = require("../views/empty_view.js"); class SnapshotsController { constructor(ctx) { - if (!api.hasPrivilege('snapshots:list')) { + if (!api.hasPrivilege("snapshots:list")) { this._view = new EmptyView(); - this._view.showError('You don\'t have privileges to view history.'); + this._view.showError("You don't have privileges to view history."); return; } - topNavigation.activate(''); - topNavigation.setTitle('History'); + topNavigation.activate(""); + topNavigation.setTitle("History"); this._pageController = new PageController(); this._pageController.run({ parameters: ctx.parameters, defaultLimit: 25, getClientUrlForPage: (offset, limit) => { - const parameters = Object.assign( - {}, ctx.parameters, {offset: offset, limit: limit}); - return uri.formatClientLink('history', parameters); + const parameters = Object.assign({}, ctx.parameters, { + offset: offset, + limit: limit, + }); + return uri.formatClientLink("history", parameters); }, requestPage: (offset, limit) => { - return SnapshotList.search('', offset, limit); + return SnapshotList.search("", offset, limit); }, - pageRenderer: pageCtx => { + pageRenderer: (pageCtx) => { Object.assign(pageCtx, { - canViewPosts: api.hasPrivilege('posts:view'), - canViewUsers: api.hasPrivilege('users:view'), - canViewTags: api.hasPrivilege('tags:view'), + canViewPosts: api.hasPrivilege("posts:view"), + canViewUsers: api.hasPrivilege("users:view"), + canViewTags: api.hasPrivilege("tags:view"), }); return new SnapshotsPageView(pageCtx); }, @@ -43,9 +45,8 @@ class SnapshotsController { } } -module.exports = router => { - router.enter(['history'], - (ctx, next) => { - ctx.controller = new SnapshotsController(ctx); - }); +module.exports = (router) => { + router.enter(["history"], (ctx, next) => { + ctx.controller = new SnapshotsController(ctx); + }); }; |