diff --git a/public_html/css/user-list.css b/public_html/css/user-list.css index 5e91471e..ddfdf96f 100644 --- a/public_html/css/user-list.css +++ b/public_html/css/user-list.css @@ -39,12 +39,14 @@ #user-list .user img { vertical-align: top; - margin-right: 1em; display: block; } -#user-list .user>a { - display: block; +#user-list .user .avatar { float: left; + margin-right: 1em; +} +#user-list .user .avatar a { + display: block; } #user-list .user .details { float: left; diff --git a/public_html/js/Presenters/UserListPresenter.js b/public_html/js/Presenters/UserListPresenter.js index f4e531c1..4d05fe85 100644 --- a/public_html/js/Presenters/UserListPresenter.js +++ b/public_html/js/Presenters/UserListPresenter.js @@ -13,11 +13,14 @@ App.Presenters.UserListPresenter = function( var $el = jQuery('#content'); var templates = {}; var params; + var privileges = {}; function init(params, loaded) { topNavigationPresenter.select('users'); topNavigationPresenter.changeTitle('Users'); + privileges.canViewUsers = auth.hasPrivilege(auth.privileges.viewUsers); + promise.wait( util.promiseTemplate('user-list'), util.promiseTemplate('user-list-item')) @@ -60,7 +63,7 @@ App.Presenters.UserListPresenter = function( } function render() { - $el.html(templates.list()); + $el.html(templates.list(privileges)); } function updateActiveOrder(activeOrder) { @@ -71,10 +74,10 @@ App.Presenters.UserListPresenter = function( function renderUsers($page, users) { var $target = $page.find('.users'); _.each(users, function(user) { - var $item = jQuery('
  • ' + templates.listItem({ + var $item = jQuery('
  • ' + templates.listItem(_.extend({ user: user, formatRelativeTime: util.formatRelativeTime, - }) + '
  • '); + }, privileges)) + ''); $target.append($item); }); _.map(_.map($target.find('img'), jQuery), util.loadImagesNicely); diff --git a/public_html/templates/user-list-item.tpl b/public_html/templates/user-list-item.tpl index c4ad5d33..b9da540f 100644 --- a/public_html/templates/user-list-item.tpl +++ b/public_html/templates/user-list-item.tpl @@ -1,12 +1,23 @@
    - - <%= user.name %> - +
    + <% if (canViewUsers) { %> + + <% } %> + <%= user.name %> + <% if (canViewUsers) { %> + + <% } %> +
    +

    - + <% if (canViewUsers) { %> + + <%= user.name %> + + <% } else { %> <%= user.name %> - + <% } %>

    Joined: <%= formatRelativeTime(user.registrationTime) %>