0
0
mirror of https://github.com/wagtail/wagtail.git synced 2024-11-29 17:36:49 +01:00

Replace STATIC_URL with staticfiles in hooks

This commit is contained in:
Karl Hobley 2016-02-03 16:00:19 +00:00
parent 824a7c50e2
commit 7ea05523dc
4 changed files with 18 additions and 16 deletions

View File

@ -4,6 +4,7 @@ from django.core import urlresolvers
from django.utils.html import format_html, format_html_join
from django.utils.translation import ugettext_lazy as _
from django.contrib.auth.models import Permission
from django.contrib.staticfiles.templatetags.staticfiles import static
from wagtail.wagtailcore import hooks
from wagtail.wagtailadmin.menu import MenuItem
@ -44,12 +45,12 @@ def register_documents_menu_item():
@hooks.register('insert_editor_js')
def editor_js():
js_files = [
'wagtaildocs/js/hallo-plugins/hallo-wagtaildoclink.js',
'wagtaildocs/js/document-chooser.js',
static('wagtaildocs/js/hallo-plugins/hallo-wagtaildoclink.js'),
static('wagtaildocs/js/document-chooser.js'),
]
js_includes = format_html_join(
'\n', '<script src="{0}{1}"></script>',
((settings.STATIC_URL, filename) for filename in js_files)
'\n', '<script src="{0}"></script>',
((filename, ) for filename in js_files)
)
return js_includes + format_html(
"""

View File

@ -2,6 +2,7 @@ from django.conf import settings
from django.conf.urls import include, url
from django.core import urlresolvers
from django.utils.html import format_html
from django.contrib.staticfiles.templatetags.staticfiles import static
from wagtail.wagtailcore import hooks
from wagtail.wagtailembeds import urls
@ -19,14 +20,13 @@ def register_admin_urls():
def editor_js():
return format_html(
"""
<script src="{0}{1}"></script>
<script src="{0}"></script>
<script>
window.chooserUrls.embedsChooser = '{2}';
window.chooserUrls.embedsChooser = '{1}';
registerHalloPlugin('hallowagtailembeds');
</script>
""",
settings.STATIC_URL,
'wagtailembeds/js/hallo-plugins/hallo-wagtailembeds.js',
static('wagtailembeds/js/hallo-plugins/hallo-wagtailembeds.js'),
urlresolvers.reverse('wagtailembeds:chooser')
)

View File

@ -4,6 +4,7 @@ from django.core import urlresolvers
from django.utils.html import format_html, format_html_join
from django.utils.translation import ugettext_lazy as _
from django.contrib.auth.models import Permission
from django.contrib.staticfiles.templatetags.staticfiles import static
from wagtail.wagtailcore import hooks
from wagtail.wagtailadmin.menu import MenuItem
@ -41,12 +42,12 @@ def register_images_menu_item():
@hooks.register('insert_editor_js')
def editor_js():
js_files = [
'wagtailimages/js/hallo-plugins/hallo-wagtailimage.js',
'wagtailimages/js/image-chooser.js',
static('wagtailimages/js/hallo-plugins/hallo-wagtailimage.js'),
static('wagtailimages/js/image-chooser.js'),
]
js_includes = format_html_join(
'\n', '<script src="{0}{1}"></script>',
((settings.STATIC_URL, filename) for filename in js_files)
'\n', '<script src="{0}"></script>',
((filename, ) for filename in js_files)
)
return js_includes + format_html(
"""

View File

@ -5,6 +5,7 @@ from django.contrib.contenttypes.models import ContentType
from django.core import urlresolvers
from django.utils.html import format_html
from django.utils.translation import ugettext_lazy as _
from django.contrib.staticfiles.templatetags.staticfiles import static
from wagtail.wagtailadmin.menu import MenuItem
from wagtail.wagtailcore import hooks
@ -39,11 +40,10 @@ def register_snippets_menu_item():
def editor_js():
return format_html(
"""
<script src="{0}{1}"></script>
<script>window.chooserUrls.snippetChooser = '{2}';</script>
<script src="{0}"></script>
<script>window.chooserUrls.snippetChooser = '{1}';</script>
""",
settings.STATIC_URL,
'wagtailsnippets/js/snippet-chooser.js',
static('wagtailsnippets/js/snippet-chooser.js'),
urlresolvers.reverse('wagtailsnippets:choose_generic')
)