# HG changeset patch # User Marcin Kuzminski # Date 1271527146 -7200 # Node ID 9fe23fdab9e958b1d963dc75fb4c304e5cfd66bf # Parent 6f524697f79d7345265d638b8eac6383cbb751a1 Implemented AJAH paging diff -r 6f524697f79d -r 9fe23fdab9e9 pylons_app/controllers/admin.py --- a/pylons_app/controllers/admin.py Sat Apr 17 19:07:29 2010 +0200 +++ b/pylons_app/controllers/admin.py Sat Apr 17 19:59:06 2010 +0200 @@ -59,6 +59,9 @@ .order_by(UserLogs.action_date.desc()) p = int(request.params.get('page', 1)) c.users_log = Page(users_log, page=p, items_per_page=10) + c.log_data = render('admin_log.html') + if request.params.get('partial'): + return c.log_data return render('/admin.html') def hgrc(self, dirname): diff -r 6f524697f79d -r 9fe23fdab9e9 pylons_app/templates/admin.html --- a/pylons_app/templates/admin.html Sat Apr 17 19:07:29 2010 +0200 +++ b/pylons_app/templates/admin.html Sat Apr 17 19:59:06 2010 +0200 @@ -34,31 +34,9 @@

Welcome ${c.admin_username}

-
${_('Last 10 user actions')}
- %if c.users_log: - - - - - - - - %for cnt,l in enumerate(c.users_log): - - - - - - - %endfor - - - -
${_('Username')}${_('Repository')}${_('Action')}${_('Date')}
${l.user.username}${l.repository}${l.action}${l.action_date}
${c.users_log.pager('$link_previous ~2~ $link_next')}
- %else: - ${_('No actions yet')} - %endif - +
+ ${c.log_data} +
%else:
diff -r 6f524697f79d -r 9fe23fdab9e9 pylons_app/templates/admin_log.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pylons_app/templates/admin_log.html Sat Apr 17 19:59:06 2010 +0200 @@ -0,0 +1,29 @@ +%if c.users_log: + + + + + + + + + %for cnt,l in enumerate(c.users_log): + + + + + + + %endfor + + + + +
${_('Username')}${_('Repository')}${_('Action')}${_('Date')}
${l.user.username}${l.repository}${l.action}${l.action_date}
${c.users_log.pager('$link_previous ~2~ $link_next', + onclick="""YAHOO.util.Connect.asyncRequest('GET','$partial_url',{ + success:function(o){YAHOO.util.Dom.get('user_log').innerHTML=o.responseText;} + },null); return false;""")}
+ +%else: + ${_('No actions yet')} +%endif diff -r 6f524697f79d -r 9fe23fdab9e9 pylons_app/templates/base/base.html --- a/pylons_app/templates/base/base.html Sat Apr 17 19:07:29 2010 +0200 +++ b/pylons_app/templates/base/base.html Sat Apr 17 19:59:06 2010 +0200 @@ -9,6 +9,7 @@ ${next.title()} + ${self.js()} @@ -40,4 +41,9 @@
- \ No newline at end of file + + + +<%def name="js()"> + + \ No newline at end of file