@@ -134,12 +134,15 @@ class ReposController(BaseController):
form_result = _form.to_python(dict(request.POST))
repo_model.update(repo_name, form_result)
invalidate_cache('cached_repo_list')
h.flash(_('Repository %s updated succesfully' % repo_name),
category='success')
changed_name = form_result['repo_name']
action_logger(self.rhodecode_user, 'admin_updated_repo',
changed_name, '', self.sa)
except formencode.Invalid, errors:
c.repo_info = repo_model.get(repo_name)
c.users_array = repo_model.get_users_js()
errors.value.update({'user':c.repo_info.user.username})
return htmlfill.render(
render('admin/repos/repo_edit.html'),
@@ -79,12 +79,14 @@ class SettingsController(BaseController)
h.flash(_('Repository %s updated successfully' % repo_name),
action_logger(self.rhodecode_user, 'user_updated_repo',
render('settings/repo_settings.html'),
@@ -325,13 +325,13 @@ from mercurial import util
from mercurial.templatefilters import person as _person
def _age(curdate):
"""turns a datetime into an age string."""
if not curdate:
return ''
from datetime import timedelta, datetime
agescales = [("year", 3600 * 24 * 365),
@@ -354,12 +354,56 @@ age = lambda x:_age(x)
capitalize = lambda x: x.capitalize()
email = util.email
email_or_none = lambda x: util.email(x) if util.email(x) != x else None
person = lambda x: _person(x)
short_id = lambda x: x[:12]
def action_parser(user_log):
"""
This helper will map the specified string action into translated
fancy names with icons and links
@param action:
action = user_log.action
action_params = None
cs_links = ''
x = action.split(':')
if len(x) > 1:
action, action_params = x
if action == 'push':
revs_limit = 5
revs = action_params.split(',')
cs_links = " " + ', '.join ([link(rev,
url('changeset_home',
repo_name=user_log.repository.repo_name,
revision=rev)) for rev in revs[:revs_limit] ])
if len(revs) > revs_limit:
html_tmpl = '<span title="%s"> %s </span>'
cs_links += html_tmpl % (', '.join(r for r in revs[revs_limit:]),
_('and %s more revisions') % (len(revs) - revs_limit))
map = {'user_deleted_repo':_('User deleted repository'),
'user_created_repo':_('User created repository'),
'user_forked_repo':_('User forked repository'),
'user_updated_repo':_('User updated repository'),
'admin_deleted_repo':_('Admin delete repository'),
'admin_created_repo':_('Admin created repository'),
'admin_forked_repo':_('Admin forked repository'),
'admin_updated_repo':_('Admin updated repository'),
'push':_('Pushed') + literal(cs_links),
'pull':_('Pulled'), }
print action, action_params
return map.get(action, action)
#==============================================================================
# PERMS
from rhodecode.lib.auth import HasPermissionAny, HasPermissionAll, \
HasRepoPermissionAny, HasRepoPermissionAll
## -*- coding: utf-8 -*-
%if c.users_log:
<table>
<tr>
<th class="left">${_('Username')}</th>
<th class="left">${_('Action')}</th>
<th class="left">${_('Repository')}</th>
<th class="left">${_('Date')}</th>
<th class="left">${_('From IP')}</th>
</tr>
%for cnt,l in enumerate(c.users_log):
<tr class="parity${cnt%2}">
<td>${h.link_to(l.user.username,h.url('edit_user', id=l.user.user_id))}</td>
<td>${h.action_parser(l)}</td>
<td>
%if l.repository:
${h.link_to(l.repository.repo_name,h.url('summary_home',repo_name=l.repository.repo_name))}
%else:
${l.repository_name}
%endif
</td>
% if l.action == 'push' and l.revision:
${h.link_to('%s - %s' % (l.action,l.revision),
h.url('changeset_home',repo_name=l.repository.repo_name,revision=l.revision))}
${l.action}
<td>${l.action_date}</td>
<td>${l.user_ip}</td>
%endfor
</table>
Status change: