Exemple #1
0
class YUIMenuBar(Widget):
    template = 'TGYUI.templates.menubar'
    params = ['id', 'entries', 'as_bar']
    css = ([
        CSSLink("TGYUI", "reset-fonts-grids/reset-fonts-grids.css"),
        CSSLink("TGYUI", "menu/assets/menu.css"),
    ] + skinned('menu', 'menu.css'))
    javascript = [
        JSLink("TGYUI", "yahoo-dom-event/yahoo-dom-event.js"),
        JSLink("TGYUI", "container/container_core-min.js"),
        JSLink("TGYUI", "menu/menu-min.js"),
    ]
    id = unique_id(prefix='mbar')
    as_bar = True  # set to False for e.g., leftNav
    entries = [
        ('Companies', '/companies', [
            ('add new', '/companies/add_new', []),
            ('browse', '/companies/browse', [
                ('by name', '/companies/browse/by_name'),
                ('by date', '/companies/browse/by_date'),
            ]),
            ('list', '/companies/list', []),
        ]),
        ('Contacts', '/contacts', []),
        ('Queries', '/queries', []),
        ('Mailings', '/mailings', []),
        ('Search', '/search', []),
    ]

    def __init__(self, entries=None, *args, **kw):
        super(YUIMenuBar, self).__init__(*args, **kw)
        if entries:
            self.entries = entries
Exemple #2
0
class YUITabView(Widget):

    css = (skinned('tabview', 'tabview.css') +
           (skin and [CSSSource(".yui-navset .yui-nav a:hover {color: #000}")]
            or []) + [CSSLink('TGYUI', 'tabview/assets/border_tabs.css')])

    javascript = [
        JSLink('TGYUI', 'yahoo-dom-event/yahoo-dom-event.js'),
        JSLink('TGYUI', 'element/element-beta-min.js'),
        JSLink('TGYUI', 'connection/connection-min.js'),
        JSLink('TGYUI', 'tabview/tabview-min.js'),
    ]

    id = 'tgyui_tabber'
    dynamic = [
    ]  # list of dictionaries with label (string), dataSrc (uri), cacheData (bool)
    params = ['id', 'dynamic']

    template = """
    <script language="JavaScript" type="text/JavaScript">
      (function() {
        var tabview = new YAHOO.widget.TabView("${id}");
        for each (var obj in ${dynamic}) {
          tabview.addTab(new YAHOO.widget.Tab(obj))
        }
      })();
    </script>
    """

    def update_params(self, d):
        super(YUITabView, self).update_params(d)
        d['dynamic'] = jsonify.encode(d['dynamic'])
Exemple #3
0
def skinned(pth, resource_name):
    if not skin:
        return [
            CSSLink("TGYUI", '%s/assets/%s' % (pth, resource_name)),
        ]
    base, ext = resource_name.rsplit('.', 1)
    skin_methods = {
        'minimized': [
            CSSLink("TGYUI",
                    '%s/assets/skins/%s/%s' % (pth, skin, resource_name)),
        ],
        'core': [
            CSSLink("TGYUI", '%s/assets/%s-core.%s' % (pth, base, ext)),
            CSSLink("TGYUI",
                    '%s/assets/skins/%s/%s-skin.%s' % (pth, skin, base, ext)),
        ],
        'uber': [
            CSSLink("TGYUI", '%s/assets/%s-core.%s' % (pth, base, ext)),
            CSSLink("TGYUI", 'assets/skins/%s/skin.css' % skin),
        ],
    }
    if skin_method in skin_methods:
        return skin_methods[skin_method]
    else:
        raise ValueError("app.yui.skin_method must be one of '%s'" %
                         "', '".join(skin_methods.keys()))
Exemple #4
0
class YUIBaseCSS(Widget):
    css = [CSSLink("TGYUI", "base/base-min.css")]
Exemple #5
0
class YUIResetFontsGrids(Widget):
    """Use this in place of using all the three YUIResetCSS, YUIFontsCSS,
    YUIGrids. You might want to explicitly include all three if you use other
    widgets that depend on one of them, to avoid duplications."""
    css = [CSSLink("TGYUI", "reset-fonts-grids/reset-fonts-grids.css")]
Exemple #6
0
class YUIGrids(Widget):
    css = [CSSLink("TGYUI", "grids/grids-min.css")]
Exemple #7
0
class YUIFontsCSS(Widget):
    css = [CSSLink("TGYUI", "fonts/fonts-min.css")]
Exemple #8
0
class YUIResetCSS(Widget):
    css = [CSSLink("TGYUI", "reset/reset-min.css")]