web/views/navigation.py
changeset 237 3df2e0ae2eba
parent 0 b97547f5f1fa
child 431 18b4dd650ef8
equal deleted inserted replaced
236:8ab9e72dd8f1 237:3df2e0ae2eba
     9 from rql.nodes import VariableRef, Constant
     9 from rql.nodes import VariableRef, Constant
    10 
    10 
    11 from logilab.mtconverter import html_escape
    11 from logilab.mtconverter import html_escape
    12 
    12 
    13 from cubicweb.interfaces import IPrevNext
    13 from cubicweb.interfaces import IPrevNext
    14 from cubicweb.common.selectors import (largerset_selector, sortedrset_selector,
    14 from cubicweb.common.selectors import (paginated_rset, sortedrset_selector,
    15                                     primaryview_selector, contextprop_selector,
    15                                     primaryview_selector, contextprop_selector,
    16                                     onelinerset_selector, interface_selector)
    16                                     one_line_rset, interface_selector)
    17 from cubicweb.common.uilib import cut
    17 from cubicweb.common.uilib import cut
    18 from cubicweb.web.component import EntityVComponent, NavigationComponent
    18 from cubicweb.web.component import EntityVComponent, NavigationComponent
    19 
    19 
    20 _ = unicode
    20 _ = unicode
    21 
    21 
    47     
    47     
    48 class SortedNavigation(NavigationComponent):
    48 class SortedNavigation(NavigationComponent):
    49     """sorted navigation apply if navigation is needed (according to page size)
    49     """sorted navigation apply if navigation is needed (according to page size)
    50     and if the result set is sorted
    50     and if the result set is sorted
    51     """
    51     """
    52     __selectors__ = (largerset_selector, sortedrset_selector)
    52     __selectors__ = (paginated_rset, sortedrset_selector)
    53     
    53     
    54     # number of considered chars to build page links
    54     # number of considered chars to build page links
    55     nb_chars = 5
    55     nb_chars = 5
    56     
    56     
    57     def display_func(self, rset, col, attrname):
    57     def display_func(self, rset, col, attrname):
   174     id = 'prevnext'
   174     id = 'prevnext'
   175     # register msg not generated since no entity implements IPrevNext in cubicweb
   175     # register msg not generated since no entity implements IPrevNext in cubicweb
   176     # itself
   176     # itself
   177     title = _('contentnavigation_prevnext')
   177     title = _('contentnavigation_prevnext')
   178     help = _('contentnavigation_prevnext_description')
   178     help = _('contentnavigation_prevnext_description')
   179     __selectors__ = (onelinerset_selector, primaryview_selector,
   179     __selectors__ = (one_line_rset, primaryview_selector,
   180                      contextprop_selector, interface_selector)
   180                      contextprop_selector, interface_selector)
   181     accepts_interfaces = (IPrevNext,)
   181     accepts_interfaces = (IPrevNext,)
   182     context = 'navbottom'
   182     context = 'navbottom'
   183     order = 10
   183     order = 10
   184     def call(self, view=None):
   184     def call(self, view=None):