Fix some ui bugs

This commit is contained in:
Jamie Curnow 2018-08-24 16:04:27 +10:00
parent af99d48591
commit a8dd55431a
4 changed files with 9 additions and 3 deletions

View File

@ -25,14 +25,14 @@
<div class="invalid-feedback secret-error"></div>
</div>
</div>
<% if (isAdmin()) { %>
<% if (isAdmin() && !isSelf()) { %>
<div class="col-sm-12 col-md-12">
<div class="form-label"><%- i18n('roles', 'title') %></div>
</div>
<div class="col-sm-6 col-md-6">
<div class="form-group">
<label class="custom-switch">
<input type="checkbox" class="custom-switch-input" name="is_admin" value="1"<%- isAdmin() ? ' checked' : '' %><%- isSelf() ? ' disabled' : '' %>>
<input type="checkbox" class="custom-switch-input" name="is_admin" value="1"<%- isAdminUser() ? ' checked' : '' %><%- isSelf() ? ' disabled' : '' %>>
<span class="custom-switch-indicator"></span>
<span class="custom-switch-description"><%- i18n('roles', 'admin') %></span>
</label>

View File

@ -89,6 +89,10 @@ module.exports = Mn.View.extend({
},
isAdmin: function () {
return App.Cache.User.isAdmin();
},
isAdminUser: function () {
return view.model.isAdmin();
},

View File

@ -1,6 +1,6 @@
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title"><%- i18n('users', 'form-title', {self: isSelf(), name: name}) %></h5>
<h5 class="modal-title"><%- i18n('users', 'password-title', {self: isSelf(), name: name}) %></h5>
<button type="button" class="close cancel" aria-label="Close" data-dismiss="modal">&nbsp;</button>
</div>
<div class="modal-body">

View File

@ -33,7 +33,9 @@
<a href="#" class="edit-permissions dropdown-item"><i class="dropdown-icon fe fe-shield"></i> <%- i18n('users', 'edit-permissions') %></a>
<a href="#" class="set-password dropdown-item"><i class="dropdown-icon fe fe-lock"></i> <%- i18n('users', 'change-password') %></a>
<% if (!isSelf()) { %>
<% if (!is_disabled) { %>
<a href="#" class="login dropdown-item"><i class="dropdown-icon fe fe-log-in"></i> <%- i18n('users', 'sign-in-as') %></a>
<% } %>
<div class="dropdown-divider"></div>
<a href="#" class="delete-user dropdown-item"><i class="dropdown-icon fe fe-trash-2"></i> <%- i18n('users', 'delete', {name: name}) %></a>
<% } %>