1
0
mirror of https://github.com/flextype/flextype.git synced 2025-08-23 05:16:03 +02:00

refactor(admin-plugin): move js code from base.html #186

This commit is contained in:
Awilum
2019-08-26 23:43:28 +03:00
parent e31fbd65b6
commit 81a9559f86
2 changed files with 13 additions and 9 deletions

View File

@@ -265,15 +265,7 @@
$('.js-save-editor-form-submit').click(function() {
$("#form").submit();
});
$('.js-entries-image-preview').click(function () {
$('#entriesImagePreview').modal();
$('.js-entry-image-preview-placeholder').css('background-image', 'url(' + $(this).attr('data-image-url') + ')');
$('.js-entry-image-url-placeholder').val($(this).attr('data-image-url'));
$('.js-media-id').attr('value', $(this).attr('data-media-id'));
$('.js-entry-id').attr('value', $(this).attr('data-entry-id'));
});
{% if is_current_path('admin.fieldsets.edit') or is_current_path('admin.templates.edit') or is_current_path('admin.snippets.edit') or (is_current_path('admin.entries.edit') and type == 'source') %}
var editor = CodeMirror.fromTextArea(document.getElementById("codeMirrorEditor"), {
lineNumbers: true,

View File

@@ -72,3 +72,15 @@
</div>
</div>
{% endblock %}
{% block tail %}
<script type="text/javascript">
$('.js-entries-image-preview').click(function () {
$('#entriesImagePreview').modal();
$('.js-entry-image-preview-placeholder').css('background-image', 'url(' + $(this).attr('data-image-url') + ')');
$('.js-entry-image-url-placeholder').val($(this).attr('data-image-url'));
$('.js-media-id').attr('value', $(this).attr('data-media-id'));
$('.js-entry-id').attr('value', $(this).attr('data-entry-id'));
});
</script>
{% endblock %}