Sha256: 09deb72f8ab74ca15b160beba4ec15869730e9d4c28a66b28e717a5a911ab693
Contents?: true
Size: 1.08 KB
Versions: 2
Compression:
Stored size: 1.08 KB
Contents
require 'administrate/field/base' require 'rails' module Administrate module Field class LatLng < Base class Engine < ::Rails::Engine end JS_URL = "//cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.7/leaflet.js" CSS_URL = "//cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.7/leaflet.css" # True if the :lat option has been provided, or field is called :lat def lat? options.fetch(:lat, attribute == :lat) end # True if the :lng option has been provided, or field is called :lng def lng? options.fetch(:lng, attribute == :lng) end # Returns :lat or :lng depending on which type this is def which lat? ? :lat : :lng end # Returns the initial co-ordinates of blank maps (defaults to Leeds, UK) def initial options.fetch(:initial, [53.8003,-1.5519]) end # Returns the initial zoom level for maps (defaults to 11) def zoom options.fetch(:zoom, 11) end def to_s data end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
administrate-field-lat_lng-1.0.2 | lib/administrate/field/lat_lng.rb |
administrate-field-lat_lng-1.0.1 | lib/administrate/field/lat_lng.rb |