diff --git a/catalog/static/js/podcast.js b/catalog/static/js/podcast.js index 0285860d..73513899 100644 --- a/catalog/static/js/podcast.js +++ b/catalog/static/js/podcast.js @@ -15,6 +15,18 @@ function create_player(audio) { // }); $('.footer').attr('style', 'margin-bottom: 120px !important'); } +function set_podcast_comment_button(comment_href) { + if (window.comment_btn){ + window.comment_btn.remove(); + } + if (comment_href) { + window.comment_btn = $('')[0]; + window.player.ui.extraControls.append(window.comment_btn); + htmx.process(window.comment_btn); + // $(''); + // $(''); + } +} function podcast_init(context) { $('.episode', context).on('click', e=>{ e.preventDefault(); @@ -25,6 +37,7 @@ function podcast_init(context) { var cover_url = $(ele).data('cover'); var media_url = $(ele).data('media'); var position = $(ele).data('position'); + var comment_href = $(ele).data('comment-href'); if (!media_url) return; window.current_item_uuid = $(ele).data('uuid'); if (!window.player) { @@ -44,6 +57,7 @@ function podcast_init(context) { artist: artist }) } + set_podcast_comment_button(comment_href); if (position) window.player._initSeek = position; window.player.play() }); diff --git a/catalog/templates/_item_comments.html b/catalog/templates/_item_comments.html index c0bb78f1..472bd35c 100644 --- a/catalog/templates/_item_comments.html +++ b/catalog/templates/_item_comments.html @@ -40,9 +40,10 @@ data-position="{{ comment.metadata.position|default:0 }}" data-cover="{{ comment.item.cover_url|default:item.cover.url }}" class="episode" - data-hosts="{{ comment.item.hosts|join:' / ' }}" + data-hosts="{{ item.hosts|join:' / ' }}" data-title="{{ comment.item.title }}" data-album="{{ item.title }}" + {% if request.user.is_authenticated %} data-comment-href="{% url 'journal:comment' comment.item.uuid %}" {% endif %} data-uuid="{{ comment.item.uuid }}"> {% endif %} diff --git a/catalog/templates/podcast.html b/catalog/templates/podcast.html index 2788d9ec..313fe64a 100644 --- a/catalog/templates/podcast.html +++ b/catalog/templates/podcast.html @@ -87,6 +87,9 @@ $(()=>{ artist: "{{ item.hosts|join:' / '|escapejs }}" }) if (position) window.player._initSeek = position; + {% if request.user.is_authenticated %} + set_podcast_comment_button("{% url 'journal:comment' focus_item.uuid %}") + {% endif %} {% endif %} }); diff --git a/catalog/templates/podcast_episode_data.html b/catalog/templates/podcast_episode_data.html index 70401c95..7fd3896c 100644 --- a/catalog/templates/podcast_episode_data.html +++ b/catalog/templates/podcast_episode_data.html @@ -13,6 +13,7 @@ data-title="{{ ep.title }}" data-album="{{ item.title }}" data-hosts="{{ item.hosts|join:' / ' }}" + {% if request.user.is_authenticated %} data-comment-href="{% url 'journal:comment' ep.uuid %}" {% endif %} style="top:4px; margin-right: 8px">   diff --git a/common/templates/_sidebar.html b/common/templates/_sidebar.html index 7a160281..0e2f6132 100644 --- a/common/templates/_sidebar.html +++ b/common/templates/_sidebar.html @@ -123,6 +123,7 @@ data-title="{{ item.title }}" data-album="{{ item.program.title }}" data-hosts="{{ item.program.hosts|join:' / ' }}" + {% if request.user.is_authenticated %} data-comment-href="{% url 'journal:comment' item.uuid %}" {% endif %} data-position="0" href="{{ item.url }}" title="{{ item.title }}"> diff --git a/social/templates/activity/comment_child_item.html b/social/templates/activity/comment_child_item.html index 713513c4..f947b824 100644 --- a/social/templates/activity/comment_child_item.html +++ b/social/templates/activity/comment_child_item.html @@ -21,6 +21,7 @@ data-title="{{ activity.action_object.item.title }}" data-album="{{ activity.action_object.item.parent_item.title }}" data-hosts="{{ activity.action_object.item.parent_item.hosts|join:' / ' }}" + {% if request.user.is_authenticated %} data-comment-href="{% url 'journal:comment' activity.action_object.item.uuid %}" {% endif %} data-position="{{ activity.action_object.metadata.position | default:0 }}"> {% endif %}