define(['jQuery', 'paper-icon-button-light'], function ($) { function deleteUser(page, id) { var msg = Globalize.translate('DeleteUserConfirmation'); require(['confirm'], function (confirm) { confirm(msg, Globalize.translate('DeleteUser')).then(function () { Dashboard.showLoadingMsg(); ApiClient.deleteUser(id).then(function () { loadData(page); }); }); }); } function showUserMenu(elem) { var card = $(elem).parents('.card')[0]; var page = $(card).parents('.page')[0]; var userId = card.getAttribute('data-userid'); var menuItems = []; menuItems.push({ name: Globalize.translate('ButtonOpen'), id: 'open', ironIcon: 'mode-edit' }); menuItems.push({ name: Globalize.translate('ButtonLibraryAccess'), id: 'access', ironIcon: 'lock' }); menuItems.push({ name: Globalize.translate('ButtonParentalControl'), id: 'parentalcontrol', ironIcon: 'person' }); menuItems.push({ name: Globalize.translate('ButtonDelete'), id: 'delete', ironIcon: 'delete' }); require(['actionsheet'], function (actionsheet) { actionsheet.show({ items: menuItems, positionTo: card, callback: function (id) { switch (id) { case 'open': Dashboard.navigate('useredit.html?userid=' + userId); break; case 'access': Dashboard.navigate('userlibraryaccess.html?userid=' + userId); break; case 'parentalcontrol': Dashboard.navigate('userparentalcontrol.html?userid=' + userId); break; case 'delete': deleteUser(page, userId); break; default: break; } } }); }); } function getUserHtml(user, addConnectIndicator) { var html = ''; var cssClass = "card squareCard bottomPaddedCard"; if (user.Policy.IsDisabled) { cssClass += ' grayscale'; } html += "