[views] (in/outof)context views now use directly dc_(long)_title() (closes #2110235)

authorAdrien Di Mascio <Adrien.DiMascio@logilab.fr>
changeset85ade620056c
branchdefault
phasepublic
hiddenno
parent revision#2dedcc15208d [table] use cell text content when cubicweb:sortvalue is not defined (closes #2093183)
child revision#5687b3d09d3a backport stable
files modified by this revision
web/views/baseviews.py
# HG changeset patch
# User Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
# Date 1324042525 -3600
# Fri Dec 16 14:35:25 2011 +0100
# Node ID 85ade620056ce4273ac2a444f3412c2202baad41
# Parent 2dedcc15208df152119bfe7fdc69b921bfed8b6d
[views] (in/outof)context views now use directly dc_(long)_title() (closes #2110235)

diff --git a/web/views/baseviews.py b/web/views/baseviews.py
@@ -155,42 +155,37 @@
1 
2  class InContextView(EntityView):
3      """:__regid__: *incontext*
4 
5      This view is used whenthe entity should be considered as displayed in its
6 -    context. By default it produces the result of `textincontext` wrapped in a
7 +    context. By default it produces the result of ``entity.dc_title()`` wrapped in a
8      link leading to the primary view of the entity.
9      """
10      __regid__ = 'incontext'
11 
12      def cell_call(self, row, col):
13          entity = self.cw_rset.get_entity(row, col)
14          desc = cut(entity.dc_description(), 50)
15 -        self.w(u'<a href="%s" title="%s">' % (
16 -            xml_escape(entity.absolute_url()), xml_escape(desc)))
17 -        self.w(xml_escape(self._cw.view('textincontext', self.cw_rset,
18 -                                        row=row, col=col)))
19 -        self.w(u'</a>')
20 -
21 +        self.w(u'<a href="%s" title="%s">%s</a>' % (
22 +            xml_escape(entity.absolute_url()), xml_escape(desc),
23 +            xml_escape(entity.dc_title())))
24 
25  class OutOfContextView(EntityView):
26      """:__regid__: *outofcontext*
27 
28      This view is used whenthe entity should be considered as displayed out of
29 -    its context. By default it produces the result of `textoutofcontext` wrapped
30 +    its context. By default it produces the result of ``entity.dc_long_title()`` wrapped
31      in a link leading to the primary view of the entity.
32      """
33      __regid__ = 'outofcontext'
34 
35      def cell_call(self, row, col):
36          entity = self.cw_rset.get_entity(row, col)
37          desc = cut(entity.dc_description(), 50)
38 -        self.w(u'<a href="%s" title="%s">' % (
39 -            xml_escape(entity.absolute_url()), xml_escape(desc)))
40 -        self.w(xml_escape(self._cw.view('textoutofcontext', self.cw_rset,
41 -                                        row=row, col=col)))
42 -        self.w(u'</a>')
43 +        self.w(u'<a href="%s" title="%s">%s</a>' % (
44 +            xml_escape(entity.absolute_url()), xml_escape(desc),
45 +            xml_escape(entity.dc_long_title())))
46 
47 
48  class OneLineView(EntityView):
49      """:__regid__: *oneline*
50 
@@ -203,13 +198,16 @@
51 
52      def cell_call(self, row, col, **kwargs):
53          """the one line view for an entity: linked text view
54          """
55          entity = self.cw_rset.get_entity(row, col)
56 -        self.w(u'<a href="%s">' % xml_escape(entity.absolute_url()))
57 -        self.w(xml_escape(self._cw.view('text', self.cw_rset, row=row, col=col)))
58 -        self.w(u'</a>')
59 +        desc = cut(entity.dc_description(), 50)
60 +        title = cut(entity.dc_title(),
61 +                    self._cw.property_value('navigation.short-line-size'))
62 +        self.w(u'<a href="%s" title="%s">%s</a>' % (
63 +                xml_escape(entity.absolute_url()), xml_escape(desc),
64 +                xml_escape(title)))
65 
66 
67  # text views ###################################################################
68 
69  class TextView(EntityView):