예제 #1
0
    def _upgrade_jquery(self, media):
        # upgrade jquery and cms jquery UI
        new_media = Media()
        new_media.add_css(media._css)

        new_jquery_version = static('cms_blogger/js/jquery-1.9.1.min.js')
        new_jquery_ui_version = static('cms_blogger/js/jquery-ui.min.js')
        # make sure all jquery namespaces point to the same jquery
        jquery_namspace = static('cms_blogger/js/jQuery-patch.js')
        django_jquery_urls = [static('admin/js/jquery.js'),
                              static('admin/js/jquery.min.js')]
        django_collapse_js = [static('admin/js/collapse.js'),
                              static('admin/js/collapse.min.js')]
        for js in media._js:
            if js in django_jquery_urls:
                new_media.add_js((new_jquery_version, ))
            elif js in django_collapse_js:
                new_media.add_js(
                    (static('cms_blogger/js/admin-collapse.js'), ))
            elif js == static('admin/js/jquery.init.js'):
                new_media.add_js((js, jquery_namspace))
            elif js.startswith(static('cms/js/libs/jquery.ui.')):
                new_media.add_js((new_jquery_ui_version, ))
            else:
                new_media.add_js((js, ))
        return new_media
예제 #2
0
    def __init__(self, **kwargs):
        self._css = {}
        self._js = []

        if kwargs:
            Media.add_css(self, kwargs.get('css', None))
            Media.add_js(self, kwargs.get('js', None))
    def __init__(self, **kwargs):
        self._css = {}
        self._js = []

        if kwargs:
            Media.add_css(self, kwargs.get('css', None))
            Media.add_js(self, kwargs.get('js', None))
예제 #4
0
파일: forms.py 프로젝트: xaratt/andrytest2
 def _get_media(self):
     """ hack for executing form's js code before widget's js """
     from django.forms import Media
     media = Media()
     media.add_js(self.Media().js)
     for field in self.fields.values():
         media = media + field.widget.media
     return media
예제 #5
0
def vendor(*tags):
    media = Media()
    for tag in tags:
        file_type = tag.split('.')[-1]
        files = xstatic(tag)
        if file_type == 'js':
            media.add_js(files)
        elif file_type == 'css':
            media.add_css({'screen': files})
    return media
예제 #6
0
 def vendor(self, *tags):
     media = Media()
     for tag in tags:
         file_type = tag.split('.')[-1]
         files = self.static(tag)
         if file_type == 'js':
             media.add_js([files])
         elif file_type == 'css':
             media.add_css({'screen': [files]})
     return media
예제 #7
0
def vendor(*tags):
    media = Media()
    for tag in tags:
        file_type = tag.split(".")[-1]
        files = xstatic(tag)
        if file_type == "js":
            media.add_js(files)
        elif file_type == "css":
            media.add_css({"screen": files})
    return media
예제 #8
0
def vendor(*tags):
    media = Media()
    for tag in tags:
        file_type = tag.split(".")[-1]
        files = xstatic(tag)
        if file_type == "js":
            media.add_js(files)
        elif file_type == "css":
            media.add_css({"screen": files})
    return media
예제 #9
0
    def _media(self):
        base = getattr(super(AdminCropdusterWidget, self), 'media', None)
        media = Media(base) if base else Media()

        media_url = reverse("cropduster-static", kwargs={"path": ""})

        media.add_js([media_url + 'js/admin.cropduster.js',])
        media.add_css({
            'all': (
                media_url + 'css/admin.cropduster.css',
            ),})
        return media
예제 #10
0
 def get_media(self, *args, **kwargs):
     media = super(AuditeurLibreApogeeAdmin, self).get_media(*args, **kwargs)
     m = Media()
     m.add_js(['paiement_etudiant/js/paiement_etudiant.js'])
     return media+m
예제 #11
0
 def get_media(self, *args, **kwargs):
     media = super(PaiementAdminView, self).get_media(*args, **kwargs)
     m = Media()
     m.add_js(['paiement_etudiant/js/paiement_etudiant.js'])
     return media+m
예제 #12
0
 def media(self):
     '上传前 预览图片'
     media = Media()
     media.add_js(['js/previrew-image-before-upload.js'])
     # media.add_css({'screen': files})
     return media