Sha256: 347c9e17386f8bca74ba7b839d43b30a7f90ffa3f3bc4b94bfb15cdaa66095d0
Contents?: true
Size: 777 Bytes
Versions: 16
Compression:
Stored size: 777 Bytes
Contents
# frozen_string_literal: true module Lcms module Engine class MediaPresenter < Lcms::Engine::ResourcePresenter def media_title [subject, resource_type].compact.join(' ').titleize end def embed_podcast MediaEmbed.soundcloud(url, try(:subject).try(:to_sym)) if url.match?(/soundcloud/) end def embed_video_url url.match?(/vimeo/) ? embed_video_vimeo_url : embed_video_youtube_url end private def embed_video_youtube_url video_id = MediaEmbed.video_id(url) "//www.youtube.com/embed/#{video_id}" if video_id end def embed_video_vimeo_url video_id = MediaEmbed.video_id(url) "//player.vimeo.com/video/#{video_id}" if video_id end end end end
Version data entries
16 entries across 16 versions & 1 rubygems