Changeset - 99afa4d28e2b
[Not reviewed]
default
0 2 0
Marcin Kuzminski - 16 years ago 2010-04-13 22:30:52
marcin@python-blog.com
Changed order of user actions log
2 files changed with 3 insertions and 2 deletions:
0 comments (0 inline, 0 general)
pylons_app/controllers/admin.py
Show inline comments
 
@@ -44,25 +44,26 @@ class AdminController(BaseController):
 
            except formencode.Invalid, error:
 
                c.form_result = error.value
 
                c.form_errors = error.error_dict or {}
 
                html = render('/admin.html')
 

	
 
                return htmlfill.render(
 
                    html,
 
                    defaults=c.form_result,
 
                    encoding="UTF-8"
 
                )
 
        if c.admin_user:
 
            sa = meta.Session
 
            c.users_log = sa.query(UserLogs).limit(10).all()
 
            c.users_log = sa.query(UserLogs)\
 
                .order_by(UserLogs.action_date.desc()).limit(10).all()
 
        return render('/admin.html')
 

	
 
    def hgrc(self, dirname):
 
        filename = os.path.join(dirname, '.hg', 'hgrc')
 
        return filename
 

	
 
    def add_repo(self, new_repo):
 
        
 

	
 
        #extra check it can be add since it's the command
 
        if new_repo == '_admin':
 
            c.msg = 'DENIED'
pylons_app/templates/admin.html
Show inline comments
 
@@ -25,25 +25,25 @@
 
    %if c.admin_user:
 
    <ul class="submenu">
 
        <li>
 
            ${h.link_to(u'Repos',h.url('repos'))}
 
        </li>
 
        <li>
 
            ${h.link_to(u'Users',h.url('users'))}
 
        </li>
 
    </ul>
 
    <br/>
 
    <div>
 
        <h2>Welcome ${c.admin_username}</h2>
 
        <div>Last 5 user actions</div>
 
        <div>${_('Last 10 user actions')</div>
 
        %if c.users_log:
 
	        <table>
 
	        <tr>
 
	        	<td>${_('Username')}</td>
 
	        	<td>${_('Repository')}</td>
 
	        	<td>${_('Action')}</td>
 
	        	<td>${_('Date')}</td>
 
	        </tr>
 
	        %for cnt,l in enumerate(c.users_log):
 
				<tr class="parity${cnt%2}">
 
					<td>${l.user.username}</td>
 
					<td>${l.repository}</td>
0 comments (0 inline, 0 general)