Sha256: ad899edbb48fa0a3a8438e30c32030a8bdc9ff0c9f4a14bc222651709d09e973

Contents?: true

Size: 993 Bytes

Versions: 14

Compression:

Stored size: 993 Bytes

Contents

module Mirador
  module ViewHelpers
    ##
    # @param [String] id
    # @param [String] height
    # @param [String] width
    # @param [String] position
    # @param [String] display
    # @param [Hash] options Mirador settings
    def mirador_tag(id: SecureRandom.uuid, height: '100%', width: '100%', position: 'relative', display: 'block', options: {})
      config = {
        id: id,
        buildPath: '/assets/',
        i18nPath: '',
        imagesPath: ''
      }.merge(options)

      styles = "height: #{height}; width: #{width}; " \
               "position: #{position}; display: #{display};"
      output = []
      output << content_tag(:div, '', id: id, style: styles)
      output << '<script type="text/javascript">'       \
                '  $(function() {'                      \
                "    Mirador(#{config.to_json})"        \
                '  });'                                 \
                '</script>'
      output.join.html_safe
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
mirador_rails-0.8.0 lib/mirador_rails/view_helpers.rb
mirador_rails-0.7.0 lib/mirador_rails/view_helpers.rb
mirador_rails-0.6.0 lib/mirador_rails/view_helpers.rb
mirador_rails-0.5.0 lib/mirador_rails/view_helpers.rb
mirador_rails-0.4.1 lib/mirador_rails/view_helpers.rb
mirador_rails-0.4.0 lib/mirador_rails/view_helpers.rb
mirador_rails-0.3.3 lib/mirador_rails/view_helpers.rb
mirador_rails-0.3.2 lib/mirador_rails/view_helpers.rb
mirador_rails-0.3.1 lib/mirador_rails/view_helpers.rb
mirador_rails-0.3.0 lib/mirador_rails/view_helpers.rb
mirador_rails-0.1.1 lib/mirador_rails/view_helpers.rb
mirador_rails-0.2.1 lib/mirador_rails/view_helpers.rb
mirador_rails-0.2.0 lib/mirador_rails/view_helpers.rb
mirador_rails-0.1.0 lib/mirador_rails/view_helpers.rb