mirror of
https://github.com/NginxProxyManager/nginx-proxy-manager.git
synced 2025-06-18 10:06:26 +00:00
Remove add item buttons when there are no permissions
This commit is contained in:
@ -3,7 +3,9 @@
|
||||
<div class="card-header">
|
||||
<h3 class="card-title">Proxy Hosts</h3>
|
||||
<div class="card-options">
|
||||
<% if (showAddButton) { %>
|
||||
<a href="#" class="btn btn-outline-success btn-sm ml-2 add-item">Add Proxy Host</a>
|
||||
<% } %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body no-padding min-100">
|
||||
|
@ -3,6 +3,7 @@
|
||||
const Mn = require('backbone.marionette');
|
||||
const ProxyHostModel = require('../../../models/proxy-host');
|
||||
const Api = require('../../api');
|
||||
const Cache = require('../../cache');
|
||||
const Controller = require('../../controller');
|
||||
const ListView = require('./list/main');
|
||||
const ErrorView = require('../../error/main');
|
||||
@ -30,6 +31,10 @@ module.exports = Mn.View.extend({
|
||||
}
|
||||
},
|
||||
|
||||
templateContext: {
|
||||
showAddButton: Cache.User.canManage('proxy_hosts')
|
||||
},
|
||||
|
||||
onRender: function () {
|
||||
let view = this;
|
||||
|
||||
@ -41,12 +46,15 @@ module.exports = Mn.View.extend({
|
||||
collection: new ProxyHostModel.Collection(response)
|
||||
}));
|
||||
} else {
|
||||
let manage = Cache.User.canManage('proxy_hosts');
|
||||
|
||||
view.showChildView('list_region', new EmptyView({
|
||||
title: 'There are no Proxy Hosts',
|
||||
subtitle: 'Why don\'t you create one?',
|
||||
link: 'Add Proxy Host',
|
||||
btn_color: 'success',
|
||||
action: function () {
|
||||
title: 'There are no Proxy Hosts',
|
||||
subtitle: manage ? 'Why don\'t you create one?' : 'And you don\'t have permission to create one.',
|
||||
link: manage ? 'Add Proxy Host' : null,
|
||||
btn_color: 'success',
|
||||
permission: 'proxy_hosts',
|
||||
action: function () {
|
||||
Controller.showNginxProxyForm();
|
||||
}
|
||||
}));
|
||||
|
Reference in New Issue
Block a user