##// END OF EJS Templates
#48 rewrote action logger, translated action logger messages, added some extra messages. Linked and showed pushed revisions in logs
marcink -
r660:df613780 beta
parent child Browse files
Show More
@@ -137,6 +137,9 b' class ReposController(BaseController):'
137 h.flash(_('Repository %s updated succesfully' % repo_name),
137 h.flash(_('Repository %s updated succesfully' % repo_name),
138 category='success')
138 category='success')
139 changed_name = form_result['repo_name']
139 changed_name = form_result['repo_name']
140 action_logger(self.rhodecode_user, 'admin_updated_repo',
141 changed_name, '', self.sa)
142
140 except formencode.Invalid, errors:
143 except formencode.Invalid, errors:
141 c.repo_info = repo_model.get(repo_name)
144 c.repo_info = repo_model.get(repo_name)
142 c.users_array = repo_model.get_users_js()
145 c.users_array = repo_model.get_users_js()
@@ -82,6 +82,8 b' class SettingsController(BaseController)'
82 h.flash(_('Repository %s updated successfully' % repo_name),
82 h.flash(_('Repository %s updated successfully' % repo_name),
83 category='success')
83 category='success')
84 changed_name = form_result['repo_name']
84 changed_name = form_result['repo_name']
85 action_logger(self.rhodecode_user, 'user_updated_repo',
86 changed_name, '', self.sa)
85 except formencode.Invalid, errors:
87 except formencode.Invalid, errors:
86 c.repo_info = repo_model.get(repo_name)
88 c.repo_info = repo_model.get(repo_name)
87 c.users_array = repo_model.get_users_js()
89 c.users_array = repo_model.get_users_js()
@@ -328,7 +328,7 b' from mercurial.templatefilters import pe'
328
328
329 def _age(curdate):
329 def _age(curdate):
330 """turns a datetime into an age string."""
330 """turns a datetime into an age string."""
331
331
332 if not curdate:
332 if not curdate:
333 return ''
333 return ''
334
334
@@ -357,6 +357,50 b' email_or_none = lambda x: util.email(x) '
357 person = lambda x: _person(x)
357 person = lambda x: _person(x)
358 short_id = lambda x: x[:12]
358 short_id = lambda x: x[:12]
359
359
360
361 def action_parser(user_log):
362 """
363 This helper will map the specified string action into translated
364 fancy names with icons and links
365
366 @param action:
367 """
368 action = user_log.action
369 action_params = None
370 cs_links = ''
371
372 x = action.split(':')
373
374 if len(x) > 1:
375 action, action_params = x
376
377 if action == 'push':
378 revs_limit = 5
379 revs = action_params.split(',')
380 cs_links = " " + ', '.join ([link(rev,
381 url('changeset_home',
382 repo_name=user_log.repository.repo_name,
383 revision=rev)) for rev in revs[:revs_limit] ])
384 if len(revs) > revs_limit:
385 html_tmpl = '<span title="%s"> %s </span>'
386 cs_links += html_tmpl % (', '.join(r for r in revs[revs_limit:]),
387 _('and %s more revisions') % (len(revs) - revs_limit))
388
389 map = {'user_deleted_repo':_('User deleted repository'),
390 'user_created_repo':_('User created repository'),
391 'user_forked_repo':_('User forked repository'),
392 'user_updated_repo':_('User updated repository'),
393 'admin_deleted_repo':_('Admin delete repository'),
394 'admin_created_repo':_('Admin created repository'),
395 'admin_forked_repo':_('Admin forked repository'),
396 'admin_updated_repo':_('Admin updated repository'),
397 'push':_('Pushed') + literal(cs_links),
398 'pull':_('Pulled'), }
399
400 print action, action_params
401 return map.get(action, action)
402
403
360 #==============================================================================
404 #==============================================================================
361 # PERMS
405 # PERMS
362 #==============================================================================
406 #==============================================================================
@@ -3,8 +3,8 b''
3 <table>
3 <table>
4 <tr>
4 <tr>
5 <th class="left">${_('Username')}</th>
5 <th class="left">${_('Username')}</th>
6 <th class="left">${_('Action')}</th>
6 <th class="left">${_('Repository')}</th>
7 <th class="left">${_('Repository')}</th>
7 <th class="left">${_('Action')}</th>
8 <th class="left">${_('Date')}</th>
8 <th class="left">${_('Date')}</th>
9 <th class="left">${_('From IP')}</th>
9 <th class="left">${_('From IP')}</th>
10 </tr>
10 </tr>
@@ -12,6 +12,7 b''
12 %for cnt,l in enumerate(c.users_log):
12 %for cnt,l in enumerate(c.users_log):
13 <tr class="parity${cnt%2}">
13 <tr class="parity${cnt%2}">
14 <td>${h.link_to(l.user.username,h.url('edit_user', id=l.user.user_id))}</td>
14 <td>${h.link_to(l.user.username,h.url('edit_user', id=l.user.user_id))}</td>
15 <td>${h.action_parser(l)}</td>
15 <td>
16 <td>
16 %if l.repository:
17 %if l.repository:
17 ${h.link_to(l.repository.repo_name,h.url('summary_home',repo_name=l.repository.repo_name))}
18 ${h.link_to(l.repository.repo_name,h.url('summary_home',repo_name=l.repository.repo_name))}
@@ -19,14 +20,7 b''
19 ${l.repository_name}
20 ${l.repository_name}
20 %endif
21 %endif
21 </td>
22 </td>
22 <td>
23
23 % if l.action == 'push' and l.revision:
24 ${h.link_to('%s - %s' % (l.action,l.revision),
25 h.url('changeset_home',repo_name=l.repository.repo_name,revision=l.revision))}
26 %else:
27 ${l.action}
28 %endif
29 </td>
30 <td>${l.action_date}</td>
24 <td>${l.action_date}</td>
31 <td>${l.user_ip}</td>
25 <td>${l.user_ip}</td>
32 </tr>
26 </tr>
General Comments 0
You need to be logged in to leave comments. Login now