web/views/tabs.py
branchtls-sprint
changeset 1135 00eb43688a57
parent 1132 96752791c2b6
child 1263 01152fffd593
equal deleted inserted replaced
1134:f885df228fc0 1135:00eb43688a57
    10 from logilab.mtconverter import html_escape
    10 from logilab.mtconverter import html_escape
    11 
    11 
    12 from cubicweb import NoSelectableObject, role
    12 from cubicweb import NoSelectableObject, role
    13 from cubicweb.selectors import partial_has_related_entities
    13 from cubicweb.selectors import partial_has_related_entities
    14 from cubicweb.view import EntityView
    14 from cubicweb.view import EntityView
    15 from cubicweb.common import tags
    15 from cubicweb.common import tags, uilib
    16 
    16 
    17 
    17 
    18 class LazyViewMixin(object):
    18 class LazyViewMixin(object):
    19     """provides two convenience methods for the tab machinery
    19     """provides two convenience methods for the tab machinery
    20     can also be used to lazy-load arbitrary views
    20     can also be used to lazy-load arbitrary views
    40         self.req.add_js('cubicweb.lazy.js')
    40         self.req.add_js('cubicweb.lazy.js')
    41         urlparams = {'vid' : vid, 'mode' : 'html'}
    41         urlparams = {'vid' : vid, 'mode' : 'html'}
    42         if rql:
    42         if rql:
    43             urlparams['rql'] = rql
    43             urlparams['rql'] = rql
    44         elif eid:
    44         elif eid:
    45             urlparams['rql'] = rql_for_eid(eid)
    45             urlparams['rql'] = uilib.rql_for_eid(eid)
    46         elif rset:
    46         elif rset:
    47             urlparams['rql'] = rset.printable_rql()
    47             urlparams['rql'] = rset.printable_rql()
    48         w(u'<div id="lazy-%s" cubicweb:loadurl="%s">' % (
    48         w(u'<div id="lazy-%s" cubicweb:loadurl="%s">' % (
    49             vid, html_escape(self.build_url('json', **urlparams))))
    49             vid, html_escape(self.build_url('json', **urlparams))))
    50         if show_spinbox:
    50         if show_spinbox: