diff options
Diffstat (limited to 'design')
-rw-r--r-- | design/templates/admin/insert_images.html | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/design/templates/admin/insert_images.html b/design/templates/admin/insert_images.html index 398445b..57e8a36 100644 --- a/design/templates/admin/insert_images.html +++ b/design/templates/admin/insert_images.html @@ -71,15 +71,15 @@ function openInNewTab(url) { <div class="item-wrapper" id="images"> <figure class="item" > <img src="{% if object.get_type == "LuxImage" %}{% get_image_by_size object 'tn' %}{%else%}{{object.video_poster.url}}" style="max-width: 150px{%endif%}" /> - <figcaption>{{object.id}} - {{object.title}} {% if object.caption %}– {{object.caption}}{%endif%}</figcaption> + <figcaption>{{object.id}} {% if object.caption %}– {{object.caption}}{%endif%}</figcaption> </figure> <ul class="actions">{%if object.get_type == "LuxVideo" %} <li><a data-is-video="true" data-video-mp4="{{object.video_mp4.url}}" data-video-webm="{{object.video_webm.url}}" data-id="{{object.id}}" data-class="vid" data-poster="{{object.video_poster.url}}" class="insert" href="">Insert video</a>{%else%} - <li><a data-src="{% get_image_by_size object 'admin_insert' %}" data-id="{{object.id}}" data-class="picwide" class="insert" href="#">full width</a></li> - <li><a data-src="{% get_image_by_size object 'admin_insert' %}" data-id="{{object.id}}" data-class="picwide" data-caption="true" class="insert" href="#">full width cap</a></li> - <li><a data-src="{% get_image_by_size object 'admin_insert' %}" data-id="{{object.id}}" data-class="cluster pic" class="insert" href="#">cluster</a></li> - <li><a data-src="{% get_image_by_size object 'admin_insert' %}" data-id="{{object.id}}" data-class="picfull" class="insert" href="#">column width</a></li> - <li><a data-src="{% get_image_by_size object 'admin_insert' %}" data-id="{{object.id}}" data-class="picfull" data-caption="true" class="insert" href="#">column width cap</a></li> + <li><a data-src="{% get_image_by_size object 'admin_insert' %}" data-id="{{object.id}}" data-class="picwide" onclick="insertImage(this);return false;" href="#" >full width</a></li> + <li><a data-src="{% get_image_by_size object 'admin_insert' %}" data-id="{{object.id}}" data-class="picwide" data-caption="true" onclick="insertImage(this);return false;" href="#">full width cap</a></li> + <li><a data-src="{% get_image_by_size object 'admin_insert' %}" data-id="{{object.id}}" data-class="cluster pic5" onclick="insertImage(this);return false;" href="#">cluster</a></li> + <li><a data-src="{% get_image_by_size object 'admin_insert' %}" data-id="{{object.id}}" data-class="picfull" onclick="insertImage(this);return false;" href="#">column width</a></li> + <li><a data-src="{% get_image_by_size object 'admin_insert' %}" data-id="{{object.id}}" data-class="picfull" data-caption="true" onclick="insertImage(this);return false;" href="#">column width cap</a></li> <li><a onclick='openInNewTab("/admin/photos/luximage/{{object.pk}}/change/");' href="#">Edit Image</a></li>{%endif%} </ul> </div> @@ -89,13 +89,12 @@ function openInNewTab(url) { <!-- "next page" action --> <a class="nextPage browse right"></a> <script> -Array.from(document.getElementsByClassName('insert')).forEach(function(item) { - if (item.dataset.isVideo) { - var code = buildVideo(item.dataset.videoMp4, item.dataset.videoWebm, item.dataset.id, item.dataset.class, item.dataset.dataPoster); - } else { - var code = buildImage(item.dataset.src, item.dataset.id, item.dataset.class, item.dataset.caption); - } - item.addEventListener("click", function(event) { +function insertImage(item) { + if (item.dataset.isVideo) { + var code = buildVideo(item.dataset.videoMp4, item.dataset.videoWebm, item.dataset.id, item.dataset.class, item.dataset.dataPoster); + } else { + var code = buildImage(item.dataset.src, item.dataset.id, item.dataset.class, item.dataset.caption); + } var el = parent.document.getElementById('{{textarea_id}}'); var start = el.selectionStart; var end = el.selectionEnd; @@ -105,9 +104,7 @@ Array.from(document.getElementsByClassName('insert')).forEach(function(item) { el.value = (before + code + after); el.selectionStart = el.selectionEnd = start + code.length; el.focus(); - return false; - }, false); -}); +} </script> </body> </html> |