[user mgmt] should show user login in first column in any case (e.g. application specific override) stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Fri, 06 May 2011 18:20:26 +0200
branchstable
changeset 7327 72bb52edbb6b
parent 7324 5f7813ae9fb8
child 7328 a95164cf1421
[user mgmt] should show user login in first column in any case (e.g. application specific override)
web/views/cwuser.py
--- a/web/views/cwuser.py	Fri May 06 11:28:42 2011 +0200
+++ b/web/views/cwuser.py	Fri May 06 18:20:26 2011 +0200
@@ -24,6 +24,7 @@
 
 from logilab.mtconverter import xml_escape
 
+from cubicweb import tags
 from cubicweb.schema import display_name
 from cubicweb.selectors import one_line_rset, is_instance, match_user_groups
 from cubicweb.view import EntityView, StartupView
@@ -202,7 +203,8 @@
                    display_name(self._cw, 'CWSource'))
         super(CWUserTable, self).call(
             paginate=True, displayfilter=True,
-            cellvids={4: 'cw.user-table.group-cell'},
+            cellvids={0: 'cw.user.login',
+                      4: 'cw.user-table.group-cell'},
             headers=headers, **kwargs)
 
 
@@ -213,3 +215,11 @@
     def cell_call(self, row, col, **kwargs):
         entity = self.cw_rset.get_entity(row, col)
         self.w(entity.view('reledit', rtype='in_group', role='subject'))
+
+class CWUserLoginCell(EntityView):
+    __regid__ = 'cw.user.login'
+    __select__ = is_instance('CWUser')
+
+    def cell_call(self, row, col, **kwargs):
+        entity = self.cw_rset.get_entity(row, col)
+        self.w(tags.a(entity.login, href=entity.absolute_url()))