Sha256: b135b161fd478f4c1cecc2a729240142f0e460bb9881647a142fcd97ee5b8329

Contents?: true

Size: 823 Bytes

Versions: 2

Compression:

Stored size: 823 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

2 entries across 2 versions & 1 rubygems

Version Path
pages_core-3.4.3 app/helpers/pages_core/images_helper.rb
pages_core-3.4.2 app/helpers/pages_core/images_helper.rb