Beispiel #1
0
def test_group_need_should_pass_slots_to_needed():
    import fanstatic
    lib = Library('lib', '')
    c = Resource(lib, 'c.js')
    slot = Slot(lib, '.js', depends=[c])
    a = Resource(lib, 'a.js', depends=[slot])
    b = Resource(lib, 'b.js', depends=[c])
    g = fanstatic.Group([a, b])
    needed = fanstatic.init_needed()
    try:
        g.need({slot: c})
    finally:
        fanstatic.del_needed()
    assert slot in needed._slots
Beispiel #2
0
DragAndDrop = fanstatic.Resource(
    library,
    'DragAndDrop.js',
    minified='DragAndDrop.min.js',
    depends=[Base, Iter, DOM, Signal, Visual, Position])
Sortable = fanstatic.Resource(library,
                              'Sortable.js',
                              minified='Sortable.min.js',
                              depends=[Base, Iter, DOM, Position, DragAndDrop])

mochikit = fanstatic.Group([
    Async,
    Base,
    Color,
    DateTime,
    DOM,
    DragAndDrop,
    Format,
    Iter,
    Logging,
    LoggingPane,
    MockDOM,
    Position,
    Selector,
    Signal,
    Sortable,
    Style,
    Test,
    Visual,
])
Beispiel #3
0
SplitDirResource('forms.css')
SplitDirResource('tables.css')
SplitDirResource('lightbox.css')
SplitDirResource('cms_widgets.css')
SplitDirResource('object_details.css')
SplitDirResource('cms.css')

# Only explicitly included by .login.Login
login_css = fanstatic.Resource(lib_css, 'login.css')

jqueryui_theme = fanstatic.Resource(
    lib_js,
    'jquery/jquery-ui-custom-theme/jquery-ui-1.10.4.custom.css',
    minified='jquery/jquery-ui-custom-theme/jquery-ui-1.10.4.custom.min.css')
jqueryui = fanstatic.Group([js.jqueryui.jqueryui, jqueryui_theme])
register(jqueryui)

zc_table = Library('zc.table',
                   pkg_resources.resource_filename('zc.table', 'resources'))
zc_table_js = fanstatic.Resource(zc_table, 'sorting.js')
register(zc_table_js)

zc_datetimewidget = Library(
    'zc.datetimewidget',
    pkg_resources.resource_filename('zc.datetimewidget', 'resources'))
datetime_css = fanstatic.Resource(zc_datetimewidget, 'calendar-system.css')
datetime_calendar_js = fanstatic.Resource(zc_datetimewidget, 'calendar.js')
datetime_calendar_setup_js = fanstatic.Resource(zc_datetimewidget,
                                                'calendar-setup.js',
                                                depends=[datetime_calendar_js])
Beispiel #4
0
# CSS
reset_css = fanstatic.Resource(css_lib, 'reset.css')
hamburger_fold_out_menu_css = fanstatic.Resource(
    css_lib, 'pure-css-hamburger-fold-out-menu.css')
base_css = fanstatic.Resource(css_lib,
                              'base.css',
                              depends=[reset_css, hamburger_fold_out_menu_css])
print_css = fanstatic.Resource(css_lib, 'print.css', depends=[base_css])
table_css = fanstatic.Resource(css_lib, 'table.css')
form_css = fanstatic.Resource(css_lib, 'form.css')
wizard_css = fanstatic.Resource(css_lib, 'wizard.css')
prefs_css = fanstatic.Resource(css_lib, 'prefs.css', depends=[form_css])
css = fanstatic.Group([
    base_css,
    print_css,
    form_css,
    prefs_css,
    table_css,
    wizard_css,
])

# not rendered on every page
no_max_content_css = fanstatic.Resource(css_lib,
                                        'no_max_content.css',
                                        depends=[form_css])
background_css = fanstatic.Resource(css_lib,
                                    'background.css',
                                    depends=[base_css])
bootstrap_css = fanstatic.Resource(css_lib,
                                   'bootstrap.css',
                                   depends=[
                                       base_css,
Beispiel #5
0
                               minified='g.raphael-min.js',
                               depends=[js.raphael.raphael])

bar = fanstatic.Resource(library,
                         'g.bar.js',
                         minified='g.bar-min.js',
                         depends=[g_raphael])

dot = fanstatic.Resource(library,
                         'g.dot.js',
                         minified='g.dot-min.js',
                         depends=[g_raphael])

line = fanstatic.Resource(library,
                          'g.line.js',
                          minified='g.line-min.js',
                          depends=[g_raphael])

pie = fanstatic.Resource(library,
                         'g.pie.js',
                         minified='g.pie-min.js',
                         depends=[g_raphael])

graphael = fanstatic.Group([
    g_raphael,
    bar,
    dot,
    line,
    pie,
])
Beispiel #6
0
                                   templates,
                               ])

localization_de = fanstatic.Resource(library,
                                     'localizations/de.js',
                                     minified='localizations/de.min.js',
                                     depends=[jsform_js])

localization_en = fanstatic.Resource(library,
                                     'localizations/en.js',
                                     minified='localizations/en.min.js',
                                     depends=[jsform_js])

jsform = fanstatic.Group([
    jsform_js,
    localization_de,
    localization_en,
])

if HAS_CONTAINER_DEPENDENCIES is True:

    container_widget = fanstatic.Resource(library,
                                          'collection.js',
                                          minified='collection.min.js',
                                          depends=[
                                              js.bootstrap.bootstrap_css,
                                              js.bootstrap.bootstrap_js,
                                              js.jquery.jquery,
                                              js.jqueryui.bootstrap,
                                              jsform,
                                          ])
Beispiel #7
0
lib = fanstatic.Library('calendar', 'resources')
calendar_css = fanstatic.Resource(lib, 'calendar.css', depends=[base_css])
print_css = fanstatic.Resource(lib, 'print.css', depends=[calendar_css])
calendar_js = fanstatic.Resource(
    lib, 'calendar.js', depends=[
        js.jquery.jquery,
        js.classy.classy,
        form],
    bottom=True)


eventview_css = fanstatic.Resource(lib, 'eventview.css')
eventview_js = fanstatic.Resource(
    lib, 'eventview.js', depends=[js.bootstrap4.bootstrap])
eventview = fanstatic.Group([
    eventview_css,
    eventview_js
])


class CalendarResources(zope.viewlet.viewlet.ViewletBase):
    """Resources which are needed for the calendar."""

    def update(self):
        calendar_css.need()
        print_css.need()
        calendar_js.need()

    def render(self):
        return u''

Beispiel #8
0
import fanstatic
import js.jquery

library = fanstatic.Library('jquery_fullcalendar', 'resources')

fullcalendar = fanstatic.Group([
    fanstatic.Resource(library, 'fullcalendar.css'),
    fanstatic.Resource(library,
                       'fullcalendar.js',
                       minified='fullcalendar.min.js',
                       depends=[js.jquery.jquery])
])