Compare commits

...

3 Commits

Author SHA1 Message Date
Bilal
41a9e83fb2 fix MR comments 2020-08-26 14:08:40 +03:00
Bilal
7c828b4cd2 add spec 2020-08-25 11:33:49 +03:00
Bilal
6bd0439471 show recording preview thumbnail 2020-08-25 11:24:55 +03:00
3 changed files with 18 additions and 1 deletions

View File

@@ -18,4 +18,8 @@ class BroadcastRecording < ApplicationRecord
def download_file_name
"#{broadcast_name}_Date_#{created_at.in_time_zone(broadcast.shoot_location_time_zone).strftime("%Y-%m-%d")}_Time_#{created_at.in_time_zone(broadcast.shoot_location_time_zone).strftime("%T")}".parameterize
end
def thumbnail_url(width = 300)
"https://image.mux.com/#{asset_playback_uid}/thumbnail.jpg?width=#{width}"
end
end

View File

@@ -3,10 +3,11 @@
<ul class="mt-2">
<% recordings.each do |recording| %>
<li>
<%= link_to(recording.download_file_name, recording.download_url, target: "_blank") %>
<%= link_to(recording.download_file_name, recording.download_url, target: "_blank") %>
<% if (controller.class.module_parent.to_s != "Public" && policy(BroadcastRecording).destroy?) %>
<%= link_to "Hide", [broadcast.project, broadcast, recording], class: "btn-sm btn-primary ml-1 text-decoration-none", remote: true, method: :delete, data: { confirm: t('.confirm_hide') } %>
<% end %>
<%= image_tag(recording.thumbnail_url, class: 'img-thumbnail img-fluid mt-2 mb-2') %>
</li>
<% end %>
</ul>

View File

@@ -223,6 +223,18 @@ feature 'User managing broadcasts' do
expect(page).to have_content("Recording of the live stream will appear here")
end
scenario 'Broadcast recording preview thumbnail is shown' do
broadcast = create(:broadcast, :with_stream, :with_files, project: project)
recording = create(:broadcast_recording, broadcast: broadcast, asset_uid: "another_asset_uid")
visit project_broadcast_path(project, broadcast)
click_on 'Previous Sessions'
expect(page).to have_css('img.img-thumbnail')
expect(page.find('img.img-thumbnail')['src']).to match recording.asset_playback_uid
end
context 'When the user is associate' do
let(:current_user) { create(:user, :associate) }