From 6004980567ab9e645c61ef7a127051aa227c3de2 Mon Sep 17 00:00:00 2001
From: luxagraf <sng@luxagraf>
Date: Sat, 30 Jan 2021 15:13:31 -0500
Subject: lttr: changed video insert function to include a link to youtube

---
 app/lttr/templates/lttr/range_detail.html | 2 +-
 design/templates/admin/insert_images.html | 9 +++++----
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/app/lttr/templates/lttr/range_detail.html b/app/lttr/templates/lttr/range_detail.html
index f9ed313..54b0c2c 100644
--- a/app/lttr/templates/lttr/range_detail.html
+++ b/app/lttr/templates/lttr/range_detail.html
@@ -85,7 +85,7 @@
             <header id="header" class="post-header">
                 <h1 class="p-name post-title" itemprop="headline">{{object.title|smartypants|safe}}</h1>
                 <div class="post-dateline">
-                    <time class="dt-published published dt-updated post-date lttr-box" datetime="{{object.pub_date|date:'c'}}" itemprop="datePublished">Image {{object.get_issue_str}} &ndash; {{object.pub_date|date:"F, Y"}}</span></time>
+                    <time class="dt-published published dt-updated post-date lttr-box" datetime="{{object.pub_date|date:'c'}}" itemprop="datePublished">Image {{object.get_issue_str}} &ndash; {{object.pub_date|date:"F j, Y"}}</span></time>
                 <span class="hide" itemprop="author" itemscope itemtype="http://schema.org/Person">by <a class="p-author h-card" href="/about"><span itemprop="name">Scott Gilbertson</span></a></span>
                 </div>
             </header>
diff --git a/design/templates/admin/insert_images.html b/design/templates/admin/insert_images.html
index 5b5e601..b620380 100644
--- a/design/templates/admin/insert_images.html
+++ b/design/templates/admin/insert_images.html
@@ -30,7 +30,7 @@ figure {
 }
 </style>
 <script>
-function buildVideo(video_mp4, video_webm, id, c, poster) {
+function buildVideo(video_mp4, video_webm, id, c, poster, ytlink) {
     console.log(poster);
     html = '<div class="self-embed-container">\n\t<video poster="'+poster+'" controls="true" loop="false" preload="auto" id="'+id+'" class="vidauto';
     if (c) {
@@ -40,7 +40,8 @@ function buildVideo(video_mp4, video_webm, id, c, poster) {
     }
     html += '>\n\t\t<source src="'+video_webm+'" type="video/webm">\n';
     html += '\t\t<source src="'+video_mp4+'" type="video/mp4">\n';
-    html += '\t\tYour browser does not support video playback via HTML5.\n\t</video>\n</div>';
+    html += '\t\tYour browser does not support video playback via HTML5.\n\t</video>\n
+    html += '\t<a href="+'ytlink+'">Watch on YouTube</a>\n</div>';
     return html;
 }
 function buildImage(image_url, id, c, caption) {
@@ -82,7 +83,7 @@ function openInNewTab(url) {
             <figcaption>{{object.id}} {% if object.caption %}&ndash; {{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}}" onclick="insertImage(this);return false;" class="insert" href="#">Insert video</a>{%else%}{% get_image_by_size object 'admin_insert' as tn %}
+            <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}}" data-ytlink="{{object.youtube_url}}" onclick="insertImage(this);return false;" class="insert" href="#">Insert video</a>{%else%}{% get_image_by_size object 'admin_insert' as tn %}
                 <li><a data-src="{{tn}}" data-id="{{object.id}}" data-class="picwide" onclick="insertImage(this);return false;" href="#" >full width</a></li>
             <li><a data-src="{{tn}}" 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="{{tn}}" data-id="{{object.id}}" data-class="cluster pic66" onclick="insertImage(this);return false;" href="#">cluster</a></li>
@@ -109,7 +110,7 @@ function openInNewTab(url) {
 function insertImage(item) {
         if (item.dataset.isVideo) {
             console.log(item.dataset.poster);
-            var code = buildVideo(item.dataset.videoMp4, item.dataset.videoWebm, item.dataset.id, item.dataset.class, item.dataset.poster);
+            var code = buildVideo(item.dataset.videoMp4, item.dataset.videoWebm, item.dataset.id, item.dataset.class, item.dataset.poster, item.dataset.ytlink);
         } else if (item.dataset.isAudio) {
             var code = buildAudio(item.dataset.mp3, item.dataset.ogg);
         } else {
-- 
cgit v1.2.3-70-g09d2