class Administrate::Field::AddressLatLng

Public Instance Methods

address?() click to toggle source
# File lib/administrate/field/address_lat_lng.rb, line 29
def address?
  options.fetch(:address, attribute == :address)
end
google_api_key() click to toggle source

Get Google API Key. How to obtain one: developers.google.com/maps/documentation/javascript/get-api-key

# File lib/administrate/field/address_lat_lng.rb, line 39
def google_api_key
  options.fetch(:google_api_key, nil)
end
initial() click to toggle source

Returns the initial co-ordinates of blank maps (defaults to Leeds, UK)

# File lib/administrate/field/address_lat_lng.rb, line 49
def initial
  options.fetch(:initial, [53.8003,-1.5519])
end
lat?() click to toggle source

True if the :lat option has been provided, or field is called :lat

# File lib/administrate/field/address_lat_lng.rb, line 20
def lat?
  options.fetch(:lat, attribute == :lat)
end
lng?() click to toggle source

True if the :lng option has been provided, or field is called :lng

# File lib/administrate/field/address_lat_lng.rb, line 25
def lng?
  options.fetch(:lng, attribute == :lng)
end
search?() click to toggle source

Return wether or not search should be enabled (defaults to true)

# File lib/administrate/field/address_lat_lng.rb, line 34
def search?
  options.fetch(:search, true) && google_api_key.present?
end
to_s() click to toggle source
# File lib/administrate/field/address_lat_lng.rb, line 58
def to_s
  data
end
which() click to toggle source

Returns :lat or :lng depending on which type this is

# File lib/administrate/field/address_lat_lng.rb, line 44
def which
  lat? ? :lat : lng? ? :lng : :address
end
zoom() click to toggle source

Returns the initial zoom level for maps (defaults to 11)

# File lib/administrate/field/address_lat_lng.rb, line 54
def zoom
  options.fetch(:zoom, 11)
end