Skip to content

Commit 0bb65e4

Browse files
committed
Updated to marionette 4
1 parent 065727f commit 0bb65e4

File tree

4 files changed

+19
-40
lines changed

4 files changed

+19
-40
lines changed

package.json

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,25 @@
99
"babel-minify-webpack-plugin": "^0.3.1",
1010
"babel-preset-env": "^1.7.0",
1111
"backbone": "^1.3.3",
12-
"backbone.marionette": "^3.5.1",
12+
"backbone.marionette": "^4.0.0",
1313
"copy-webpack-plugin": "^4.5.1",
14-
"css-loader": "^0.28.11",
14+
"css-loader": "^1.0.0",
1515
"ejs-loader": "^0.3.1",
1616
"file-loader": "^1.1.11",
1717
"imports-loader": "^0.8.0",
1818
"jquery": "^3.3.1",
1919
"jquery-mask-plugin": "^1.14.15",
2020
"jquery-serializejson": "^2.8.1",
21+
"marionette.approuter": "^1.0.0",
22+
"marionette.templatecache": "^1.0.0",
2123
"messageformat": "^2.0.2",
2224
"messageformat-loader": "^0.7.0",
2325
"mini-css-extract-plugin": "^0.4.0",
2426
"node-sass": "^4.9.0",
2527
"nodemon": "^1.17.5",
2628
"numeral": "^2.0.6",
2729
"sass-loader": "^7.0.3",
28-
"style-loader": "^0.21.0",
30+
"style-loader": "^0.22.1",
2931
"tabler-ui": "git+https://github.com/tabler/tabler.git",
3032
"underscore": "^1.8.3",
3133
"webpack": "^4.12.0",
@@ -38,15 +40,15 @@
3840
"bcrypt": "^3.0.0",
3941
"body-parser": "^1.18.3",
4042
"compression": "^1.7.2",
41-
"config": "^1.30.0",
43+
"config": "^2.0.1",
4244
"ejs": "^2.6.1",
4345
"express": "^4.16.3",
4446
"express-fileupload": "^0.4.0",
4547
"gravatar": "^1.6.0",
4648
"html-entities": "^1.2.1",
4749
"json-schema-ref-parser": "^5.0.3",
4850
"jsonwebtoken": "^8.3.0",
49-
"knex": "^0.14.6",
51+
"knex": "^0.15.2",
5052
"liquidjs": "^5.1.1",
5153
"lodash": "^4.17.10",
5254
"moment": "^2.22.2",

src/frontend/js/app/main.js

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -73,25 +73,6 @@ const App = Mn.Application.extend({
7373
}
7474
},
7575

76-
Error: function (code, message, debug) {
77-
let temp = Error.call(this, message);
78-
temp.name = this.name = 'AppError';
79-
this.stack = temp.stack;
80-
this.message = temp.message;
81-
this.code = code;
82-
this.debug = debug;
83-
},
84-
85-
showError: function () {
86-
let ErrorView = Mn.View.extend({
87-
tagName: 'section',
88-
id: 'error',
89-
template: _.template(i18n('main', 'unknown-error'))
90-
});
91-
92-
this.getRegion().show(new ErrorView());
93-
},
94-
9576
getParam: function (name) {
9677
name = name.replace(/[\[\]]/g, '\\$&');
9778
let url = window.___location.href;

src/frontend/js/app/router.js

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
'use strict';
22

3-
const Mn = require('../lib/marionette');
3+
const AppRouter = require('marionette.approuter');
44
const Controller = require('./controller');
55

6-
module.exports = Mn.AppRouter.extend({
7-
appRoutes: {
6+
module.exports = AppRouter.default.extend({
7+
controller: Controller,
8+
appRoutes: {
89
users: 'showUsers',
910
logout: 'logout',
1011
'nginx/proxy': 'showNginxProxy',
@@ -15,9 +16,5 @@ module.exports = Mn.AppRouter.extend({
1516
'nginx/certificates': 'showNginxCertificates',
1617
'audit-log': 'showAuditLog',
1718
'*default': 'showDashboard'
18-
},
19-
20-
initialize: function () {
21-
this.controller = Controller;
2219
}
2320
});

src/frontend/js/lib/marionette.js

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
'use strict';
22

3-
const _ = require('underscore');
4-
const Mn = require('backbone.marionette');
5-
const i18n = require('../app/i18n');
6-
const Helpers = require('./helpers');
3+
const _ = require('underscore');
4+
const Mn = require('backbone.marionette');
5+
const i18n = require('../app/i18n');
6+
const Helpers = require('./helpers');
7+
const TemplateCache = require('marionette.templatecache');
78

8-
let render = Mn.Renderer.render;
9-
10-
Mn.Renderer.render = function (template, data, view) {
9+
Mn.setRenderer(function (template, data, view) {
1110
data = _.clone(data);
1211
data.i18n = i18n;
1312
data.formatDbDate = Helpers.formatDbDate;
1413

15-
return render.call(this, template, data, view);
16-
};
14+
return TemplateCache.default.render.call(this, template, data, view);
15+
});
1716

1817
module.exports = Mn;

0 commit comments

Comments
 (0)