Sha256: a716518a3c6b8985ed57885d15221f4807bd89187e5ff55c6b10aa37583e1fa5

Contents?: true

Size: 829 Bytes

Versions: 1

Compression:

Stored size: 829 Bytes

Contents

# encoding: utf-8

module PagesCore
  module ImagesHelper
    include DynamicImage::Helper

    def dynamic_image_tag(record_or_array, options = {})
      super(
        record_or_array,
        extract_alt_text(record_or_array).merge(options)
      )
    end

    def original_dynamic_image_tag(record_or_array, options = {})
      super(
        record_or_array,
        extract_alt_text(record_or_array).merge(options)
      )
    end

    def uncropped_dynamic_image_tag(record_or_array, options = {})
      super(
        record_or_array,
        extract_alt_text(record_or_array).merge(options)
      )
    end

    private

    def extract_alt_text(record_or_array)
      record = extract_dynamic_image_record(record_or_array)
      return {} unless record.alternative?
      { alt: record.alternative }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pages_core-3.5.1 app/helpers/pages_core/images_helper.rb