Skip to content

Commit a8dd554

Browse files
author
Jamie Curnow
committed
Fix some ui bugs
1 parent af99d48 commit a8dd554

File tree

4 files changed

+9
-3
lines changed

4 files changed

+9
-3
lines changed

src/frontend/js/app/user/form.ejs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@
2525
<div class="invalid-feedback secret-error"></div>
2626
</div>
2727
</div>
28-
<% if (isAdmin()) { %>
28+
<% if (isAdmin() && !isSelf()) { %>
2929
<div class="col-sm-12 col-md-12">
3030
<div class="form-label"><%- i18n('roles', 'title') %></div>
3131
</div>
3232
<div class="col-sm-6 col-md-6">
3333
<div class="form-group">
3434
<label class="custom-switch">
35-
<input type="checkbox" class="custom-switch-input" name="is_admin" value="1"<%- isAdmin() ? ' checked' : '' %><%- isSelf() ? ' disabled' : '' %>>
35+
<input type="checkbox" class="custom-switch-input" name="is_admin" value="1"<%- isAdminUser() ? ' checked' : '' %><%- isSelf() ? ' disabled' : '' %>>
3636
<span class="custom-switch-indicator"></span>
3737
<span class="custom-switch-description"><%- i18n('roles', 'admin') %></span>
3838
</label>

src/frontend/js/app/user/form.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,10 @@ module.exports = Mn.View.extend({
8989
},
9090

9191
isAdmin: function () {
92+
return App.Cache.User.isAdmin();
93+
},
94+
95+
isAdminUser: function () {
9296
return view.model.isAdmin();
9397
},
9498

src/frontend/js/app/user/password.ejs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<div class="modal-content">
22
<div class="modal-header">
3-
<h5 class="modal-title"><%- i18n('users', 'form-title', {self: isSelf(), name: name}) %></h5>
3+
<h5 class="modal-title"><%- i18n('users', 'password-title', {self: isSelf(), name: name}) %></h5>
44
<button type="button" class="close cancel" aria-label="Close" data-dismiss="modal">&nbsp;</button>
55
</div>
66
<div class="modal-body">

src/frontend/js/app/users/list/item.ejs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@
3333
<a href="#" class="edit-permissions dropdown-item"><i class="dropdown-icon fe fe-shield"></i> <%- i18n('users', 'edit-permissions') %></a>
3434
<a href="#" class="set-password dropdown-item"><i class="dropdown-icon fe fe-lock"></i> <%- i18n('users', 'change-password') %></a>
3535
<% if (!isSelf()) { %>
36+
<% if (!is_disabled) { %>
3637
<a href="#" class="login dropdown-item"><i class="dropdown-icon fe fe-log-in"></i> <%- i18n('users', 'sign-in-as') %></a>
38+
<% } %>
3739
<div class="dropdown-divider"></div>
3840
<a href="#" class="delete-user dropdown-item"><i class="dropdown-icon fe fe-trash-2"></i> <%- i18n('users', 'delete', {name: name}) %></a>
3941
<% } %>

0 commit comments

Comments
 (0)