diff --git a/app/models/account/seeder.rb b/app/models/account/seeder.rb index 989b56852..f9f06cb98 100644 --- a/app/models/account/seeder.rb +++ b/app/models/account/seeder.rb @@ -59,7 +59,11 @@ class Account::Seeder bug_tracker.cards.create! creator: creator, column: resolved_column, title: "Fix broken links in footer", status: "published" # Comments - profile_crash_card.comments.create! creator: creator, body: "I can reproduce this with images over 5MB" + profile_crash_card.comments.create! creator: creator, body: <<~HTML + I can reproduce this with images over 5MB + + + HTML profile_crash_card.comments.create! creator: creator, body: "Looking into adding client-side image compression before upload" # ---------------------------- diff --git a/app/models/concerns/attachments.rb b/app/models/concerns/attachments.rb index 1813e61e9..d30496165 100644 --- a/app/models/concerns/attachments.rb +++ b/app/models/concerns/attachments.rb @@ -36,6 +36,14 @@ module Attachments remote_images.any? end + def remote_videos + rich_text_record&.body&.attachables&.grep(ActionText::Attachables::RemoteVideo) || [] + end + + def has_remote_videos? + remote_videos.any? + end + private def rich_text_record @rich_text_record ||= begin diff --git a/app/views/action_text/attachables/_remote_video.html.erb b/app/views/action_text/attachables/_remote_video.html.erb new file mode 100644 index 000000000..5233d062a --- /dev/null +++ b/app/views/action_text/attachables/_remote_video.html.erb @@ -0,0 +1,10 @@ +
+ <%= tag.video controls: true, width: remote_video.width, height: remote_video.height do %> + <%= tag.source src: remote_video.url, type: remote_video.content_type %> + <% end %> + <% if caption = remote_video.try(:caption) %> +
+ <%= caption %> +
+ <% end %> +
diff --git a/app/views/events/event/_attachments.html.erb b/app/views/events/event/_attachments.html.erb index 05b88e6ba..aff8316da 100644 --- a/app/views/events/event/_attachments.html.erb +++ b/app/views/events/event/_attachments.html.erb @@ -1,4 +1,4 @@ -<% if eventable&.has_attachments? || eventable&.has_remote_images? %> +<% if eventable&.has_attachments? || eventable&.has_remote_images? || eventable&.has_remote_videos? %> <% eventable.attachments.each do |attachment| %> <% variant = Attachments::VARIANTS[:small] %> @@ -17,7 +17,13 @@ <% end %> <% eventable.remote_images.each do |remote_image| %> - <%= image_tag remote_image.url, class: "attachment attachment--image", width: remote_image.width, height: remote_image.height, alt: remote_image.alt %> + <%= image_tag remote_image.url, class: "attachment attachment--image", width: remote_image.width, height: remote_image.height %> + <% end %> + + <% eventable.remote_videos.each do |remote_video| %> + <%= tag.video controls: true, class: "attachment attachment--video", width: remote_video.width, height: remote_video.height do %> + <%= tag.source src: remote_video.url, type: remote_video.content_type %> + <% end %> <% end %> <% end %>