Sha256: 6b3cf4bd7c3e0c59705e57dd8d1a4f2cf7c22ea6c1c09581be4aa120a06b0244

Contents?: true

Size: 771 Bytes

Versions: 3

Compression:

Stored size: 771 Bytes

Contents

# encoding: utf-8
module Middleman
  module Presentation
    # Helper module
    module Helpers
      # Images helpers
      module ImageGallery
        # Create image gallery
        def image_gallery(images, image_gallery_id:)
          template = File.read(File.expand_path('../../../../templates/image_gallery.erb', __FILE__)).chomp

          images.each_with_object([]) do |(image, title), memo|
            engine = Erubis::Eruby.new(template)

            memo << engine.result(image_path: image, image_gallery_id: image_gallery_id, title: title)
          end.join("\n")
        end

        # Create entry for single image
        def image(image)
          image_gallery Array(image), image_gallery_id: SecureRandom.hex
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
middleman-presentation-helpers-0.0.7 lib/middleman-presentation/helpers/image_gallery.rb
middleman-presentation-helpers-0.0.6 lib/middleman-presentation/helpers/image_gallery.rb
middleman-presentation-helpers-0.0.5 lib/middleman-presentation/helpers/image_gallery.rb