Fix #431 - convert gif to webm during upload. Web UI treats them like it did
before. In the API, attachments now can be either image, video or gifv. Gifv is to be treated like images in terms of behaviour, but are videos by file type.
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
object @media
|
||||
attribute :id, :type
|
||||
node(:url) { |media| full_asset_url(media.file.url( :original)) }
|
||||
node(:preview_url) { |media| full_asset_url(media.file.url( :small)) }
|
||||
node(:url) { |media| full_asset_url(media.file.url(:original)) }
|
||||
node(:preview_url) { |media| full_asset_url(media.file.url(:small)) }
|
||||
node(:text_url) { |media| medium_url(media) }
|
||||
|
@ -22,9 +22,9 @@
|
||||
.detailed-status__attachments
|
||||
- if status.sensitive?
|
||||
= render partial: 'stream_entries/content_spoiler'
|
||||
- status.media_attachments.each do |media|
|
||||
.media-item
|
||||
= link_to '', (media.remote_url.blank? ? media.file.url(:original) : media.remote_url), style: "background-image: url(#{media.file.url(:original)})", target: '_blank', rel: 'noopener', class: "u-#{media.video? ? 'video' : 'photo'}"
|
||||
.status__attachments__inner
|
||||
- status.media_attachments.each do |media|
|
||||
= render partial: 'stream_entries/media', locals: { media: media }
|
||||
|
||||
%div.detailed-status__meta
|
||||
%data.dt-published{ value: status.created_at.to_time.iso8601 }
|
||||
|
4
app/views/stream_entries/_media.html.haml
Normal file
4
app/views/stream_entries/_media.html.haml
Normal file
@ -0,0 +1,4 @@
|
||||
.media-item
|
||||
= link_to media.remote_url.blank? ? media.file.url(:original) : media.remote_url, style: media.image? ? "background-image: url(#{media.file.url(:original)})" : "", target: '_blank', rel: 'noopener', class: "u-#{media.video? || media.gifv? ? 'video' : 'photo'}" do
|
||||
- unless media.image?
|
||||
%video{ src: media.file.url(:original), autoplay: true, loop: true }/
|
@ -22,11 +22,12 @@
|
||||
- if status.sensitive?
|
||||
= render partial: 'stream_entries/content_spoiler'
|
||||
- if status.media_attachments.first.video?
|
||||
.video-item
|
||||
= link_to (status.media_attachments.first.remote_url.blank? ? status.media_attachments.first.file.url(:original) : status.media_attachments.first.remote_url), style: "background-image: url(#{status.media_attachments.first.file.url(:small)})", target: '_blank', rel: 'noopener', class: 'u-video' do
|
||||
.video-item__play
|
||||
= fa_icon('play')
|
||||
.status__attachments__inner
|
||||
.video-item
|
||||
= link_to (status.media_attachments.first.remote_url.blank? ? status.media_attachments.first.file.url(:original) : status.media_attachments.first.remote_url), style: "background-image: url(#{status.media_attachments.first.file.url(:small)})", target: '_blank', rel: 'noopener', class: 'u-video' do
|
||||
.video-item__play
|
||||
= fa_icon('play')
|
||||
- else
|
||||
- status.media_attachments.each do |media|
|
||||
.media-item
|
||||
= link_to '', (media.remote_url.blank? ? media.file.url(:original) : media.remote_url), style: "background-image: url(#{media.file.url(:original)})", target: '_blank', rel: 'noopener', class: "u-#{media.video? ? 'video' : 'photo'}"
|
||||
.status__attachments__inner
|
||||
- status.media_attachments.each do |media|
|
||||
= render partial: 'stream_entries/media', locals: { media: media }
|
||||
|
Reference in New Issue
Block a user