[views] use icons for user menu and login (header) (closes #3803684)
authorDavid Douard <david.douard@logilab.fr>
Mon, 05 May 2014 11:25:59 +0200
changeset 10119 3d7e500a0202
parent 10118 78ab2b14048a
child 10120 5c7d69381a5d
[views] use icons for user menu and login (header) (closes #3803684) - use icons from the embedded pictograms font for: - authenticated user menu (userActionsBox) - login (CookieLoginComponent) - do not display "anonymous" when not logged in
web/views/basecomponents.py
--- a/web/views/basecomponents.py	Thu Dec 04 11:37:18 2014 +0100
+++ b/web/views/basecomponents.py	Mon May 05 11:25:59 2014 +0200
@@ -119,8 +119,8 @@
                   & configuration_values('auth-mode', 'cookie'))
     context = 'header-right'
     loginboxid = 'popupLoginBox'
-    _html = u"""[<a class="logout" title="%s" href="javascript:
-cw.htmlhelpers.popupLoginBox('%s', '__login');">%s</a>]"""
+    _html = u"""<a class="logout icon-login" title="%s" href="javascript:
+cw.htmlhelpers.popupLoginBox('%s', '__login');">%s</a>"""
 
     def render(self, w):
         # XXX bw compat, though should warn about subclasses redefining call
@@ -128,6 +128,7 @@
         self.call()
 
     def call(self):
+        self._cw.add_css('cubicweb.pictograms.css')
         self.w(self._html % (self._cw._('login / password'),
                              self.loginboxid, self._cw._('i18n_login_popup')))
         self._cw.view('logform', rset=self.cw_rset, id=self.loginboxid,
@@ -160,17 +161,17 @@
     order = HeaderComponent.order - 10
 
     def render(self, w):
-        w(u'<span class="caption">%s</span>' % self._cw._('anonymous'))
-
+        pass
 
 class AuthenticatedUserStatus(AnonUserStatusLink):
     __select__ = authenticated_user()
 
     def render(self, w):
         # display useractions and siteactions
+        self._cw.add_css('cubicweb.pictograms.css')
         actions = self._cw.vreg['actions'].possible_actions(self._cw, rset=self.cw_rset)
         box = MenuWidget('', 'userActionsBox', _class='', islist=False)
-        menu = PopupBoxMenu(self._cw.user.login, isitem=False)
+        menu = PopupBoxMenu(self._cw.user.login, isitem=False, link_class='icon-user')
         box.append(menu)
         for action in actions.get('useractions', ()):
             menu.append(self.action_link(action))