Introduce CKEDITOR_BASEPATH to the text_plugin_change_form.html template. Fixes #124.

This commit is contained in:
Jeffrey Goettsch 2014-05-15 12:49:34 -07:00
parent eeaee308b5
commit ad91c0fe24
2 changed files with 7 additions and 1 deletions

View File

@ -1,3 +1,4 @@
from django.conf import settings
from django.forms.fields import CharField
from django.utils.translation import ugettext_lazy as _
@ -54,6 +55,11 @@ class TextPlugin(CMSPluginBase):
We override the change form template path
to provide backwards compatibility with CMS 2.x
"""
ckeditor_basepath = '{0}/ckeditor/'.format(settings.STATIC_URL)
if ckeditor_basepath.startswith('//'):
protocol = 'https' if request.is_secure else 'http'
ckeditor_basepath = '{0}:{1}'.format(protocol, ckeditor_basepath)
context.update({'CKEDITOR_BASEPATH': ckeditor_basepath})
if cms_version.startswith('2'):
context['change_form_template'] = "admin/cms/page/plugin_change_form.html"
return super(TextPlugin, self).render_change_form(request, context, add, change, form_url, obj)

View File

@ -3,7 +3,7 @@
{% block extrahead %}
{{ block.super }}
<script>window.CKEDITOR_BASEPATH = "{{ STATIC_URL }}ckeditor/";</script>
<script>window.CKEDITOR_BASEPATH = "{{ CKEDITOR_BASEPATH }}";</script>
<script src="{% static "cms/js/modules/cms.base.js" %}"></script>
<script>
(function($) {