diff --git a/rhodecode/controllers/admin/users.py b/rhodecode/controllers/admin/users.py --- a/rhodecode/controllers/admin/users.py +++ b/rhodecode/controllers/admin/users.py @@ -40,6 +40,7 @@ from rhodecode.lib.auth import LoginRequ AuthUser from rhodecode.lib.base import BaseController, render +import rhodecode from rhodecode.model.db import User, Permission, UserEmailMap from rhodecode.model.forms import UserForm from rhodecode.model.user import UserModel @@ -72,34 +73,33 @@ class UsersController(BaseController): users_data = [] total_records = len(c.users_list) - grav_tmpl = """
gravatar
""" - usr_tmpl = """%s""" % (h.url('edit_user', id='__ID__'), '%s') - usr_tmpl = usr_tmpl.replace('__ID__', '%s') - edit_tmpl = ''' -
-
- -
- -
- ''' + _tmpl_lookup = rhodecode.CONFIG['pylons.app_globals'].mako_lookup + template = _tmpl_lookup.get_template('data_table/_dt_elements.html') + + grav_tmpl = lambda user_email, size: ( + template.get_def("user_gravatar") + .render(user_email, size, _=_, h=h)) + + user_lnk = lambda user_id, username: ( + template.get_def("user_name") + .render(user_id, username, _=_, h=h)) + + user_actions = lambda user_id, username: ( + template.get_def("user_actions") + .render(user_id, username, _=_, h=h)) + for user in c.users_list: users_data.append({ - "gravatar": grav_tmpl % h.gravatar_url(user.email, 24), + "gravatar": grav_tmpl(user. email, 24), "raw_username": user.username, - "username": usr_tmpl % (user.user_id, user.username), + "username": user_lnk(user.user_id, user.username), "firstname": user.name, "lastname": user.lastname, "last_login": h.fmt_date(user.last_login), "active": h.bool2icon(user.active), "admin": h.bool2icon(user.admin), "ldap": h.bool2icon(bool(user.ldap_dn)), - "action": edit_tmpl % (user.user_id, _('delete'), - user.user_id, - _('Confirm to delete this user: %s') % user.username - ), + "action": user_actions(user.user_id, user.username), }) c.data = json.dumps({ diff --git a/rhodecode/templates/admin/users/users.html b/rhodecode/templates/admin/users/users.html --- a/rhodecode/templates/admin/users/users.html +++ b/rhodecode/templates/admin/users/users.html @@ -140,9 +140,6 @@ clearTimeout(filterTimeout); filterTimeout = setTimeout(updateFilter,600); }); - - - diff --git a/rhodecode/templates/data_table/_dt_elements.html b/rhodecode/templates/data_table/_dt_elements.html --- a/rhodecode/templates/data_table/_dt_elements.html +++ b/rhodecode/templates/data_table/_dt_elements.html @@ -2,6 +2,12 @@ ## usage: ## <%namespace name="dt" file="/data_table/_dt_elements.html"/> +<%def name="repo_actions(repo_name)"> + ${h.form(h.url('repo', repo_name=repo_name),method='delete')} + ${h.submit('remove_%s' % repo_name,_('delete'),class_="delete_icon action_button",onclick="return confirm('"+_('Confirm to delete this repository: %s') % repo_name+"');")} + ${h.end_form()} + + <%def name="quick_menu(repo_name)">