Class: Administrate::Field::LatLng
- Inherits:
-
Base
- Object
- Base
- Administrate::Field::LatLng
- Defined in:
- lib/administrate/field/lat_lng.rb
Defined Under Namespace
Classes: Engine
Instance Method Summary collapse
-
#google_api_key ⇒ Object
Get Google API Key.
-
#initial ⇒ Object
Returns the initial co-ordinates of blank maps (defaults to Leeds, UK).
-
#lat? ⇒ Boolean
True if the :lat option has been provided, or field is called :lat.
-
#lng? ⇒ Boolean
True if the :lng option has been provided, or field is called :lng.
-
#search? ⇒ Boolean
Return wether or not search should be enabled (defaults to true).
- #to_s ⇒ Object
-
#which ⇒ Object
Returns :lat or :lng depending on which type this is.
-
#zoom ⇒ Object
Returns the initial zoom level for maps (defaults to 11).
Instance Method Details
#google_api_key ⇒ Object
Get Google API Key. How to obtain one: developers.google.com/maps/documentation/javascript/get-api-key
40 41 42 |
# File 'lib/administrate/field/lat_lng.rb', line 40 def google_api_key .fetch(:google_api_key, nil) end |
#initial ⇒ Object
Returns the initial co-ordinates of blank maps (defaults to Leeds, UK)
50 51 52 |
# File 'lib/administrate/field/lat_lng.rb', line 50 def initial .fetch(:initial, [53.8003,-1.5519]) end |
#lat? ⇒ Boolean
True if the :lat option has been provided, or field is called :lat
25 26 27 |
# File 'lib/administrate/field/lat_lng.rb', line 25 def lat? .fetch(:lat, attribute == :lat) end |
#lng? ⇒ Boolean
True if the :lng option has been provided, or field is called :lng
30 31 32 |
# File 'lib/administrate/field/lat_lng.rb', line 30 def lng? .fetch(:lng, attribute == :lng) end |
#search? ⇒ Boolean
Return wether or not search should be enabled (defaults to true)
35 36 37 |
# File 'lib/administrate/field/lat_lng.rb', line 35 def search? .fetch(:search, true) && google_api_key.present? end |
#to_s ⇒ Object
59 60 61 |
# File 'lib/administrate/field/lat_lng.rb', line 59 def to_s data end |
#which ⇒ Object
Returns :lat or :lng depending on which type this is
45 46 47 |
# File 'lib/administrate/field/lat_lng.rb', line 45 def which lat? ? :lat : :lng end |
#zoom ⇒ Object
Returns the initial zoom level for maps (defaults to 11)
55 56 57 |
# File 'lib/administrate/field/lat_lng.rb', line 55 def zoom .fetch(:zoom, 11) end |