Source

cmsplugin-advancednews / cmsplugin_advancednews / widgets / wymeditor_widget.py

Diff from to

File cmsplugin_advancednews/widgets/wymeditor_widget.py

-from os.path import join
-
+from cms.plugins.text import settings as text_settings
+from cms.utils import cms_static_url
+from django.conf import settings
+from django.forms import Textarea
+from django.template.loader import render_to_string
 from django.utils.safestring import mark_safe
-from django.template.loader import render_to_string
-from django.forms import Textarea
-
+from django.utils.translation.trans_real import get_language
 from django.conf import settings
-from cms.plugins.text import settings as text_settings
-from django.utils.translation.trans_real import get_language
 
 class WYMEditor(Textarea):
     class Media:
-        js = [join(settings.CMS_MEDIA_URL, path) for path in (
-            'js/lib/jquery.js',
+        js = ['%sjs/jquery.min.js' % settings.ADMIN_MEDIA_PREFIX] + [cms_static_url(path) for path in (
+            'js/plugins/admincompat.js',
+            'js/libs/jquery.query.js',
+            'js/libs/jquery.ui.core.js',
+            'js/libs/jquery.ui.dialog.js',
             'wymeditor/jquery.wymeditor.js',
             'wymeditor/plugins/resizable/jquery.wymeditor.resizable.js',
+            'js/wymeditor.placeholdereditor.js',
+            'js/libs/jquery.ui.core.js',
+            'js/placeholder_editor_registry.js',
         )]
-              
+        css = {
+            'all': [cms_static_url(path) for path in (
+                        'css/jquery/cupertino/jquery-ui.css',
+                    )],
+        }
+
     def __init__(self, attrs=None, installed_plugins=None):
         """
         Create a widget for editing text + plugins.
             self.attrs.update(attrs)
         super(WYMEditor, self).__init__(attrs)
         self.installed_plugins = installed_plugins
-        
+
     def render_textarea(self, name, value, attrs=None):
         return super(WYMEditor, self).render(name, value, attrs)
 
         context = {
             'name': name,
             'language': language,
-            'CMS_MEDIA_URL': settings.CMS_MEDIA_URL,
+            'STATIC_URL': settings.STATIC_URL,
             'WYM_TOOLS': mark_safe(text_settings.WYM_TOOLS),
             'WYM_CONTAINERS': mark_safe(text_settings.WYM_CONTAINERS),
             'WYM_CLASSES': mark_safe(text_settings.WYM_CLASSES),
         }
         return mark_safe(render_to_string(
             'cmsplugin_advancednews/widgets/wymeditor.html', context))
+            #'cms/plugins/widgets/wymeditor.html', context))
 
     def render(self, name, value, attrs=None):
         return self.render_textarea(name, value, attrs) + \