diff --git a/app/assets/javascripts/initializers/initializePodcastPlayback.js b/app/assets/javascripts/initializers/initializePodcastPlayback.js index bc69f8e9d..e548cee71 100644 --- a/app/assets/javascripts/initializers/initializePodcastPlayback.js +++ b/app/assets/javascripts/initializers/initializePodcastPlayback.js @@ -82,14 +82,18 @@ function initializePodcastPlayback() { function spinPodcastRecord(customMessage) { if (audioExistAndIsPlaying() && recordExist()) { - getById(`record-${window.activeEpisode}`).classList.add('playing'); + var podcastPlaybackButton = getById(`record-${window.activeEpisode}`); + podcastPlaybackButton.classList.add('playing'); + podcastPlaybackButton.setAttribute('aria-pressed', 'true'); changeStatusMessage(customMessage); } } function stopRotatingActivePodcastIfExist() { if (window.activeEpisode && getById(`record-${window.activeEpisode}`)) { - getById(`record-${window.activeEpisode}`).classList.remove('playing'); + var podcastPlaybackButton = getById(`record-${window.activeEpisode}`); + podcastPlaybackButton.classList.remove('playing'); + podcastPlaybackButton.setAttribute('aria-pressed', 'false'); window.activeEpisode = undefined; } } @@ -183,7 +187,8 @@ function initializePodcastPlayback() { Array.prototype.forEach.call(records, function (record) { var episodeSlug = record.getAttribute('data-episode'); var podcastSlug = record.getAttribute('data-podcast'); - record.onclick = function () { + + var togglePodcastState = function (e) { if (podcastBarAlreadyExistAndPlayingTargetEpisode(episodeSlug)) { var audio = getById('audio'); if (audio) { @@ -194,6 +199,7 @@ function initializePodcastPlayback() { loadAndPlayNewPodcast(episodeSlug); } }; + record.addEventListener('click', togglePodcastState); }); } diff --git a/app/assets/stylesheets/podcast-episodes-show.scss b/app/assets/stylesheets/podcast-episodes-show.scss index 9dcfc96f4..9ff9d59f2 100644 --- a/app/assets/stylesheets/podcast-episodes-show.scss +++ b/app/assets/stylesheets/podcast-episodes-show.scss @@ -124,6 +124,11 @@ } } + .record-wrapper { + background-color: transparent; + border: 0; + } + .playing { .record { .main-image { diff --git a/app/views/podcast_episodes/show.html.erb b/app/views/podcast_episodes/show.html.erb index d88686530..62e0bf616 100644 --- a/app/views/podcast_episodes/show.html.erb +++ b/app/views/podcast_episodes/show.html.erb @@ -49,18 +49,18 @@ <% end %> -
A real good crow call
", + guid: "A real good crow call
", + published_at: Date.new(2021,1,1), + slug: "crow-call", + subtitle: "Example media: Crow Call", + summary: "6 seconds of bird song
", + title: "Example media | crow call", + website_url: "https://github.com/forem/", + tag_list: nil, + podcast_id: podcast.id + } + PodcastEpisode.create!(podcast_episode_attributes) +end + +############################################################################## + seeder.create_if_none(Reaction) do user = User.find_by(username: "trusted_user_1") admin_user.reactions.create!(category: :vomit, reactable: user)