Ongoing rewrite work
This commit is contained in:
@ -51,5 +51,9 @@ module.exports = Mn.View.extend({
|
||||
|
||||
return 'Sign out';
|
||||
}
|
||||
},
|
||||
|
||||
initialize: function () {
|
||||
this.listenTo(Cache.User, 'change', this.render);
|
||||
}
|
||||
});
|
||||
|
@ -8,15 +8,28 @@
|
||||
<li class="nav-item dropdown">
|
||||
<a href="#" class="nav-link" data-toggle="dropdown"><i class="fe fe-monitor"></i> Hosts</a>
|
||||
<div class="dropdown-menu dropdown-menu-arrow">
|
||||
<% if (canShow('proxy_hosts')) { %>
|
||||
<a href="/nginx/proxy" class="dropdown-item ">Proxy Hosts</a>
|
||||
<% } %>
|
||||
|
||||
<% if (canShow('redirection_hosts')) { %>
|
||||
<a href="/nginx/redirection" class="dropdown-item ">Redirections</a>
|
||||
<% } %>
|
||||
|
||||
<% if (canShow('streams')) { %>
|
||||
<a href="/nginx/stream" class="dropdown-item ">Streams</a>
|
||||
<% } %>
|
||||
|
||||
<% if (canShow('dead_hosts')) { %>
|
||||
<a href="/nginx/404" class="dropdown-item ">404 Hosts</a>
|
||||
<% } %>
|
||||
</div>
|
||||
</li>
|
||||
<% if (canShow('access_lists')) { %>
|
||||
<li class="nav-item">
|
||||
<a href="/nginx/access" class="nav-link"><i class="fe fe-lock"></i> Access Lists</a>
|
||||
</li>
|
||||
<% } %>
|
||||
<% if (showUsers()) { %>
|
||||
<li class="nav-item">
|
||||
<a href="/users" class="nav-link"><i class="fe fe-users"></i> Users</a>
|
||||
|
@ -17,14 +17,25 @@ module.exports = Mn.View.extend({
|
||||
|
||||
events: {
|
||||
'click @ui.links': function (e) {
|
||||
e.preventDefault();
|
||||
Controller.navigate($(e.currentTarget).attr('href'), true);
|
||||
let href = $(e.currentTarget).attr('href');
|
||||
if (href !== '#') {
|
||||
e.preventDefault();
|
||||
Controller.navigate(href, true);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
templateContext: {
|
||||
showUsers: function () {
|
||||
return Cache.User.isAdmin();
|
||||
},
|
||||
|
||||
canShow: function (perm) {
|
||||
return Cache.User.isAdmin() || Cache.User.canView(perm);
|
||||
}
|
||||
},
|
||||
|
||||
initialize: function () {
|
||||
this.listenTo(Cache.User, 'change', this.render);
|
||||
}
|
||||
});
|
||||
|
Reference in New Issue
Block a user