[views/navigation] use the proper icons instead of ascii art (closes #1624943)

authorAurelien Campeas <aurelien.campeas@logilab.fr>
changeseta832677c0aa6
branchstable
phasepublic
hiddenno
parent revision#6f6253e44bdd devtools: Fix cleanup of temporary database (closes #1908656)
child revision#07c74f5585d1 [debian] build the book with no auto-compression of book files (closes: #1906581)
files modified by this revision
web/views/navigation.py
# HG changeset patch
# User Aurelien Campeas <aurelien.campeas@logilab.fr>
# Date 1315407387 -7200
# Wed Sep 07 16:56:27 2011 +0200
# Branch stable
# Node ID a832677c0aa69a6d139f80b8651336deb20c4003
# Parent 6f6253e44bdd2a24fe1be656412bd544266b3d17
[views/navigation] use the proper icons instead of ascii art (closes #1624943)

diff --git a/web/views/navigation.py b/web/views/navigation.py
@@ -209,10 +209,18 @@
1      help = _('ctxcomponents_prevnext_description')
2      __select__ = EntityCtxComponent.__select__ & adaptable('IPrevNext')
3      context = 'navbottom'
4      order = 10
5 
6 +    @property
7 +    def prev_icon(self):
8 +        return '<img src="%s"/>' % xml_escape(self._cw.data_url('go_prev.png'))
9 +
10 +    @property
11 +    def next_icon(self):
12 +        return '<img src="%s"/>' % xml_escape(self._cw.data_url('go_next.png'))
13 +
14      def init_rendering(self):
15          adapter = self.entity.cw_adapt_to('IPrevNext')
16          self.previous = adapter.previous_entity()
17          self.next = adapter.next_entity()
18          if not (self.previous or self.next):
@@ -230,20 +238,23 @@
19          if self.next:
20              self.prevnext_entity(w, self.next, 'next')
21 
22      def prevnext_entity(self, w, entity, type):
23          textsize = self._cw.property_value('navigation.short-line-size')
24 +        content = xml_escape(cut(entity.dc_title(), textsize))
25          if type == 'prev':
26              title = self._cw._('i18nprevnext_previous')
27 -            icon = u'&lt;&lt; '
28 +            icon = self.prev_icon
29              cssclass = u'previousEntity left'
30 +            content = icon + content
31          else:
32              title = self._cw._('i18nprevnext_next')
33 -            icon = u'&gt;&gt; '
34 +            icon = self.next_icon
35              cssclass = u'nextEntity right'
36 +            content = content + '&#160;&#160;' + icon
37          self.prevnext_div(w, type, cssclass, entity.absolute_url(),
38 -                          title, icon + xml_escape(cut(entity.dc_title(), textsize)))
39 +                          title, content)
40 
41      def prevnext_div(self, w, type, cssclass, url, title, content):
42          w(u'<div class="%s">' % cssclass)
43          w(u'<a href="%s" title="%s">%s</a>' % (xml_escape(url),
44                                                 xml_escape(title),