Sha256: 0a5a4a1a2bf4f3e42c941fe16d20c14de73ebf2ad75898722f317aeb636ed2de

Contents?: true

Size: 1.01 KB

Versions: 7

Compression:

Stored size: 1.01 KB

Contents

module Gmaps4railsHelper

  # shortcut helper for marker display with convenient default settings
  # @params [String] builder is a json string
  def gmaps4rails(builder)
    options = {
      :map_options => { :auto_adjust => true},
      :markers     => { :data => builder, :options => {:do_clustering => true} }
    }
    gmaps(options)
  end

  # full helper to pass all variables and their options
  # @params [Hash] options is a Hash containing data and options. Example: { markers:{ data: @json, options: { do_clustering: true } } }
  def gmaps(options)
    options_with_indifferent_access = options.with_indifferent_access
    view_helper                     = Gmaps4rails::ViewHelper.new(options_with_indifferent_access)
    
    render :partial => '/gmaps4rails/gmaps4rails', 
           :locals  => { 
             :options         => options_with_indifferent_access, 
             :js_dependencies => view_helper.js_dependencies_array,
             :dom             => view_helper.dom_attributes
            }
  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
gmaps4rails-1.5.4 lib/gmaps4rails/helper/gmaps4rails_helper.rb
gmaps4rails-1.5.3 lib/gmaps4rails/helper/gmaps4rails_helper.rb
gmaps4rails-1.5.2 lib/gmaps4rails/helper/gmaps4rails_helper.rb
gmaps4rails-1.5.1 lib/gmaps4rails/helper/gmaps4rails_helper.rb
gmaps4rails-1.5.0 lib/gmaps4rails/helper/gmaps4rails_helper.rb
gmaps4rails-1.5.0.pre2 lib/gmaps4rails/helper/gmaps4rails_helper.rb
gmaps4rails-1.5.0.pre lib/gmaps4rails/helper/gmaps4rails_helper.rb