web/views/basecomponents.py
changeset 237 3df2e0ae2eba
parent 143 c4f11f70b75e
child 431 18b4dd650ef8
equal deleted inserted replaced
236:8ab9e72dd8f1 237:3df2e0ae2eba
    12 
    12 
    13 from rql import parse
    13 from rql import parse
    14 
    14 
    15 from cubicweb import Unauthorized
    15 from cubicweb import Unauthorized
    16 from cubicweb.common.uilib import html_escape, toggle_action
    16 from cubicweb.common.uilib import html_escape, toggle_action
    17 from cubicweb.common.selectors import yes_selector, nfentity_selector, onelinerset_selector
    17 from cubicweb.common.selectors import yes, nfentity_selector, one_line_rset
    18 from cubicweb.schema import display_name
    18 from cubicweb.schema import display_name
    19 from cubicweb.common.selectors import (chainfirst, multitype_selector,
    19 from cubicweb.common.selectors import (chainfirst, multitype_selector,
    20                                     req_form_params_selector)
    20                                     req_form_params_selector)
    21 
    21 
    22 from cubicweb.web.htmlwidgets import MenuWidget, PopupBoxMenu, BoxSeparator, BoxLink
    22 from cubicweb.web.htmlwidgets import MenuWidget, PopupBoxMenu, BoxSeparator, BoxLink
   112 
   112 
   113 class ApplicationMessage(SingletonVComponent):
   113 class ApplicationMessage(SingletonVComponent):
   114     """display application's messages given using the __message parameter
   114     """display application's messages given using the __message parameter
   115     into a special div section
   115     into a special div section
   116     """
   116     """
   117     __selectors__ = yes_selector,
   117     __selectors__ = yes,
   118     id = 'applmessages'
   118     id = 'applmessages'
   119     site_wide = True # don't want user to hide this component using an eproperty
   119     site_wide = True # don't want user to hide this component using an eproperty
   120 
   120 
   121     def call(self):
   121     def call(self):
   122         msgs = [msg for msg in (self.req.get_shared_data('sources_error', pop=True),
   122         msgs = [msg for msg in (self.req.get_shared_data('sources_error', pop=True),
   243     def feed_url(self):
   243     def feed_url(self):
   244         return self.build_url(rql=self.limited_rql(), vid='rss')
   244         return self.build_url(rql=self.limited_rql(), vid='rss')
   245 
   245 
   246 class RSSEntityFeedURL(VComponent):
   246 class RSSEntityFeedURL(VComponent):
   247     id = 'rss_feed_url'
   247     id = 'rss_feed_url'
   248     __selectors__ = (nfentity_selector, onelinerset_selector)
   248     __selectors__ = (nfentity_selector, one_line_rset)
   249     
   249     
   250     def feed_url(self):
   250     def feed_url(self):
   251         return self.entity(0, 0).rss_feed_url()
   251         return self.entity(0, 0).rss_feed_url()
   252 
   252