Skip to content

Commit

Permalink
Remove redundant JS injection in wagtail_hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
ababic committed Jul 29, 2024
1 parent 04b71ad commit 57f7a49
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions src/wagtail_bynder/wagtail_hooks.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from django.conf import settings
from django.templatetags.static import static
from django.urls import reverse
from django.utils.html import format_html
from wagtail import hooks
from wagtail.admin.menu import MenuItem
Expand Down Expand Up @@ -50,17 +49,11 @@ def hide_image_and_document_summary_items(request, summary_items):

@hooks.register("insert_editor_js")
def editor_js():
if model := get_video_model():
if get_video_model():
return format_html(
"""
<script>
window.chooserUrls.videoChooser = '{0}';
</script>
<script src="{1}"></script>
<script src="{0}"></script>
""",
reverse(
f"{model.snippet_viewset.get_chooser_admin_url_namespace()}:choose"
),
static("bynder/js/video-chooser-modal.js"),
)

Expand Down

0 comments on commit 57f7a49

Please sign in to comment.