web/views/ibreadcrumbs.py
author Aurelien Campeas <aurelien.campeas@logilab.fr>
Wed, 21 Oct 2009 11:34:11 +0200
branchstable
changeset 3767 03924de0014d
parent 3523 16880e7ee3fa
child 3524 a3431f4e2f40
child 3862 4908c7156eab
permissions -rw-r--r--
reledit: stuff the value into its own div and properly hide it when necessary (but dont lump it with the landingzone div for it switches the form on when one clicks on a value to traverse it)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
     1
"""navigation components definition for CubicWeb web client
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
     2
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
     3
:organization: Logilab
1977
606923dff11b big bunch of copyright / docstring update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 1882
diff changeset
     4
:copyright: 2001-2009 LOGILAB S.A. (Paris, FRANCE), license is LGPL v2.
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
     5
:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
1977
606923dff11b big bunch of copyright / docstring update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 1882
diff changeset
     6
:license: GNU Lesser General Public License, v2.1 - http://www.gnu.org/licenses
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
     7
"""
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
     8
__docformat__ = "restructuredtext en"
1882
ce662160bb46 cleanup
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 1802
diff changeset
     9
_ = unicode
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    10
2312
af4d8f75c5db use xml_escape
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 1977
diff changeset
    11
from logilab.mtconverter import xml_escape
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    12
3007
a15e982aa9a3 [breadcrumb] only provides a breadcrumbs component, no more as pluggable content nav comp; provides alternative implentation for rset with more than one entity
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2996
diff changeset
    13
from cubicweb.interfaces import IBreadCrumbs
a15e982aa9a3 [breadcrumb] only provides a breadcrumbs component, no more as pluggable content nav comp; provides alternative implentation for rset with more than one entity
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2996
diff changeset
    14
from cubicweb.selectors import (one_line_rset, implements, one_etype_rset,
a15e982aa9a3 [breadcrumb] only provides a breadcrumbs component, no more as pluggable content nav comp; provides alternative implentation for rset with more than one entity
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2996
diff changeset
    15
                                two_lines_rset, any_rset)
a15e982aa9a3 [breadcrumb] only provides a breadcrumbs component, no more as pluggable content nav comp; provides alternative implentation for rset with more than one entity
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2996
diff changeset
    16
from cubicweb.view import EntityView, Component
713
5adb6d8e5fa7 update imports of "cubicweb.common.entity" and use the new module path "cubicweb.entity"
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 692
diff changeset
    17
# don't use AnyEntity since this may cause bug with isinstance() due to reloading
984
536e421b082b import updates
sylvain.thenault@logilab.fr
parents: 742
diff changeset
    18
from cubicweb.entity import Entity
3179
0684544f6d0d from 3.5 branch; XXX the test depends on an eid value
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 3030
diff changeset
    19
from cubicweb.common import tags, uilib
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    20
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    21
3007
a15e982aa9a3 [breadcrumb] only provides a breadcrumbs component, no more as pluggable content nav comp; provides alternative implentation for rset with more than one entity
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2996
diff changeset
    22
class BreadCrumbEntityVComponent(Component):
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    23
    id = 'breadcrumbs'
3523
16880e7ee3fa don't accept None to avoid error
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 3184
diff changeset
    24
    __select__ = one_line_rset() & implements(IBreadCrumbs, accept_none=False)
3007
a15e982aa9a3 [breadcrumb] only provides a breadcrumbs component, no more as pluggable content nav comp; provides alternative implentation for rset with more than one entity
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2996
diff changeset
    25
a15e982aa9a3 [breadcrumb] only provides a breadcrumbs component, no more as pluggable content nav comp; provides alternative implentation for rset with more than one entity
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2996
diff changeset
    26
    property_defs = {
a15e982aa9a3 [breadcrumb] only provides a breadcrumbs component, no more as pluggable content nav comp; provides alternative implentation for rset with more than one entity
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2996
diff changeset
    27
        _('visible'):  dict(type='Boolean', default=True,
a15e982aa9a3 [breadcrumb] only provides a breadcrumbs component, no more as pluggable content nav comp; provides alternative implentation for rset with more than one entity
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2996
diff changeset
    28
                            help=_('display the component or not')),
a15e982aa9a3 [breadcrumb] only provides a breadcrumbs component, no more as pluggable content nav comp; provides alternative implentation for rset with more than one entity
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2996
diff changeset
    29
        }
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    30
    title = _('contentnavigation_breadcrumbs')
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    31
    help = _('contentnavigation_breadcrumbs_description')
2996
866a2c135c33 B #345282 xhtml requires to use &#160; instead of &nbsp;
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2312
diff changeset
    32
    separator = u'&#160;&gt;&#160;'
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    33
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    34
    def call(self, view=None, first_separator=True):
3179
0684544f6d0d from 3.5 branch; XXX the test depends on an eid value
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 3030
diff changeset
    35
        entity = self.rset.get_entity(0, 0)
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    36
        path = entity.breadcrumbs(view)
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    37
        if path:
3007
a15e982aa9a3 [breadcrumb] only provides a breadcrumbs component, no more as pluggable content nav comp; provides alternative implentation for rset with more than one entity
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2996
diff changeset
    38
            self.w(u'<span id="breadcrumbs" class="pathbar">')
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    39
            if first_separator:
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    40
                self.w(self.separator)
3007
a15e982aa9a3 [breadcrumb] only provides a breadcrumbs component, no more as pluggable content nav comp; provides alternative implentation for rset with more than one entity
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2996
diff changeset
    41
            self.render_breadcrumbs(entity, path)
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    42
            self.w(u'</span>')
1802
d628defebc17 delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 984
diff changeset
    43
3007
a15e982aa9a3 [breadcrumb] only provides a breadcrumbs component, no more as pluggable content nav comp; provides alternative implentation for rset with more than one entity
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2996
diff changeset
    44
    def render_breadcrumbs(self, contextentity, path):
a15e982aa9a3 [breadcrumb] only provides a breadcrumbs component, no more as pluggable content nav comp; provides alternative implentation for rset with more than one entity
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2996
diff changeset
    45
        root = path.pop(0)
a15e982aa9a3 [breadcrumb] only provides a breadcrumbs component, no more as pluggable content nav comp; provides alternative implentation for rset with more than one entity
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2996
diff changeset
    46
        if isinstance(root, Entity):
a15e982aa9a3 [breadcrumb] only provides a breadcrumbs component, no more as pluggable content nav comp; provides alternative implentation for rset with more than one entity
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2996
diff changeset
    47
            self.w(u'<a href="%s">%s</a>' % (self.req.build_url(root.id),
a15e982aa9a3 [breadcrumb] only provides a breadcrumbs component, no more as pluggable content nav comp; provides alternative implentation for rset with more than one entity
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2996
diff changeset
    48
                                             root.dc_type('plural')))
a15e982aa9a3 [breadcrumb] only provides a breadcrumbs component, no more as pluggable content nav comp; provides alternative implentation for rset with more than one entity
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2996
diff changeset
    49
            self.w(self.separator)
a15e982aa9a3 [breadcrumb] only provides a breadcrumbs component, no more as pluggable content nav comp; provides alternative implentation for rset with more than one entity
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2996
diff changeset
    50
        self.wpath_part(root, contextentity, not path)
a15e982aa9a3 [breadcrumb] only provides a breadcrumbs component, no more as pluggable content nav comp; provides alternative implentation for rset with more than one entity
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2996
diff changeset
    51
        for i, parent in enumerate(path):
a15e982aa9a3 [breadcrumb] only provides a breadcrumbs component, no more as pluggable content nav comp; provides alternative implentation for rset with more than one entity
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2996
diff changeset
    52
            self.w(self.separator)
a15e982aa9a3 [breadcrumb] only provides a breadcrumbs component, no more as pluggable content nav comp; provides alternative implentation for rset with more than one entity
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2996
diff changeset
    53
            self.w(u"\n")
a15e982aa9a3 [breadcrumb] only provides a breadcrumbs component, no more as pluggable content nav comp; provides alternative implentation for rset with more than one entity
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2996
diff changeset
    54
            self.wpath_part(parent, contextentity, i == len(path) - 1)
a15e982aa9a3 [breadcrumb] only provides a breadcrumbs component, no more as pluggable content nav comp; provides alternative implentation for rset with more than one entity
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2996
diff changeset
    55
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    56
    def wpath_part(self, part, contextentity, last=False):
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    57
        if isinstance(part, Entity):
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    58
            if last and part.eid == contextentity.eid:
3179
0684544f6d0d from 3.5 branch; XXX the test depends on an eid value
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 3030
diff changeset
    59
                self.w(xml_escape(part.view('breadcrumbtext')))
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    60
            else:
3179
0684544f6d0d from 3.5 branch; XXX the test depends on an eid value
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 3030
diff changeset
    61
                self.w(part.view('breadcrumbs'))
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    62
        elif isinstance(part, tuple):
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    63
            url, title = part
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    64
            textsize = self.req.property_value('navigation.short-line-size')
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    65
            self.w(u'<a href="%s">%s</a>' % (
3179
0684544f6d0d from 3.5 branch; XXX the test depends on an eid value
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 3030
diff changeset
    66
                xml_escape(url), xml_escape(uilib.cut(title, textsize))))
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    67
        else:
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    68
            textsize = self.req.property_value('navigation.short-line-size')
3179
0684544f6d0d from 3.5 branch; XXX the test depends on an eid value
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 3030
diff changeset
    69
            self.w(uilib.cut(unicode(part), textsize))
1802
d628defebc17 delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 984
diff changeset
    70
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    71
3007
a15e982aa9a3 [breadcrumb] only provides a breadcrumbs component, no more as pluggable content nav comp; provides alternative implentation for rset with more than one entity
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2996
diff changeset
    72
class BreadCrumbETypeVComponent(BreadCrumbEntityVComponent):
3523
16880e7ee3fa don't accept None to avoid error
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 3184
diff changeset
    73
    __select__ = two_lines_rset() & one_etype_rset() & \
16880e7ee3fa don't accept None to avoid error
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 3184
diff changeset
    74
                 implements(IBreadCrumbs, accept_none=False)
3007
a15e982aa9a3 [breadcrumb] only provides a breadcrumbs component, no more as pluggable content nav comp; provides alternative implentation for rset with more than one entity
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2996
diff changeset
    75
a15e982aa9a3 [breadcrumb] only provides a breadcrumbs component, no more as pluggable content nav comp; provides alternative implentation for rset with more than one entity
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2996
diff changeset
    76
    def render_breadcrumbs(self, contextentity, path):
a15e982aa9a3 [breadcrumb] only provides a breadcrumbs component, no more as pluggable content nav comp; provides alternative implentation for rset with more than one entity
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2996
diff changeset
    77
        # XXX hack: only display etype name or first non entity path part
a15e982aa9a3 [breadcrumb] only provides a breadcrumbs component, no more as pluggable content nav comp; provides alternative implentation for rset with more than one entity
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2996
diff changeset
    78
        root = path.pop(0)
a15e982aa9a3 [breadcrumb] only provides a breadcrumbs component, no more as pluggable content nav comp; provides alternative implentation for rset with more than one entity
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2996
diff changeset
    79
        if isinstance(root, Entity):
a15e982aa9a3 [breadcrumb] only provides a breadcrumbs component, no more as pluggable content nav comp; provides alternative implentation for rset with more than one entity
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2996
diff changeset
    80
            self.w(u'<a href="%s">%s</a>' % (self.req.build_url(root.id),
a15e982aa9a3 [breadcrumb] only provides a breadcrumbs component, no more as pluggable content nav comp; provides alternative implentation for rset with more than one entity
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2996
diff changeset
    81
                                             root.dc_type('plural')))
a15e982aa9a3 [breadcrumb] only provides a breadcrumbs component, no more as pluggable content nav comp; provides alternative implentation for rset with more than one entity
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2996
diff changeset
    82
        else:
3030
e086df78e267 B [views] fixing breadcrumbs
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 3015
diff changeset
    83
            self.wpath_part(root, contextentity, not path)
3007
a15e982aa9a3 [breadcrumb] only provides a breadcrumbs component, no more as pluggable content nav comp; provides alternative implentation for rset with more than one entity
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2996
diff changeset
    84
a15e982aa9a3 [breadcrumb] only provides a breadcrumbs component, no more as pluggable content nav comp; provides alternative implentation for rset with more than one entity
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2996
diff changeset
    85
a15e982aa9a3 [breadcrumb] only provides a breadcrumbs component, no more as pluggable content nav comp; provides alternative implentation for rset with more than one entity
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2996
diff changeset
    86
class BreadCrumbAnyRSetVComponent(BreadCrumbEntityVComponent):
a15e982aa9a3 [breadcrumb] only provides a breadcrumbs component, no more as pluggable content nav comp; provides alternative implentation for rset with more than one entity
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2996
diff changeset
    87
    __select__ = any_rset()
a15e982aa9a3 [breadcrumb] only provides a breadcrumbs component, no more as pluggable content nav comp; provides alternative implentation for rset with more than one entity
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2996
diff changeset
    88
3015
0588e39f6743 [breadcrumb] BreadCrumbAnyRSetVComponent should implements call()
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 3007
diff changeset
    89
    def call(self, view=None, first_separator=True):
0588e39f6743 [breadcrumb] BreadCrumbAnyRSetVComponent should implements call()
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 3007
diff changeset
    90
        self.w(u'<span id="breadcrumbs" class="pathbar">')
0588e39f6743 [breadcrumb] BreadCrumbAnyRSetVComponent should implements call()
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 3007
diff changeset
    91
        if first_separator:
0588e39f6743 [breadcrumb] BreadCrumbAnyRSetVComponent should implements call()
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 3007
diff changeset
    92
            self.w(self.separator)
3007
a15e982aa9a3 [breadcrumb] only provides a breadcrumbs component, no more as pluggable content nav comp; provides alternative implentation for rset with more than one entity
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2996
diff changeset
    93
        self.w(self.req._('search'))
3015
0588e39f6743 [breadcrumb] BreadCrumbAnyRSetVComponent should implements call()
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 3007
diff changeset
    94
        self.w(u'</span>')
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    95
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    96
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    97
class BreadCrumbView(EntityView):
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    98
    id = 'breadcrumbs'
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    99
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   100
    def cell_call(self, row, col):
3179
0684544f6d0d from 3.5 branch; XXX the test depends on an eid value
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 3030
diff changeset
   101
        entity = self.rset.get_entity(row, col)
0684544f6d0d from 3.5 branch; XXX the test depends on an eid value
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 3030
diff changeset
   102
        desc = xml_escape(uilib.cut(entity.dc_description(), 50))
0684544f6d0d from 3.5 branch; XXX the test depends on an eid value
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 3030
diff changeset
   103
        # XXX remember camember : tags.a autoescapes !
0684544f6d0d from 3.5 branch; XXX the test depends on an eid value
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 3030
diff changeset
   104
        self.w(tags.a(entity.view('breadcrumbtext'),
0684544f6d0d from 3.5 branch; XXX the test depends on an eid value
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 3030
diff changeset
   105
                      href=entity.absolute_url(), title=desc))
0684544f6d0d from 3.5 branch; XXX the test depends on an eid value
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 3030
diff changeset
   106
0684544f6d0d from 3.5 branch; XXX the test depends on an eid value
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 3030
diff changeset
   107
0684544f6d0d from 3.5 branch; XXX the test depends on an eid value
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 3030
diff changeset
   108
class BreadCrumbTextView(EntityView):
0684544f6d0d from 3.5 branch; XXX the test depends on an eid value
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 3030
diff changeset
   109
    id = 'breadcrumbtext'
0684544f6d0d from 3.5 branch; XXX the test depends on an eid value
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 3030
diff changeset
   110
0684544f6d0d from 3.5 branch; XXX the test depends on an eid value
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 3030
diff changeset
   111
    def cell_call(self, row, col):
0684544f6d0d from 3.5 branch; XXX the test depends on an eid value
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 3030
diff changeset
   112
        entity = self.rset.get_entity(row, col)
0684544f6d0d from 3.5 branch; XXX the test depends on an eid value
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 3030
diff changeset
   113
        textsize = self.req.property_value('navigation.short-line-size')
0684544f6d0d from 3.5 branch; XXX the test depends on an eid value
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 3030
diff changeset
   114
        self.w(uilib.cut(entity.dc_title(), textsize))