Module: Gmaps4railsHelper

Defined in:
lib/gmaps4rails/helper/gmaps4rails_helper.rb

Instance Method Summary collapse

Instance Method Details

#gmaps(options) ⇒ Object

full helper to pass all variables and their options



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/gmaps4rails/helper/gmaps4rails_helper.rb', line 15

def gmaps(options)
  options_with_indifferent_access = options.with_indifferent_access
  view_helper                     = Gmaps4rails::ViewHelper.new(options_with_indifferent_access)
  
  js_dependencies = if Gmaps4rails.escape_js_url
                      view_helper.js_dependencies_array
                    else
                      view_helper.js_dependencies_array.map(&:html_safe)
                    end

  render :partial => '/gmaps4rails/gmaps4rails', 
         :locals  => { 
           :options         => options_with_indifferent_access, 
           :js_dependencies => js_dependencies,
           :dom             => view_helper.dom_attributes
          }
end

#gmaps4rails(builder) ⇒ Object

shortcut helper for marker display with convenient default settings



5
6
7
8
9
10
11
# File 'lib/gmaps4rails/helper/gmaps4rails_helper.rb', line 5

def gmaps4rails(builder)
  options = {
    :map_options => { :auto_adjust => true},
    :markers     => { :data => builder, :options => {:do_clustering => true} }
  }
  gmaps(options)
end