Sha256: 8f120dfef94bd34c0968d17e83480f6eb84998e43e98388e5a6f5dc2ef60556e

Contents?: true

Size: 897 Bytes

Versions: 27

Compression:

Stored size: 897 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.html_safe
      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

27 entries across 27 versions & 1 rubygems

Version Path
alchemy_cms-7.4.0 app/components/alchemy/ingredients/video_view.rb
alchemy_cms-7.3.5 app/components/alchemy/ingredients/video_view.rb
alchemy_cms-7.2.8 app/components/alchemy/ingredients/video_view.rb
alchemy_cms-7.1.13 app/components/alchemy/ingredients/video_view.rb
alchemy_cms-7.0.16 app/components/alchemy/ingredients/video_view.rb
alchemy_cms-7.3.4 app/components/alchemy/ingredients/video_view.rb
alchemy_cms-7.3.3 app/components/alchemy/ingredients/video_view.rb
alchemy_cms-7.3.2 app/components/alchemy/ingredients/video_view.rb
alchemy_cms-7.2.7 app/components/alchemy/ingredients/video_view.rb
alchemy_cms-7.3.1 app/components/alchemy/ingredients/video_view.rb
alchemy_cms-7.3.0 app/components/alchemy/ingredients/video_view.rb
alchemy_cms-7.2.6 app/components/alchemy/ingredients/video_view.rb
alchemy_cms-7.2.5 app/components/alchemy/ingredients/video_view.rb
alchemy_cms-7.1.12 app/components/alchemy/ingredients/video_view.rb
alchemy_cms-7.0.15 app/components/alchemy/ingredients/video_view.rb
alchemy_cms-7.2.4 app/components/alchemy/ingredients/video_view.rb
alchemy_cms-7.1.11 app/components/alchemy/ingredients/video_view.rb
alchemy_cms-7.2.3 app/components/alchemy/ingredients/video_view.rb
alchemy_cms-7.1.10 app/components/alchemy/ingredients/video_view.rb
alchemy_cms-7.2.2 app/components/alchemy/ingredients/video_view.rb