0
0
mirror of https://github.com/wagtail/wagtail.git synced 2024-12-01 11:41:20 +01:00

Pass document chooser URL to widget via data attribute instead of chooserUrls

This commit is contained in:
Matt Westcott 2020-09-30 18:35:45 +01:00 committed by Matt Westcott
parent 90e2899b71
commit 523148521b
2 changed files with 2 additions and 1 deletions

View File

@ -6,7 +6,7 @@ function createDocumentChooser(id) {
$('.action-choose', chooserElement).on('click', function() {
ModalWorkflow({
url: window.chooserUrls.documentChooser,
url: chooserElement.data('chooserUrl'),
onload: DOCUMENT_CHOOSER_MODAL_ONLOAD_HANDLERS,
responses: {
documentChosen: function(docData) {

View File

@ -1,5 +1,6 @@
{% extends "wagtailadmin/widgets/chooser.html" %}
{% block chooser_class %}document-chooser{% endblock %}
{% block chooser_attributes %}data-chooser-url="{% url "wagtaildocs:chooser" %}"{% endblock %}
{% block chosen_state_view %}
<span class="title">{{ document.title }}</span>