kopia lustrzana https://github.com/wagtail/wagtail
stylistic tweaks to b7158bb3fa
(camel case for js vars; using a dict rather than adding vars indefinitely to the window scope; avoiding potentially dynamic code inside compress blocks)
rodzic
d9219a8515
commit
2f13e5211a
|
@ -41,9 +41,9 @@
|
|||
|
||||
if lastSelection.collapsed
|
||||
# TODO: don't hard-code this, as it may be changed in urls.py
|
||||
url = window.page_chooser+'?allow_external_link=true&allow_email_link=true&prompt_for_link_text=true'
|
||||
url = window.chooserUrls.pageChooser + '?allow_external_link=true&allow_email_link=true&prompt_for_link_text=true'
|
||||
else
|
||||
url = window.page_chooser+'?allow_external_link=true&allow_email_link=true'
|
||||
url = window.chooserUrls.pageChooser + '?allow_external_link=true&allow_email_link=true'
|
||||
|
||||
ModalWorkflow
|
||||
url: url
|
||||
|
|
|
@ -4,7 +4,7 @@ function createPageChooser(id, pageType, openAtParentId) {
|
|||
var input = $('#' + id);
|
||||
|
||||
$('.action-choose', chooserElement).click(function() {
|
||||
var initialUrl = window.page_chooser;
|
||||
var initialUrl = window.chooserUrls.pageChooser;
|
||||
if (openAtParentId) {
|
||||
initialUrl += openAtParentId + '/';
|
||||
}
|
||||
|
|
|
@ -29,15 +29,18 @@
|
|||
<script src="{{ STATIC_URL }}wagtaildocs/js/document-chooser.js"></script>
|
||||
<script src="{{ STATIC_URL }}wagtailsnippets/js/snippet-chooser.js"></script>
|
||||
<script src="{{ STATIC_URL }}admin/js/urlify.js"></script>
|
||||
<script type='text/javascript'>
|
||||
window.document_chooser='{% url "wagtaildocs_chooser" %}';
|
||||
window.image_chooser='{% url "wagtailimages_chooser" %}';
|
||||
window.embeds_chooser='{% url "wagtailembeds_chooser" %}';
|
||||
window.page_chooser='{% url "wagtailadmin_choose_page" %}';
|
||||
window.snippet_chooser='{% url "wagtailsnippets_choose_generic" %}';
|
||||
</script>
|
||||
{% endcompress %}
|
||||
|
||||
<script type='text/javascript'>
|
||||
window.chooserUrls = {
|
||||
'documentChooser': '{% url "wagtaildocs_chooser" %}',
|
||||
'imageChooser': '{% url "wagtailimages_chooser" %}',
|
||||
'embedsChooser': '{% url "wagtailembeds_chooser" %}',
|
||||
'pageChooser': '{% url "wagtailadmin_choose_page" %}',
|
||||
'snippetChooser': '{% url "wagtailsnippets_choose_generic" %}'
|
||||
};
|
||||
</script>
|
||||
|
||||
<script>
|
||||
(function() {
|
||||
function fixPrefix(str) {return str;}
|
||||
|
|
|
@ -5,7 +5,7 @@ function createDocumentChooser(id) {
|
|||
|
||||
$('.action-choose', chooserElement).click(function() {
|
||||
ModalWorkflow({
|
||||
'url': window.document_chooser,
|
||||
'url': window.chooserUrls.documentChooser,
|
||||
'responses': {
|
||||
'documentChosen': function(docData) {
|
||||
input.val(docData.id);
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
button.on "click", (event) ->
|
||||
lastSelection = widget.options.editable.getSelection()
|
||||
ModalWorkflow
|
||||
url: window.document_chooser
|
||||
url: window.chooserUrls.documentChooser
|
||||
responses:
|
||||
documentChosen: (docData) ->
|
||||
a = document.createElement('a')
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
lastSelection = widget.options.editable.getSelection()
|
||||
insertionPoint = $(lastSelection.endContainer).parentsUntil('.richtext').last()
|
||||
ModalWorkflow
|
||||
url: window.embeds_chooser
|
||||
url: window.chooserUrls.embedsChooser
|
||||
responses:
|
||||
embedChosen: (embedData) ->
|
||||
elem = $(embedData).get(0)
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
lastSelection = widget.options.editable.getSelection()
|
||||
insertionPoint = $(lastSelection.endContainer).parentsUntil('.richtext').last()
|
||||
ModalWorkflow
|
||||
url: window.image_chooser+'?select_format=true'
|
||||
url: window.chooserUrls.imageChooser + '?select_format=true'
|
||||
responses:
|
||||
imageChosen: (imageData) ->
|
||||
elem = $(imageData.html).get(0)
|
||||
|
|
|
@ -5,7 +5,7 @@ function createImageChooser(id) {
|
|||
|
||||
$('.action-choose', chooserElement).click(function() {
|
||||
ModalWorkflow({
|
||||
'url': window.image_chooser,
|
||||
'url': window.chooserUrls.imageChooser,
|
||||
'responses': {
|
||||
'imageChosen': function(imageData) {
|
||||
input.val(imageData.id);
|
||||
|
|
|
@ -5,7 +5,7 @@ function createSnippetChooser(id, contentType) {
|
|||
|
||||
$('.action-choose', chooserElement).click(function() {
|
||||
ModalWorkflow({
|
||||
'url': window.snippet_chooser + contentType + '/',
|
||||
'url': window.chooserUrls.snippetChooser + contentType + '/',
|
||||
'responses': {
|
||||
'snippetChosen': function(snippetData) {
|
||||
input.val(snippetData.id);
|
||||
|
|
Ładowanie…
Reference in New Issue