class ActiveAdmin::Views::LatlngProxy

Public Instance Methods

build(_, *args, &_block) click to toggle source
# File lib/activeadmin/views/latlng_proxy.rb, line 4
def build(_, *args, &_block)
  @lang, @id_lat, @id_lng, @height, @loading_map, @api_key, @default_lat, @default_lng, @map_zoom = *args
end
key() click to toggle source
# File lib/activeadmin/views/latlng_proxy.rb, line 8
def key
  @api_key ? "&#{@api_key_name}=#{@api_key}" : ''
end
loading_map_code() click to toggle source
# File lib/activeadmin/views/latlng_proxy.rb, line 16
def loading_map_code
  @loading_map ? script_html : ''
end
script_html() click to toggle source
# File lib/activeadmin/views/latlng_proxy.rb, line 12
def script_html
  @script_html % [@lang, key]
end
to_s() click to toggle source
# File lib/activeadmin/views/latlng_proxy.rb, line 20
def to_s
  template = File.read(File.expand_path("../templates/#{@template_name}", __FILE__))
  variables = {
    loading_map_code: loading_map_code,
    height: @height,
    id_lat: @id_lat,
    id_lng: @id_lng,
    map_zoom: @map_zoom,
    default_lat: @default_lat,
    default_lng: @default_lng
  }

  render_template_with_hash(template, variables)
end

Private Instance Methods

render_template_with_hash(template, hash) click to toggle source
# File lib/activeadmin/views/latlng_proxy.rb, line 37
def render_template_with_hash(template, hash)
  ERB.new(template).result(OpenStruct.new(hash).instance_eval { binding })
end