Sha256: e48c9cb9159c24db6dbade65fe10e5a70ceb394dc6b71548dd57799e9c4ff83f

Contents?: true

Size: 717 Bytes

Versions: 25

Compression:

Stored size: 717 Bytes

Contents

module Alchemy
  module Ingredients
    class AudioView < BaseView
      def call
        content_tag(:audio, **html_options) do
          tag(:source, src: src, type: type)
        end
      end

      def render?
        !!ingredient.attachment
      end

      private

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

      def type
        ingredient.attachment.file_mime_type
      end

      def html_options
        {
          controls: ingredient.controls,
          autoplay: ingredient.autoplay,
          loop: ingredient.loop,
          muted: ingredient.muted
        }
      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/audio_view.rb
alchemy_cms-7.1.6 app/components/alchemy/ingredients/audio_view.rb
alchemy_cms-7.1.5 app/components/alchemy/ingredients/audio_view.rb
alchemy_cms-7.0.10 app/components/alchemy/ingredients/audio_view.rb
alchemy_cms-7.1.4 app/components/alchemy/ingredients/audio_view.rb
alchemy_cms-7.0.9 app/components/alchemy/ingredients/audio_view.rb
alchemy_cms-7.1.3 app/components/alchemy/ingredients/audio_view.rb
alchemy_cms-7.1.2 app/components/alchemy/ingredients/audio_view.rb
alchemy_cms-7.1.1 app/components/alchemy/ingredients/audio_view.rb
alchemy_cms-7.1.0 app/components/alchemy/ingredients/audio_view.rb
alchemy_cms-7.1.0.pre.rc1 app/components/alchemy/ingredients/audio_view.rb
alchemy_cms-7.1.0.pre.b2 app/components/alchemy/ingredients/audio_view.rb
alchemy_cms-7.1.0.pre.b1 app/components/alchemy/ingredients/audio_view.rb
alchemy_cms-7.0.8 app/components/alchemy/ingredients/audio_view.rb
alchemy_cms-7.0.7 app/components/alchemy/ingredients/audio_view.rb
alchemy_cms-7.0.6 app/components/alchemy/ingredients/audio_view.rb
alchemy_cms-7.0.5 app/components/alchemy/ingredients/audio_view.rb
alchemy_cms-7.0.4 app/components/alchemy/ingredients/audio_view.rb
alchemy_cms-7.0.3 app/components/alchemy/ingredients/audio_view.rb
alchemy_cms-7.0.2 app/components/alchemy/ingredients/audio_view.rb