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:
@@ -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,
|
||||
|
@@ -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 %}
|
||||
|
Reference in New Issue
Block a user