diff --git a/public/css/style.less b/public/css/style.less
index 3e220381c9..b69e553d9f 100644
--- a/public/css/style.less
+++ b/public/css/style.less
@@ -329,7 +329,7 @@ footer.footer {
margin-top: 20px;
text-align: center;
vertical-align: top;
- max-width: 103px;
+ max-width: 84px;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
diff --git a/public/templates/admin/users.tpl b/public/templates/admin/users.tpl
index 56bc1f8e2a..564b5606fd 100644
--- a/public/templates/admin/users.tpl
+++ b/public/templates/admin/users.tpl
@@ -30,11 +30,9 @@
-
+
@@ -60,56 +58,42 @@
}
});
- jQuery('.make-admin-btn').each(function(index, element) {
+ jQuery('.admin-btn').each(function(index, element) {
var adminBtn = $(element);
var isAdmin = adminBtn.attr('data-admin') !== "0";
if(isAdmin)
- adminBtn.hide();
+ adminBtn.addClass('btn-success');
else
- adminBtn.show();
+ adminBtn.removeClass('btn-success');
});
- jQuery('.remove-admin-btn').each(function(index, element) {
- var adminBtn = $(element);
+ jQuery('.admin-btn').on('click', function() {
+ var adminBtn = $(this);
var isAdmin = adminBtn.attr('data-admin') !== "0";
var parent = adminBtn.parents('.users-box');
- var uid = parent.attr('data-uid');
-
- if(isAdmin && uid != yourid)
- adminBtn.show();
- else
- adminBtn.hide();
- });
-
- jQuery('.make-admin-btn').on('click', function() {
- var makeBtn = $(this);
- var parent = makeBtn.parents('.users-box');
- var removeBtn = parent.find('.remove-admin-btn');
var uid = parent.attr('data-uid');
- socket.emit('api:admin.user.makeAdmin', uid);
- makeBtn.hide();
- removeBtn.show();
- return false;
- });
-
- jQuery('.remove-admin-btn').on('click', function() {
+ if(isAdmin) {
+ socket.emit('api:admin.user.removeAdmin', uid);
+ adminBtn.removeClass('btn-success');
+ adminBtn.attr('data-admin', 0);
+ }
+ else {
+ bootbox.confirm('Do you really want to make "' + adminBtn.attr('data-username') +'" an admin?', function(confirm) {
+ if(confirm) {
+ socket.emit('api:admin.user.makeAdmin', uid);
+ adminBtn.addClass('btn-success');
+ adminBtn.attr('data-admin', 1);
+ }
+ });
+ }
- var removeBtn = $(this);
- var parent = removeBtn.parents('.users-box');
- var makeBtn = parent.find('.make-admin-btn');
- var uid = parent.attr('data-uid');
-
- socket.emit('api:admin.user.removeAdmin', uid);
- makeBtn.show();
- removeBtn.hide();
return false;
});
-
-
+
});
}());