Sha256: d8d08c4f68a28467f3ff1f4ed9708389989bd2af5ef6bd97114781a1eef0432a

Contents?: true

Size: 887 Bytes

Versions: 25

Compression:

Stored size: 887 Bytes

Contents

module Alchemy
  module Ingredients
    class VideoView < BaseView
      delegate :attachment, to: :ingredient

      def call
        content_tag(:video, html_options) do
          tag(:source, src: src, type: attachment.file_mime_type)
        end
      end

      def render?
        !attachment.nil?
      end

      private

      def src
        alchemy.show_attachment_path(
          attachment,
          format: attachment.suffix
        )
      end

      def html_options
        {
          controls: ingredient.controls,
          autoplay: ingredient.autoplay,
          loop: ingredient.loop,
          muted: ingredient.muted,
          playsinline: ingredient.playsinline,
          preload: ingredient.preload.presence,
          width: ingredient.width.presence,
          height: ingredient.height.presence
        }.merge(@html_options)
      end
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
alchemy_cms-7.0.11 app/components/alchemy/ingredients/video_view.rb
alchemy_cms-7.1.6 app/components/alchemy/ingredients/video_view.rb
alchemy_cms-7.1.5 app/components/alchemy/ingredients/video_view.rb
alchemy_cms-7.0.10 app/components/alchemy/ingredients/video_view.rb
alchemy_cms-7.1.4 app/components/alchemy/ingredients/video_view.rb
alchemy_cms-7.0.9 app/components/alchemy/ingredients/video_view.rb
alchemy_cms-7.1.3 app/components/alchemy/ingredients/video_view.rb
alchemy_cms-7.1.2 app/components/alchemy/ingredients/video_view.rb
alchemy_cms-7.1.1 app/components/alchemy/ingredients/video_view.rb
alchemy_cms-7.1.0 app/components/alchemy/ingredients/video_view.rb
alchemy_cms-7.1.0.pre.rc1 app/components/alchemy/ingredients/video_view.rb
alchemy_cms-7.1.0.pre.b2 app/components/alchemy/ingredients/video_view.rb
alchemy_cms-7.1.0.pre.b1 app/components/alchemy/ingredients/video_view.rb
alchemy_cms-7.0.8 app/components/alchemy/ingredients/video_view.rb
alchemy_cms-7.0.7 app/components/alchemy/ingredients/video_view.rb
alchemy_cms-7.0.6 app/components/alchemy/ingredients/video_view.rb
alchemy_cms-7.0.5 app/components/alchemy/ingredients/video_view.rb
alchemy_cms-7.0.4 app/components/alchemy/ingredients/video_view.rb
alchemy_cms-7.0.3 app/components/alchemy/ingredients/video_view.rb
alchemy_cms-7.0.2 app/components/alchemy/ingredients/video_view.rb