Ejemplo n.º 1
0
    def __init__(self,
                 title,
                 dest,
                 sr_path=True,
                 nocname=False,
                 aliases=None,
                 target="",
                 use_params=False,
                 css_class='',
                 data=None):
        aliases = aliases or []
        aliases = set(_force_unicode(a.rstrip('/')) for a in aliases)
        if dest:
            aliases.add(_force_unicode(dest.rstrip('/')))

        self.title = title
        self.dest = dest
        self.selected = False

        self.sr_path = sr_path
        self.nocname = nocname
        self.aliases = aliases
        self.target = target
        self.use_params = use_params
        self.data = data

        Styled.__init__(self, self._style, css_class=css_class)
Ejemplo n.º 2
0
    def __init__(self, options, default=None, title='', type="dropdown",
                 base_path='', separator='|', _id='', css_class=''):
        self.options = options
        self.default = default
        self.title = title
        self.base_path = base_path
        self.separator = separator

        # add the menu style, but preserve existing css_class parameter
        style, base_css_class = menu_style(type)
        css_class = base_css_class + ((' ' + css_class) if css_class else '')

        # since the menu contains the path info, it's buttons need a
        # configuration pass to get them pointing to the proper urls
        for opt in self.options:
            opt.build(self.base_path)

            # add "choice" css class to each button
            if opt.css_class:
                opt.css_class += " choice"
            else:
                opt.css_class = "choice"

        self.selected = self.find_selected()

        Styled.__init__(self, style, _id=_id, css_class=css_class)
Ejemplo n.º 3
0
    def __init__(self,
                 options,
                 default=None,
                 title='',
                 type="dropdown",
                 base_path='',
                 separator='|',
                 _id='',
                 css_class=''):
        self.options = options
        self.default = default
        self.title = title
        self.base_path = base_path
        self.separator = separator

        # add the menu style, but preserve existing css_class parameter
        style, base_css_class = menu_style(type)
        css_class = base_css_class + ((' ' + css_class) if css_class else '')

        # since the menu contains the path info, it's buttons need a
        # configuration pass to get them pointing to the proper urls
        for opt in self.options:
            opt.build(self.base_path)

            # add "choice" css class to each button
            if opt.css_class:
                opt.css_class += " choice"
            else:
                opt.css_class = "choice"

        self.selected = self.find_selected()

        Styled.__init__(self, style, _id=_id, css_class=css_class)
Ejemplo n.º 4
0
    def __init__(
        self,
        title,
        dest,
        sr_path=True,
        nocname=False,
        aliases=None,
        target="",
        use_params=False,
        css_class="",
        data=None,
    ):
        aliases = aliases or []
        aliases = set(_force_unicode(a.rstrip("/")) for a in aliases)
        if dest:
            aliases.add(_force_unicode(dest.rstrip("/")))

        self.title = title
        self.dest = dest
        self.selected = False

        self.sr_path = sr_path
        self.nocname = nocname
        self.aliases = aliases
        self.target = target
        self.use_params = use_params
        self.data = data

        Styled.__init__(self, self._style, css_class=css_class)