diff --git a/src/frontend/js/app/nginx/redirection/list/item.ejs b/src/frontend/js/app/nginx/redirection/list/item.ejs
index bd4d19e0..de197bf7 100644
--- a/src/frontend/js/app/nginx/redirection/list/item.ejs
+++ b/src/frontend/js/app/nginx/redirection/list/item.ejs
@@ -1,32 +1,37 @@
- |
- <%- name %>
+
+ <% domain_names.map(function(host) {
+ %>
+ <%- host %>
+ <%
+ });
+ %>
+
- Created: <%- formatDbDate(created_on, 'Do MMMM YYYY') %>
+ <%- i18n('str', 'created-on', {date: formatDbDate(created_on, 'Do MMMM YYYY')}) %>
|
- <%- email %>
+ <%- forward_domain_name %>
|
- <%- roles.join(', ') %>
+ <%- ssl_enabled && ssl_provider ? i18n('ssl', ssl_provider) : i18n('ssl', 'none') %>
|
+<% if (canManage) { %>
|
+<% } %>
diff --git a/src/frontend/js/app/nginx/redirection/list/item.js b/src/frontend/js/app/nginx/redirection/list/item.js
index e2a68255..e8d74b09 100644
--- a/src/frontend/js/app/nginx/redirection/list/item.js
+++ b/src/frontend/js/app/nginx/redirection/list/item.js
@@ -1,69 +1,32 @@
'use strict';
-const Mn = require('backbone.marionette');
-const Controller = require('../../../controller');
-const Api = require('../../../api');
-const Cache = require('../../../cache');
-const Tokens = require('../../../tokens');
-const template = require('./item.ejs');
+const Mn = require('backbone.marionette');
+const App = require('../../../main');
+const template = require('./item.ejs');
module.exports = Mn.View.extend({
template: template,
tagName: 'tr',
ui: {
- edit: 'a.edit-user',
- permissions: 'a.edit-permissions',
- password: 'a.set-password',
- login: 'a.login',
- delete: 'a.delete-user'
+ edit: 'a.edit',
+ delete: 'a.delete'
},
events: {
'click @ui.edit': function (e) {
e.preventDefault();
- Controller.showUserForm(this.model);
- },
-
- 'click @ui.permissions': function (e) {
- e.preventDefault();
- Controller.showUserPermissions(this.model);
- },
-
- 'click @ui.password': function (e) {
- e.preventDefault();
- Controller.showUserPasswordForm(this.model);
+ App.Controller.showNginxRedirectionForm(this.model);
},
'click @ui.delete': function (e) {
e.preventDefault();
- Controller.showUserDeleteConfirm(this.model);
- },
-
- 'click @ui.login': function (e) {
- e.preventDefault();
-
- if (Cache.User.get('id') !== this.model.get('id')) {
- this.ui.login.prop('disabled', true).addClass('btn-disabled');
-
- Api.Users.loginAs(this.model.get('id'))
- .then(res => {
- Tokens.addToken(res.token, res.user.nickname || res.user.name);
- window.location = '/';
- window.location.reload();
- })
- .catch(err => {
- alert(err.message);
- this.ui.login.prop('disabled', false).removeClass('btn-disabled');
- });
- }
+ App.Controller.showNginxRedirectionDeleteConfirm(this.model);
}
},
templateContext: {
- isSelf: function () {
- return Cache.User.get('id') === this.id;
- }
+ canManage: App.Cache.User.canManage('redirection_hosts')
},
initialize: function () {
diff --git a/src/frontend/js/app/nginx/redirection/list/main.ejs b/src/frontend/js/app/nginx/redirection/list/main.ejs
index 83afd4be..14e75eb1 100644
--- a/src/frontend/js/app/nginx/redirection/list/main.ejs
+++ b/src/frontend/js/app/nginx/redirection/list/main.ejs
@@ -1,10 +1,12 @@
- |
-Name |
-Email |
-Roles |
- |
+ |
+ <%- i18n('str', 'source') %> |
+ <%- i18n('str', 'destination') %> |
+ <%- i18n('str', 'ssl') %> |
+ <% if (canManage) { %>
+ |
+ <% } %>
-
+
diff --git a/src/frontend/js/app/nginx/redirection/list/main.js b/src/frontend/js/app/nginx/redirection/list/main.js
index 80b7bd54..e51e03e6 100644
--- a/src/frontend/js/app/nginx/redirection/list/main.js
+++ b/src/frontend/js/app/nginx/redirection/list/main.js
@@ -1,8 +1,9 @@
'use strict';
-const Mn = require('backbone.marionette');
-const ItemView = require('./item');
-const template = require('./main.ejs');
+const Mn = require('backbone.marionette');
+const App = require('../../../main');
+const ItemView = require('./item');
+const template = require('./main.ejs');
const TableBody = Mn.CollectionView.extend({
tagName: 'tbody',
@@ -21,6 +22,10 @@ module.exports = Mn.View.extend({
}
},
+ templateContext: {
+ canManage: App.Cache.User.canManage('redirection_hosts')
+ },
+
onRender: function () {
this.showChildView('body', new TableBody({
collection: this.collection
diff --git a/src/frontend/js/app/nginx/redirection/main.js b/src/frontend/js/app/nginx/redirection/main.js
index ca82c85d..146dd72a 100644
--- a/src/frontend/js/app/nginx/redirection/main.js
+++ b/src/frontend/js/app/nginx/redirection/main.js
@@ -25,7 +25,7 @@ module.exports = Mn.View.extend({
events: {
'click @ui.add': function (e) {
e.preventDefault();
- App.Controller.showNginxProxyForm();
+ App.Controller.showNginxRedirectionForm();
}
},
@@ -36,24 +36,24 @@ module.exports = Mn.View.extend({
onRender: function () {
let view = this;
- App.Api.Nginx.ProxyHosts.getAll(['owner', 'access_list'])
+ App.Api.Nginx.RedirectionHosts.getAll(['owner'])
.then(response => {
if (!view.isDestroyed()) {
if (response && response.length) {
view.showChildView('list_region', new ListView({
- collection: new ProxyHostModel.Collection(response)
+ collection: new RedirectionHostModel.Collection(response)
}));
} else {
- let manage = App.Cache.User.canManage('proxy_hosts');
+ let manage = App.Cache.User.canManage('redirection_hosts');
view.showChildView('list_region', new EmptyView({
- title: App.i18n('proxy-hosts', 'empty'),
+ title: App.i18n('redirection-hosts', 'empty'),
subtitle: App.i18n('all-hosts', 'empty-subtitle', {manage: manage}),
- link: manage ? App.i18n('proxy-hosts', 'add') : null,
- btn_color: 'success',
- permission: 'proxy_hosts',
+ link: manage ? App.i18n('redirection-hosts', 'add') : null,
+ btn_color: 'yellow',
+ permission: 'redirection_hosts',
action: function () {
- App.Controller.showNginxProxyForm();
+ App.Controller.showNginxRedirectionForm();
}
}));
}
@@ -64,7 +64,7 @@ module.exports = Mn.View.extend({
code: err.code,
message: err.message,
retry: function () {
- App.Controller.showNginxProxy();
+ App.Controller.showNginxRedirection();
}
}));
diff --git a/src/frontend/js/app/user/form.js b/src/frontend/js/app/user/form.js
index de0339c2..dca797cb 100644
--- a/src/frontend/js/app/user/form.js
+++ b/src/frontend/js/app/user/form.js
@@ -64,7 +64,7 @@ module.exports = Mn.View.extend({
}
view.model.set(result);
- App.App.UI.closeModal(function () {
+ App.UI.closeModal(function () {
if (method === App.Api.Users.create) {
// Show permissions dialog immediately
App.Controller.showUserPermissions(view.model);
diff --git a/src/frontend/js/i18n/messages.json b/src/frontend/js/i18n/messages.json
index 926b2152..b6f750a0 100644
--- a/src/frontend/js/i18n/messages.json
+++ b/src/frontend/js/i18n/messages.json
@@ -85,6 +85,8 @@
},
"redirection-hosts": {
"title": "Redirection Hosts",
+ "empty": "There are no Redirection Hosts",
+ "add": "Add Redirection Host",
"form-title": "{id, select, undefined{New} other{Edit}} Redirection Host",
"forward-domain": "Forward Domain",
"preserve-path": "Preserve Path",